-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make use of pyproject.toml for static project metadata #1133
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1133 +/- ##
==========================================
+ Coverage 87.44% 87.46% +0.01%
==========================================
Files 113 113
Lines 10236 10236
Branches 4057 4057
==========================================
+ Hits 8951 8953 +2
+ Misses 692 691 -1
+ Partials 593 592 -1 ☔ View full report in Codecov by Sentry. |
For trivial (in the sense of building) projects, pyproject.toml covers all relevant metadata and tool configuration (like setup.cfg). Since lot of effort went into the building system of JPype I'd discourage transitioning away from it, as long as we are not forced to. As of the usage of only static metadata, I also currently discourage its use, because as you already noticed yourself you need to invoke the installation by pip so pyproject.toml will be used. |
I agree completely. The modern Python packaging tools are not entirely moving away from the setuptools/distutils concepts - Extensions still require a The benefit is pretty low, but it essentially boils down to moving some of the config to a declarative form. In turn, this could have knock on benfits like having greater visibility of what the metadata actually declares (such as noticing a maintainer who retired 8 years ago 😜). |
The other significant benefit that comes to mind is that we can properly declare build-time dependencies. Currently we don't do that, and assume that |
The one hold-up I have is that I am not confident that we can even use I will look into this now to figure out what the situation is, and then update here. |
In the end, I implemented the recommended approach of adding per-command options. It means that I had to also implement the All in all, I'm happy with the outcome, although it was more work than I'd planned. |
Sorry about the general state of setupext. The state of python disttools was very poor when I worked on it and I was forced to work around a lot of broken stuff in Python 2 and Python 3.4/3.5. The important parts that we need to maintain are
|
Yes, all maintained as far as I understand.
I was going to ask about this option. In what way is it not incremental? This is the behaviour I see (it only re-compiles what setuptools/distutils thinks has changed). Indeed, I do see a problem with it being overly zealous with its caching and fails to pick up some things (like macro changes), at which point you have to Furthermore, It isn't hard to maintain the |
👍 for the ccache ability. This is for instance broken in pip install (because the source is copied to a temporary location). |
I haven't ever seen setup.py build anything other than completely from scratch. I was forced to move files to a directory called aaaa to test compiling, hence adding a makefile option. Perhaps there has been a change since 3.4. What option do you use to get it to perform incremental builds? |
It is the default, but it has always been the case (even before Python 2.6). It is possible that it is per extension - and since we only have one extension we don't get any benefit from it. I can double-double check though - I extensively use |
It seems you are right. airspeed-velocity/asv#201 (comment) highlights the problem (and potential solutions). In the end, to get this working correctly, I had to disable build isolation (so you lose build-time dependency installation). When doing this, I get ccache hits, and a fast build:
I had initially thought this was related to the fact that It would be interesting to explore why the For now, I think |
Thanks for the insights. This is a problem I struggled with for a long time especially when I am debugging a complex issue. I will likely continue to use the |
How to proceed on this one? I think it makes a good step forwards, but can understand that this is a bit of churn, and may lead to a few issues cropping up (not ideal, given the limited cycles available on the project). Having said that, I don't believe we are going to encounter anything that cannot be solved by the approach taken, and am willing to follow-up in such a situation. |
@pelson If you feel like resolving the merge conflicts, I think we are ready to merge this. |
d424c80
to
c2f1ead
Compare
I've rebased. I did a final check that iterative rebuilds are working well. My conclusions:
For the record, my
And
No ccache needed for the |
c2f1ead
to
c681e8b
Compare
c681e8b
to
b9472a3
Compare
Thanks for this modernization @pelson! |
It appears this change broke the jpython exe build I was working on because it removed the custom distribution object. Is there some replacement to add extra keywords to the distribution object so that I can pass those arguments through to the appropriate build script? |
Sorry for the delay, was away last week.
The options moved to the specific commands. Sounds like this would be an option to go on Line 175 in 904fc43
|
Unfortunately that didn't help with my efforts to construct a binary as I needed a new build type. For now I did the same thing that I did with the jar and just add more functionality to build_ext rather than setting up a new target for build_exe. The new system that Python is going for it a real downgrade from the old disttools. They seem to want all custom stuff to use thirdparty launchers. But that would be a huge challenge to support cross platform without installing some cross platform install tool where disttools provides the needed support. Unfortunately, my jpython binary is stuck on a corrupt stack frame when the main is launched from Java. I will take another stab at it next week. |
Uses the PEP-518
pyproject.toml
to declaratively define as much project metadata as possible, and keeps the project closer aligned with the current norms.The upside of this approach is that we get declarative metadata, and can start to leverage other tools on top of
pyproject.toml
in very standard ways (e.g. we could be usingsetuptools-scm
today, but withpyproject.toml
, it becomes the defacto-documented approach to usingsetuptools-scm
). In general,pyproject.toml
is clearly the direction of travel in the Python community.Some downsides:
setup.py
. If youpython setup.py ...
it might not pick up the metadata correctly (this invocation approach is deprecated and discouraged)pyproject.toml
and when it should be insetup.py
(gradually, more metadata components are moving topyproject.toml
)