-
Notifications
You must be signed in to change notification settings - Fork 6
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
Migrate to pyproject.toml, remove setup.cfg, pyscaffold #53
Merged
andmat900
merged 8 commits into
eiffel-community:main
from
andmat900:20240430_pyproject_toml
Oct 10, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
820db13
Migrate to pyproject.toml, remove setup.cfg, pyscaffold
andmat900 5a896f4
pylint error code fixed
andmat900 4b20489
pylint error code fixed
andmat900 5d3ca21
setup.py fix for tox
andmat900 8a99801
setuptools_scm root dir option
andmat900 f7fac32
root dir option removed
andmat900 e842f12
black fix
andmat900 67f2a79
black fix
andmat900 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[build-system] | ||
requires = ["setuptools>=72", "wheel", "setuptools_scm[toml]>=8"] | ||
|
||
[project] | ||
name = "etos_test_runner" | ||
dynamic = ["version"] | ||
description = "ETOS Test Runner" | ||
authors = [{name = "Tobias Persson", email = "[email protected]"}] | ||
license = { text = "Apache License, Version 2.0" } | ||
readme = "README.rst" | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: Apache Software License" | ||
] | ||
dependencies = [ | ||
"etos_lib==4.3.6", | ||
"cryptography>=42.0.4,<43.0.0", | ||
"packageurl-python==0.9.1", | ||
"jsontas==1.3.0", | ||
] | ||
|
||
[options] | ||
zip_safe = false | ||
include_package_data = true | ||
python_requires = ">=3.4" | ||
|
||
[options.packages.find] | ||
where = "src" | ||
exclude = ["tests"] | ||
|
||
[project.urls] | ||
Documentation = "https://etos.readthedocs.io/" | ||
Homepage = "https://github.com/eiffel-community/etos-test-runner" | ||
Repository = "https://github.com/eiffel-community/etos-test-runner" | ||
|
||
[project.scripts] | ||
|
||
[project.optional-dependencies] | ||
testing = ["pytest", "pytest-cov"] | ||
|
||
[test] | ||
extras = true | ||
|
||
[tool.build_sphinx] | ||
source_dir = "docs" | ||
build_dir = "build/sphinx" | ||
|
||
[tool.devpi.upload] | ||
no-vcs = 1 | ||
formats = "bdist_wheel" | ||
|
||
[tool.flake8] | ||
exclude = [".tox", "build", "dist", ".eggs", "docs/conf.py"] | ||
|
||
[tool.pytest.ini_options] | ||
addopts = "--cov etos_test_runner --cov-report term-missing --verbose" | ||
norecursedirs = ["dist", "build", ".tox"] | ||
testpaths = ["tests"] | ||
|
||
[tool.setuptools.package-data] | ||
"*" = ["*.sh"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Setup file for etos_test_runner. | ||
"""Setup file for etos-test-runner.""" | ||
from setuptools import setup | ||
from setuptools_scm.version import get_local_dirty_tag | ||
|
||
Use setup.cfg to configure your project. | ||
|
||
This file was generated with PyScaffold 3.2.3. | ||
PyScaffold helps you to put up the scaffold of your new Python project. | ||
Learn more under: https://pyscaffold.org/ | ||
""" | ||
import sys | ||
def version_scheme(version) -> str: | ||
"""Get version component for the current commit. | ||
|
||
from pkg_resources import VersionConflict, require | ||
from setuptools import setup | ||
Used by setuptools_scm. | ||
""" | ||
if version.tag and version.distance == 0: | ||
# If the current commit has a tag, use the tag as version, regardless of branch. | ||
# Note: Github CI creates releases from detached HEAD, not from a particular branch. | ||
return f"{version.tag}" | ||
elif version.branch == "main" and version.tag and version.distance > 0: | ||
# For untagged commits on the release branch always add a distance like ".post3" | ||
return f"{version.tag}.post{version.distance}" | ||
else: | ||
# For non-release branches, mark the version as dev and distance: | ||
return f"{version.tag}.dev{version.distance}" | ||
|
||
|
||
def local_scheme(version) -> str: | ||
"""Get local version component for the current Git commit. | ||
|
||
Used by setuptools_scm. | ||
""" | ||
# If current version is dirty, always add dirty suffix, regardless of branch. | ||
dirty_tag = get_local_dirty_tag(version) if version.dirty else "" | ||
if dirty_tag: | ||
return f"{dirty_tag}.{version.node}" | ||
|
||
try: | ||
require("setuptools>=38.3") | ||
except VersionConflict: | ||
print("Error: version of setuptools is too old (<38.3)!") | ||
sys.exit(1) | ||
if version.distance == 0: | ||
# If the current commit has a tag, do not add a local component, regardless of branch. | ||
return "" | ||
# For all other cases, always add the git reference (like "g7839952") | ||
return f"+{version.node}" | ||
|
||
|
||
if __name__ == "__main__": | ||
setup(use_pyscaffold=True) | ||
setup(use_scm_version={"local_scheme": local_scheme, "version_scheme": version_scheme}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we want to put all the "blame" on @t-persson ? ;)
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.
It's kind of unclear what this field describes/conveys?
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.
I guess this parameter must be present here with some value. Maintaining the list of all authors would be difficult in each repo's
pyproject.toml
. Sometimes there's also an author list in the documentation.If necessary, it probably would be better to generate this list from the Git history.