Conversation
|
Hold for 2.1.0? |
Yeah, I'm not trying to squeeze this in, just floating the idea with the team for now. It should basically "do nothing" as far as our current processes are concerned, but I wouldn't add entropy to the release by including it just to be safe. |
|
I should also mention that |
Codecov Report
@@ Coverage Diff @@
## develop #3398 +/- ##
===========================================
+ Coverage 94.06% 94.10% +0.04%
===========================================
Files 176 189 +13
Lines 23294 24596 +1302
Branches 3305 3305
===========================================
+ Hits 21911 23146 +1235
- Misses 1337 1404 +67
Partials 46 46
Continue to review full report at Codecov.
|
|
Should there be tests showing that we can build packages from the current checkout? Such tests would also serve as an example for how to use the new toml file, especially with some of the newer packaging tools that you mention. |
|
We could build a wheel in CI, install it, then do the runtime testing with the oldest version of NumPy we support to check the ABI compatibility perhaps. I believe this would currently fail that by using a "too new" version of NumPy to build the wheel proper, so would need to address that I think. May be interesting to confirm that CI catches that. |
* add a a `pyproject.toml` file to comply with PEP518, and to allow for wheel builds that leverage PEP517 * in short, in a fresh/naive Python environment with no dependencies available, it is not currently possible to use i.e., `pip install .` to install MDAnalysis (or to use any of the other emerging tools like poetry and flit that are PEP518 dependent) * this will change almost nothing about how we operate builds in the near-term (still very `setup.py` focused), but it does begin to bring us into alignment with the future of the Python packaging ecosystem * this solves various "chicken and egg" problems like "how does pip know your project needs setuptools if it has to read setup.py, which contains elements that require setuptools to read them to understand what dependencies are needed" * I verified this works on an aarch64 ThunderX2 node running RHEL with `python -m pip install .` successfully building a wheel for MDAnalysis and installing it; many other pieces of information can be added to this file, though this `build-system` section is the most fundamental * note that this is an oversimplified draft--it should be safe to use, but we'll probably want to dial back and pin to an older NumPy instead of using the latest NumPy we can get that is greater than our minimum; I'd suggest I/we do that in a follow-up since it will require confirming which minimum versions of NumPy are needed on which platforms--similar to this kind of thing: https://github.com/scipy/scipy/blob/master/pyproject.toml#L23 * I also think we should probably be safe to require a much newever minimum version of Cython in this file really, though I've replicated our setuptools specification for now
5dbcd18 to
acaa8f5
Compare
|
Ok, I've pushed in a sample CI test that should fail because the wheel build will currently use the latest NumPy available and result in an ABI compatibility issue against an older NumPy (this is commonly checked in wheel building workflows). Reviewers should be able to see something like The next step I propose is to adjust the |
|
Indeed, that exact failure is already visible here: https://dev.azure.com/mdanalysis/cefe1135-cd6a-4689-8710-15bd37ad81e6/_apis/build/builds/2589/logs/39 It may disappear b/c I pushed in a fix already--see original failure from my fork: https://dev.azure.com/tylerjereddy/95673c6f-2c02-4a76-94e1-d58ebf2b2056/_apis/build/builds/1201/logs/46 |
5eee32f to
e8a9e74
Compare
|
ok, I pushed in an attempted fix to get the CI wheel test to pass--may require some iteration to get it just right |
943f4b3 to
43ef007
Compare
* adjust `pyproject.toml` to use the lowest viable version of NumPy with Python `3.8` on "regular" platforms to enhance ABI compatibility of our wheels
43ef007 to
78a73d8
Compare
|
Looks like we currently require |
Oops my bad - I'll do a quick fix for that, is it just line 192? |
* adjust Azure CI to also test wheel builds for Python 3.7, 3.9 * try bumping up the minimum Cython version used in `pyproject.toml` because of this observed error with MDAnalysis wheel build test suite: ``` AttributeError: type object 'gsd.fl.GSDFile' has no attribute '__reduce_cython__' ``` * add `pyproject.toml` placeholder entries for Python 3.7 and 3.9 as well; let's see how CI does with these..
7e81255 to
da51541
Compare
|
Dealing with A quick search online suggests that bumping the version of Cython used to build can help, but those are pre-packaged wheels of |
I've not had time to look at the error specifically - would it make sense to propose raising the global minimum version of gsd to 1.9.3? (that way we don't have to differentiate between windows and *nix/macOS?). 1.9.3 is now ~ 2 years old, so it's not completely NEP29-like, but it might not be too much of a problem? The other (and maybe better) option is to raise the version, but also make GSD optional (instead of required by setup)? This would pave the way towards a lower dependency mdanalysis-base package? |
@lilyminium Cool. It also occurs to me, since this has been stale for so long, that we could potentially save a bunch of work by using https://github.com/scipy/oldest-supported-numpy for a more concise |
IAlibay
left a comment
There was a problem hiding this comment.
Sorry for the massive delay on this @tylerjereddy - just a couple of questions.
| "Cython>=0.28", | ||
| # lowest NumPy we can use for a given Python, | ||
| # except for more exotic platforms (linux/Mac ARM flavors) | ||
| "numpy==1.18; python_version=='3.7' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_machine!='aarch64'", |
There was a problem hiding this comment.
I think I'm missing something about how this works, is there a reason why this isn't just "numpy>=1.18"?
There was a problem hiding this comment.
Also I'm not sure I fully understand your comments about going to a lower numpy version. Given that we're meant to be sticking to NEP29 going forward, probably all we'll want to do is bump things up as necessary?
There was a problem hiding this comment.
You always want to build with the lowest possible NumPy version because there is forward but not backward ABI compatibility at runtime.
That's also why we should probably just use: https://github.com/scipy/oldest-supported-numpy (that leaves the decisions about minimum viable NumPy up to the experts) See also, i.e., pandas example:
https://github.com/pandas-dev/pandas/blob/main/pyproject.toml#L8
What's the timeline for getting this stuff ready?
There was a problem hiding this comment.
Ideally I'd like to cut a release soon-ish (week or two max). If it doesn't make it then it can always go in 2.2.0. (we're going to try to trim releases so they are closer to every 3 months).
I'm not sure I understand how this works though. If someone calls python setup.py install without any dependencies then will it pull the lowest numpy version and stick to that only?
There was a problem hiding this comment.
setup.py install is effectively deprecated (though should still work for quite some time), and shouldn't be affected by pyproject.toml
For building MDAnalysis with a modern approach (i.e., pip install .)--pip will create an isolated build environment with the stuff we specify in this file, and build MDAnalysis in a manner that should be maximally compatible with whatever runtime environment the user has--whether that be new or old NumPy. An obvious application is building a binary wheel that won't barf with older versions of NumPy, within reason.
There was a problem hiding this comment.
Sorry took me so much time to get back to this.
pip will create an isolated build environment
🤯 Thanks for explaining this @tylerjereddy, I had no idea that was a thing.
In terms of contents of this PR I think it all makes sense now.
|
|
||
| jobs: | ||
| - job: Windows | ||
| - job: Azure_Tests |
There was a problem hiding this comment.
I have a feeling I'd mess it up if I try to help deal with conflicts here - but I'm happy to give it a go if you're short on time for this @tylerjereddy
|
🤔 the Cython failures here are non-sensical to me, especially for RTD - Cython is definitely installed by mamba, so the conflict is just weird unless it doesn't like what's in setup.cfg for some reason. note: I attempted to fix the conflicts on the azure pipelines file but that shouldn't have led to our current issues. |
* use oldest-supported-numpy instead of duplicating the upstream logic in `pyproject.toml` * `packaging` is now a dependency of `setup.py`, so we need to add this in `pyproject.toml`
That's because there's a I've pushed in a revision to change two things:
Other thoughts:
|
|
argh, our NumPy version requirements are too complex for |
1ee4974 to
9a078ec
Compare
* restore custom NumPy version handling logic to `pyproject.toml` and also add a case for Python `3.10`
9a078ec to
c34cb56
Compare
|
Thanks @tylerjereddy, I was somewhat confused as to why we didn't catch this at earlier commit stages (e.g. ba197e1), maybe the pre-2019 azure images had re: packaging, I'm in support of both your points. Actually on the point of PEP440, can we move Lines 59 to 63 in e4ed4ff python_requires?
|
I wouldn't recommend it just yet--I think we'd still want the best possible functionality/error feedback for old-school One other comment is that the chances that this draft I think there are some more useful things we can add to I was hoping to avoid doing all of that in this PR though, instead incrementally building it up. |
I think it is a simpler explanation--this PR is pretty old and the dependency on diff --git a/package/setup.py b/package/setup.py
index 8c37a7385..3634a972c 100755
--- a/package/setup.py
+++ b/package/setup.py
@@ -83,10 +83,10 @@ try:
import Cython
from Cython.Build import cythonize
cython_found = True
- from distutils.version import LooseVersion
+ from packaging.version import Version
required_version = "0.16"
- if not LooseVersion(Cython.__version__) >= LooseVersion(required_version):
+ if not Version(Cython.__version__) >= Version(required_version):
# We don't necessarily die here. Maybe we already have
# the cythonized '.c' files.
print("Cython version {0} was found but won't be used: version {1} "
|
Yeah that's fair. If you want to open up issues so we remember to do them that would be great. I am hoping to release 2.1.0 ~ Wednesday, but anything that's easy enough to implement we can push through before then. |
|
Is |
I think I have seen it fail before, it's rare though. |
|
/azp run --name Azure_Tests Linux-Python37-64bit-full-wheel |
|
No pipelines are associated with this pull request. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
I abstracted what I think we might want to add in our first pass before releasing here: gh-3526, though it is likely not critical (I think the build reqs are the most important part). |
|
Thanks @tylerjereddy ! |
* hoist the import of `packaging` outside of a Cython-focused `try`/`except` block to avoid a deceptive error message when `packaging` is missing, per discussion at: MDAnalysis#3398 (comment) * we may also want to consider removing the external dependency completely and vendoring the pertinent code since it is so small, but maybe not this close to a release; an example: https://github.com/scipy/scipy/blob/main/scipy/_lib/_pep440.py
* hoist the import of `packaging` outside of a Cython-focused `try`/`except` block to avoid a deceptive error message when `packaging` is missing, per discussion at: #3398 (comment)

add a
pyproject.tomlfile to complywith PEP518, and to allow for wheel builds
that leverage PEP517
in short, in a fresh/naive Python environment
with no dependencies available, it is not currently
possible to use i.e.,
pip install .to installMDAnalysis (or to use any of the other emerging tools
like poetry and flit that are PEP518 dependent)
this will change almost nothing about how we
operate builds in the near-term (still very
setup.pyfocused), but it does begin to bring us into alignment
with the future of the Python packaging ecosystem
this solves various "chicken and egg" problems like
"how does pip know your project needs setuptools
if it has to read setup.py, which contains elements
that require setuptools to read them to understand
what dependencies are needed"
I verified this works on an aarch64 ThunderX2 node
running RHEL with
python -m pip install .successfullybuilding a wheel for MDAnalysis and installing it; many
other pieces of information can be added to this file, though
this
build-systemsection is the most fundamentalnote that this is an oversimplified draft--it should
be safe to use, but we'll probably want to dial back
and pin to an older NumPy instead of using the latest NumPy
we can get that is greater than our minimum; I'd suggest
I/we do that in a follow-up since it will require confirming
which minimum versions of NumPy are needed on which platforms--similar
to this kind of thing:
https://github.com/scipy/scipy/blob/master/pyproject.toml#L23
I also think we should probably be safe to require a much
newer minimum version of Cython in this file really, though
I've replicated our setuptools specification for now
PR Checklist