Move build metadata from setup.py to pyproject.toml.#592
Move build metadata from setup.py to pyproject.toml.#592bsteffensmeier merged 3 commits intoninia:dev_4.3from
Conversation
ndjensen
left a comment
There was a problem hiding this comment.
How are you able to tell the install is using pyproject.toml instead of setup.py? Or does it use both?
Do you know if there is still a way to run individual build commands like clean, java, build_ext, test?
pyproject.toml
Outdated
| name = "jep" | ||
| description = "Jep embeds CPython in Java through JNI." | ||
| dynamic = ["version"] | ||
| #version = "4.3.0" |
There was a problem hiding this comment.
I forgot to remove that when I got the dynamic version working. Leaving the version specifier in the setup() call in setup.py allows it to pick up the version in version.py so we don't have to remember to keep this version in sync. I will remove the commented out version.
| @@ -0,0 +1,45 @@ | |||
| [build-system] | |||
| requires = ["setuptools >= 61.0"] | |||
There was a problem hiding this comment.
Is this the version that first included distutils? How did you pick the version?
There was a problem hiding this comment.
It is always using both. When you run a If you just call setup.py without pip then it still loads metadata from pyproject.toml.
I am able to use those by running setup.py directly. There is no change that I can see in how those work. setup.py still prints a deprecation warning saying you shouldn't call it but it still works. |
pyproject.toml
Outdated
| name = "jep" | ||
| description = "Jep embeds CPython in Java through JNI." | ||
| dynamic = ["version"] | ||
| license = { "text" = "zlib/libpng"} |
There was a problem hiding this comment.
license is an attribute that confused me and may need more work in the future. We have the option to specify a license file or license text but when I tried the file it embedded the full license into the setup.cfg which is included in the upload to pypi and I am not sure how that shows up on pypi so I reverted to the simple text here which makes the setup.cfg match what it did before.
It also seems that PEP-639 was just approved and applied to the pyproject.toml specification last month. According to the current documentation the license needs to be a valid SPDX identifier which this doesn't seem to be. But the versions of pip I was testing with don't support PEP-639 so I don't think we can actually update until we drop support for all older versions of Python.
There was a problem hiding this comment.
I think ours is the one listed as zlib. https://opensource.org/license/zlib
There was a problem hiding this comment.
Do you think I should change this to zlib?
There was a problem hiding this comment.
Probably should be Zlib to match the SPDX identifier? The SPDX page doesn't mention libpng but the OSI page does, so I think it's the same thing.
This moves the build metadata into pyproject.toml. As far as I can tell there is no immediate benefit to this change but it aligns with current best practices for building a python project and I suspect it is inevitable we will need to use pyproject.toml at some point in the future so I would like to have a starting version to work with in the future.
With this change I am still able to build using either
pip install --no-build-isolation .orsetup.py install. I still get a deprecation warning when running setup.py directly.