Skip to content

Move project metadata and configuration to 'pyproject.toml' - #1311

Merged
AdrianAtZyte merged 4 commits into
scrapinghub:masterfrom
EpicWink:pyproject-toml-config
Jun 4, 2026
Merged

AdrianAtZyte merged 4 commits into
scrapinghub:masterfrom
EpicWink:pyproject-toml-config

Conversation

@EpicWink

@EpicWink EpicWink commented Feb 9, 2026 •

Copy link
Copy Markdown
Contributor

Makes most metadata and build configuration declarative

Also:

  • Drop License :: OSI Approved :: BSD License classifier (license classifiers are deprecated)
  • Specify license using SPDX identifier
  • Specify setuptools explicitly as a build requirement using PEP 518 (and as the backend using PEP 517)
  • Fix keywords declaration (from string to list)

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.

Comment thread setup.py Outdated
Comment on lines 5 to 12
@@ -16,47 +12,5 @@
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps you could first consolidate docs/introduction.rst and the README into one file (and have the docs build pull in the README).

This sounds good to me.

Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Outdated
Comment on lines +57 to +58
[tool.setuptools.dynamic]
version = { attr = "dateparser.__version__" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@serhii73
serhii73 self-requested a review June 1, 2026 06:31
- 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

codecov Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 97.11%. Comparing base (24bfa9e) to head (36634e1).

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.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@serhii73
serhii73 requested a review from Copilot June 1, 2026 07:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to only compute and pass long_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.

Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
Comment thread pyproject.toml
Comment on lines +61 to +64
[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm… I may be wrong here.

@AdrianAtZyte
AdrianAtZyte merged commit 5c437a1 into scrapinghub:master Jun 4, 2026
15 checks passed
@EpicWink
EpicWink deleted the pyproject-toml-config branch June 9, 2026 09:16
@serhii73 serhii73 mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants