Repository navigation
Move project metadata and configuration to 'pyproject.toml' - #1311
Conversation
| @@ -16,47 +12,5 @@ | |||
| ) | |||
There was a problem hiding this comment.
I think we need to figure out how to get rid of setup.py entirely. Maybe we could use the README.rst instead for the long description.
There was a problem hiding this comment.
That's generally the goal, especially the most PyPI project pages don't include the changelog. The README is the traditional long description, but perhaps you could first consolidate docs/introduction.rst and the README into one file (and have the docs build pull in the README).
Again, it's not too important to remove setup.py for sdist metadata generation, as it will be indefinitely supported and is perfectly fine for non-programmatic metadata such as long-description
There was a problem hiding this comment.
perhaps you could first consolidate
docs/introduction.rstand the README into one file (and have the docs build pull in the README).
This sounds good to me.
| [tool.setuptools.dynamic] | ||
| version = { attr = "dateparser.__version__" } |
There was a problem hiding this comment.
We use bumpversion. So it probably makes sense to hard-code the version instead of making it dynamic, bumpversion will take care of updating it in both places. In fact, I think it can update it in pyproject.toml without specific configuration for it, and it may be possible to remove the current_version definition under [tool.bumpversion] once the project version is defined through standard pyproject.toml syntax.
There was a problem hiding this comment.
I have no familiarity with bumpversion, and its docs (and its fork's docs) don't mention pyproject.toml. This pull request currently keeps the current release process unchanged, but I'm open to suggestions.
There was a problem hiding this comment.
https://callowayproject.github.io/bump-my-version/reference/configuration/global/#current_version
β‘ If pyproject.toml exists, then current_version falls back to project.version in pyproject.toml. This only works if project.version is statically set.
There was a problem hiding this comment.
Right, so you use Bump My Version, not bumpversion. Either way, do you want to store the current version in project.version in pyproject.toml, or in dateparser.__version__? The second way isn't actually dynamic, it's simply not statically defined in pyproject.toml.
There was a problem hiding this comment.
I believe we should do both.
We keep it in dateparser.__version__ for backward-compatibility, for projects that check that at run-time.
But for packaging, instead of having pyproject.toml fetch that constant, we define the version in pyproject.toml itself as project.version, and not in the bumpversion/bump-my-version variable, and uvx bump-my-version bump major|minor|patch will update both values when run.
- Resolve conflicts: keep slimmed setup.py (long_description only) - Drop fasttext extra (removed upstream in scrapinghub#1315) - Define version statically as project.version (1.4.0), keep dateparser.__version__ for runtime - Remove dynamic version attr; configure bump-my-version to update pyproject.toml and dateparser/__init__.py
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1311 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 235 235
Lines 2915 2915
=======================================
Hits 2831 2831
Misses 84 84 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Migrates package metadata and build configuration from setup.py into pyproject.toml (PEP 517/518/621 style), keeping a minimal setup.py only for the custom long description assembly.
Changes:
- Move core project metadata (name/version/requirements/entry points/classifiers) into
pyproject.toml. - Simplify
setup.pyto only compute and passlong_description. - Update bumpversion configuration to also edit
pyproject.toml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| setup.py | Removes imperative metadata/config; leaves only long_description construction + setup() call. |
| pyproject.toml | Adds PEP 517 build-system config and PEP 621 project metadata; adjusts setuptools package discovery and bumpversion file targeting. |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [[tool.bumpversion.files]] | ||
| filename = "pyproject.toml" | ||
| search = 'version = "{current_version}"' | ||
| replace = 'version = "{new_version}"' |
There was a problem hiding this comment.
Hmm⦠I may be wrong here.
Makes most metadata and build configuration declarative
Also:
License :: OSI Approved :: BSD Licenseclassifier (license classifiers are deprecated)setuptoolsexplicitly as a build requirement using PEP 518 (and as the backend using PEP 517)I kept your custom
long_description(pyproject.toml:readme) construction: there's no harm in it. Setuptools also has native functionality to read the version from a Python module attribute.