-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
[python] Provide pyproject.toml that supersedes setup.py #172
Conversation
python/pyproject.toml
Outdated
|
||
# -- PREPARED: | ||
[tool.setuptools.dynamic] | ||
version = {attr = "cucumber_tag_expressions.__version__"} |
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.
We are using polyglot-release to prepare a release and update the version numbers for all different languages It currently only recognizes version in pyproject.toml or setup.py. It will not update the __version__
attribute.
Is there a need to also keep it as an attribute in the source code?
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.
In my opinion, yes.
It was probably overlooked in the past that the version was there.
You normally use tools like https://pypi.org/project/bumpversion/ or similar to accomplish this in one step.
Event if the version info is removed from Python package,
the pyproject.toml
and/or setup.py
should/must contain it (for readability). Note that setup.py
will be removed in the future when Python2 compatibility of the package is dropped.
EXAMPLE:
SEE ALSO:
TECHNICAL ALTERNATIVE:
- setuptools-scm uses git meta-data, like
tags
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.
Thanks for explaining the different options.
It wasn't overlooked. Rather it wasn't looked at at all. Releases are made with a script. This is necessary because nobody can remember the intricacies of releasing (currently) 13 different languages.
And after this PR there would be three different ways of doing this just for Python.
So for the sake of the sanity of everyone involved in the release there should be exactly one conventional location for every python project in the Cucumber org to keep its version.
Currently the preferred place is directly in pyproject.toml
.
I am open to better ways of doing this, but then I'd like to see a set of merge requests apply that change to all repositories at once.
So for now could you remove the __version__
attribute? The other changes look like a general improvement so I think it would be okay to keep them.
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 think we should just remove the __version__
attribute from __init__.py
.
The recommended way of getting the version of an installed package is to use importlib.metadata.version(package_name)
: https://docs.python.org/3/library/importlib.metadata.html#distribution-versions
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.
@youtux - Can you maybe move to get this as an agreed consensus with other notable python contributors and then make a set of changes across all python implementations.
For ease (And lack of bugs), if you could make the PR's - but not merge them and tag one of myself or @mpkorstanje or @davidjgoss then we could liaise with yourself and others to get them all merged simultaneously whilst updating our polyglot-release repo, then this would be the smallest amount of friction.
Any help / queries, I'm in discord
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.
please split this across multiple independent PRs, so that they are easier to review and self-contained changes.
python/pyproject.toml
Outdated
"enum34; python_version < '3.4'", | ||
] | ||
keywords= ["BDD", "testing", "tag-expressions", "cucumber", "behave"] | ||
# source-includes = [ |
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.
let's remove commented code right?
python/pyproject.toml
Outdated
# "**/*.rst", | ||
# "**/*.txt", | ||
# ] | ||
requires-python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*" |
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 still support python 2?
python/pyproject.toml
Outdated
# ] | ||
requires-python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*" | ||
# requires-python = ">=3.7" | ||
license = { text = "MIT"} |
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.
this can be just one of the classifiers, no need to be in a license
key anymore
python/pyproject.toml
Outdated
homepage = "https://github.com/cucumber/tag-expressions" | ||
repository = "https://github.com/cucumber/tag-expressions" | ||
download = "https://pypi.org/project/cucumber-tag-expressions" | ||
documentation = "https://cucumber.io/docs/cucumber/api/#tag-expressions" | ||
changelog = "https://github.com/cucumber/tag-expressions/blob/main/CHANGELOG.md" |
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.
keys should be capitalised
python/pyproject.toml
Outdated
download = "https://pypi.org/project/cucumber-tag-expressions" | ||
documentation = "https://cucumber.io/docs/cucumber/api/#tag-expressions" | ||
changelog = "https://github.com/cucumber/tag-expressions/blob/main/CHANGELOG.md" | ||
"Issue Tracker" = "https://github.com/cucumber/tag-expressions/issues/" |
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.
can call this Issues
, that's what the PyPA recommends
python/pyproject.toml
Outdated
|
||
# -- PREPARED: | ||
[tool.setuptools.dynamic] | ||
version = {attr = "cucumber_tag_expressions.__version__"} |
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 think we should just remove the __version__
attribute from __init__.py
.
The recommended way of getting the version of an installed package is to use importlib.metadata.version(package_name)
: https://docs.python.org/3/library/importlib.metadata.html#distribution-versions
python/setup.py
Outdated
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.
can't we delete this one now?
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.
This PR seems to be doing a few things (As mentioned earlier).
I've updated the title but it seems as though this also isn't correct. I think it should say 6.1 instead of 0.6.1
If these things were all acceptable or rudimentary it would seem ok to merge them, but it seems like there are a few contentious things.
Maybe pop in on discord to the #committers-python
channel to discuss some changes with the wider python community?
ec81338
to
45f1ae9
Compare
d0f4aa4
to
d0296bb
Compare
Replace the core changes by:
OTHERWISE:
|
* "pyproject.toml" file supersedes "setup.py" file * Use setuptools-scm to derive version-info from git-tags * Remove outdated version info from "cucumber_tag_expressions/__init__.py", "pytest.ini" * README.rst: Update badges to be displayed in one line on pypi.org. CLEANUP: * REMOVE: setup.py, setup.cfg * REMOVE: .bumversion.cfg (superseded-by: setuptools-scm mechanism)
d0296bb
to
e51d396
Compare
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.
@jenisys could you point out where the version declaration is currently kept? The current release process expects this to exist.
Again, I'm happy to facilitate anything else, but then I'd like to see that applied to all packages consistently. So it would be good to separate that from replacing pyproject.toml with setup.py.
🤔 What's changed?
pyproject.toml
file that supersedessetup.py
filesetuptools-scm
to derive version-info from git-tags (in the future)cucumber_tag_expressions/__init__.py
,pytest.ini
CLEANUP:
setup.py
,setup.cfg
.bumversion.cfg
(superseded-by:setuptools-scm
mechanism)⚡️ What's your motivation?
🏷️ What kind of change is this?
📋 Checklist: