-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add setuptools_scm for pyproject.toml, setup.cfg and setup.py #185
Conversation
…reated version file, or otherwise gets it dynamically at runtime (if setuptools_scm is available)
…. The current PR now depends on this, as it relies on the eessi/testsuite/__init__.py file to provide a version
Trying with
Trying with a clone, and
Running
Running
Note that all of this is done with a Python 3.9.18. I've tried the same with a |
I'm mainly worried about the tarball that people would get via GitHub, like https://github.com/EESSI/test-suite/archive/v0.3.2.tar.gz (via https://github.com/EESSI/test-suite/releases/tag/v0.3.2). There we'll get Could we still retain a I'm as annoyed as you are that we have the version in multiple places currently, but we can avoid forgetting to update those in CI. With the current approach, there's no way to avoid people hitting the |
Yes, it gets it from the git metadata, so you need to have that available. In fact, a
Will fail with
And, clearly, if you run it directly from the tarball (by setting your paths), you'll get the v 0.0.0. Ok, I'll need to think about. I'm not against checking it in CI, but I also want dynamically created versions for when someone is running from a git checkout, so that we see they are not on a plain release version. |
…//packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-version. We then rely on setuptools_scm _only_ for non-release versions if people are running from a git checkout.
… provide a hardcoded fallback if no scm is available, i.e. no .git folder. That's what we'd need. I'd still want a single place to have that fallback version, ideally in eessi.testsuite.__init__.py. That way, the same fallback version will be used to name the installation directory, but also at runtime if you print from eessi.testsuite import __version__; print(__version__)
So... I'm learning a lot here. There is a config option That would be the cleanest approach. But, I think we can still do it differently. We can use I'll experiment a bit. Maybe I make the Note that even nicer is just setting
In pyproject.toml, but that's only supported from setuptools 61.0.0 according to https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-version . And that requires Python 3.7 or above. |
maybe it's ok to require python >= 3.9 ? CentOS-7 is out of support for some time now, and python-3.9 is available as an RPM in Rocky-8 |
@boegel probably has an opinion here... I mean, it is a fact that we typically run the test suite with system python's. And we don't control all of those (e.g. Vega still has python 3.6). Then again: I also just made new easyConfigs for ReFrame at the toolchain level, in which case we would use the python's from the module env (and thus much newer ones). In that case, it's no problem at all. |
Anyway, I've been fiddling a bit. This
is an option, and as you can see from the commented part, we could even import it from The problem is that I'm running into this issue that if there is a And in Of course, I could unconditionally set Also: using |
Oh, some good news: A solution there would be to let go of the 'single version' principle, and define it in two places: the That means we have the following scenarios:
I'll try this approach: specify the |
…rse that in eessi.testsuite.__init__.py
…ols_scm version in this range...
…ion__'. So import that when importing directly
…rsion imported from eessi.testsuite
…ver between steps
…l against the version used in CI/run_reframe.sh and check against git tags listed
It only took 67 commits to get to a point where this works, and is also properly tested. 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving this as the tests seem to work, although i didn't rigorously check the code.
if something breaks, i count on you to fix it :)
Set up automatic versioning by
setuptools_scm