Skip to content
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

Merged
merged 67 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
87ace82
Add setuptools_scm for pyproject.toml, setup.cfg and setup.py
Sep 21, 2024
8737cfd
Also add an init which sets the version based on the setuptools_scm c…
Sep 21, 2024
950931b
See if we can implement a single-source-version approach as in https:…
Sep 23, 2024
d3917a1
Try the fallback_version config item from setuptools_scm. It seems to…
Sep 23, 2024
60d4145
Fix syntax
Sep 23, 2024
8c9bcf3
First, try if we can single source from setup.py for new enough setup…
Sep 23, 2024
07943e3
Try with single version for fallback_version in pyproject.toml and pa…
Sep 23, 2024
580f664
Strip filename of __init__.py file when trying to construct the pypro…
Sep 23, 2024
00ecf53
Forgot to import os.path
Sep 23, 2024
8e29e77
Also except LookupError
Sep 23, 2024
101c40b
leave the setuptools version up to setup.py, as it depends on the pyt…
Sep 23, 2024
593c633
Go back to the last version that passed CI, which specified setuptool…
Sep 24, 2024
bf82ccc
See if this works. Potentially, we can just go for the lowest setupto…
Sep 24, 2024
503e070
Fix syntax error
Sep 24, 2024
43b370f
Fix typo
Sep 24, 2024
26a5a62
Remove specific version requirement so that this also passes with pyt…
Sep 24, 2024
4797e6b
Print filename correctly in error message
Sep 24, 2024
4b80f96
Specify write_to_template specifically if the oldest version of setup…
Sep 24, 2024
c835884
Use scm_dict in setup
Sep 24, 2024
8eb5e25
Make sure to import the fallback version _first_
Sep 24, 2024
b375565
Add missing equal sign
Sep 24, 2024
c7737db
Restructure and also catch other errors when opening the pyproject.to…
Sep 24, 2024
3519d59
Fix typo
Sep 24, 2024
cd318c9
Don't set fallback version in __init__.py anymore. We should have alw…
Sep 24, 2024
5dc180d
Don't print the __version__ in the exception messages, as there is no…
Sep 24, 2024
4a75e41
Merge branch 'setuptools_scm_versioning' of github.com:casparvl/test-…
Sep 24, 2024
ed1d1bd
Fix flake8 complaints
Sep 24, 2024
7a9d16f
Fix flake8 issues. Print version of EESSI as part of the CI pipeline
Sep 24, 2024
b171330
Fix typo
Sep 24, 2024
fffe669
Make CI workflow more verbose for easier debugging
Sep 24, 2024
3f1a984
Enable setuptools_scm debugging output
Sep 24, 2024
610844c
Actually resolve env var
Sep 24, 2024
433c0ca
Make fetch-depth 0, so that setuptools_scm has the full history
Sep 24, 2024
f4a8065
Check for the presence of the version file
Sep 24, 2024
bac5401
Check for the version file _before_ import the version from __init__
Sep 24, 2024
15706fc
We don't seem to be able to convince setuptools_scm version 4 to use …
Sep 24, 2024
a6afd1a
Fix flake8
Sep 24, 2024
0ad305b
Fixed more flake8
Sep 24, 2024
5bca5bb
Merge branch 'main' into setuptools_scm_versioning
casparvl Sep 27, 2024
ddae92c
Merge branch 'setuptools_scm_versioning' of github.com:casparvl/test-…
Oct 1, 2024
9aca8a4
Added CI workflows to check versioning in various ways
Oct 2, 2024
72a3698
Forgot to add the git+ to git+https
Oct 2, 2024
3aec459
Try to debug why the version file doesn't exist...
Oct 2, 2024
3463a78
Make the check independent from the current directory
Oct 2, 2024
5f32c15
Make check independent from current dir
Oct 2, 2024
2bd40a5
For python 3.6, the version file contains 'version' instead of __vers…
Oct 2, 2024
5e98775
Now really: import version instead of __version__ from versionfile fo…
Oct 2, 2024
2921d6d
Also for git+https installs, check if the version file matches the ve…
Oct 2, 2024
f65374e
fix sytnax for github workflow
Oct 2, 2024
d994927
Print setuptools_scm version
Oct 2, 2024
0199051
Only do version check, nothing else
Oct 2, 2024
2b98d1e
Do not-equal-to comparisons on strings. Versions arent numbers
Oct 2, 2024
603b010
More clear reporting on version differences
Oct 2, 2024
49b2710
Make sure to only print the version, nothing else
Oct 2, 2024
fc438ee
Check why these versions could be different
Oct 2, 2024
2c1c3ae
env vars do not carry over between steps. We'll need to get the versi…
Oct 2, 2024
d10afd3
more output to help debugging
Oct 2, 2024
358041f
Don't checkout, we want to test what happens when we pull a tarball f…
Oct 2, 2024
88451e6
Maybe PWD isn't set?
Oct 2, 2024
1452afa
Print the pythonpath so we can check it
Oct 2, 2024
18a6019
We need to re-get the fallback_version because env vars don't carry o…
Oct 2, 2024
fe8094d
Make sure we get the fallback version before changing directory
Oct 2, 2024
15e92d1
Don't need to store the old dir anymore
Oct 2, 2024
5bea644
Add workflow to check the hardcoded fallback version in pyproject.tom…
Oct 2, 2024
d608383
Change where the pyproject.toml is for the grep
Oct 2, 2024
dd05330
Same for CI/run_reframe.sh
Oct 2, 2024
cbefb7a
Fix the fallback version so that it is the latest tagged version
Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions eessi/testsuite/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# If this is an installed package, setuptools_scm should have written the file _version.py in the current directory
try:
from ._version import __version__
except ImportError:
# Fallback for when the package is not installed, but git cloned. Note that this requires setuptools_scm to be
# available as a runtime dependency
try:
from setuptools_scm import get_version
# Using a relative path for relative_to doesn't work, because it will be relative to the current working
# directory (which could be anywhere)
# __file__ is the location of this init file (a full path), and this gives us a predictable path to the root
# (namely: two levels up)
# Note that if we ever move this __init__ file relative to the root of the git tree, we'll need to adjust this
__version__ = get_version(root='../..', relative_to=__file__)
except ImportError:
__version__ = "0.0.0" # fallback version if setuptools_scm is not available
casparvl marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
[build-system]
requires = ["setuptools"]
# Setuptools_scm<7 to be compatible with Python 3.6
casparvl marked this conversation as resolved.
Show resolved Hide resolved
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "eessi-testsuite"
version = "0.3.2"
description = "Test suite for the EESSI software stack"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python"
]
requires-python = ">=3.6"
dynamic = ["version"]

[project.urls]
"Homepage" = "https://eessi.io/docs/test-suite"
"Bug Tracker" = "https://github.com/EESSI/test-suite/issues"

[tool.setuptools.packages.find]
include = ["eessi*"]

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "node-and-date"
write_to = "eessi/testsuite/_version.py"
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[metadata]
name = eessi-testsuite
version = 0.3.2
description = Test suite for the EESSI software stack
long_description = file: README.md
long_description_content_type = text/markdown
Expand All @@ -21,6 +20,10 @@ namespace_packages = eessi
[options.packages.find]
include = eessi*

[setuptools_scm]
version_scheme = guess-next-dev
local_scheme = node-and-date

[flake8]
max-line-length = 120
# ignore star imports (F403, F405)
Expand Down
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
import setuptools
setuptools.setup()
import sys

python_version = sys.version_info
if python_version < (3, 8):
scm_require = ['packaging<=21.3', 'setuptools_scm<7']
scm_arg_key = "write_to"
else:
scm_require = ['setuptools_scm>=8']
scm_arg_key = "version_file"


setuptools.setup(
use_scm_version={scm_arg_key: 'eessi/testsuite/_version.py'},
setup_requires=scm_require,
)
Loading