Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
59 changes: 59 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >= 77.0",
]

[project]
name = "dateparser"
description = "Date parsing library designed to parse dates from HTML pages"
authors = [
{ name = "Scrapinghub", email = "opensource@zyte.com" },
]
license = "BSD-3-Clause"
keywords = ["dateparser"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
]
requires-python = ">=3.10"
dynamic = ["readme", "version"]

dependencies = [
"python-dateutil>=2.7.0",
"pytz>=2024.2",
"regex>=2024.9.11",
"tzlocal>=0.2",
]

[project.optional-dependencies]
calendars = ["convertdate>=2.2.1", "hijridate"]
fasttext = ["fasttext>=0.9.1", "numpy>=1.22.0,<2"]
langdetect = ["langdetect>=1.0.0"]

[project.urls]
Source = "https://github.com/scrapinghub/dateparser"
History = "https://dateparser.readthedocs.io/en/latest/history.html"

[project.scripts]
dateparser-download = "dateparser_cli.cli:entrance"

[tool.setuptools]
include-package-data = true
zip-safe = false

[tool.setuptools.packages.find]
namespaces = false
exclude = ["tests", "tests.*"]

[tool.setuptools.dynamic]
version = { attr = "dateparser.__version__" }
Comment on lines +57 to +58
Copy link
Member

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
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
Member

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
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
Member

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.


[tool.bumpversion]
current_version = "1.3.0"
commit = true
Expand Down
48 changes: 1 addition & 47 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import re

from setuptools import find_packages, setup

__version__ = re.search(
r"__version__.*\s*=\s*[\"]([^\"]+)[\"]", open("dateparser/__init__.py").read()
).group(1)
from setuptools import setup

introduction = re.sub(
r":members:.+|..\sautomodule::.+|:class:|:func:|:ref:",
Expand All @@ -16,47 +12,5 @@
)

setup(
name="dateparser",
version=__version__,
description="Date parsing library designed to parse dates from HTML pages",
long_description=introduction + "\n\n" + history,
author="Scrapinghub",
author_email="opensource@zyte.com",
url="https://github.com/scrapinghub/dateparser",
project_urls={
"History": "https://dateparser.readthedocs.io/en/latest/history.html",
},
packages=find_packages(exclude=("tests", "tests.*")),
include_package_data=True,
install_requires=[
"python-dateutil>=2.7.0",
"pytz>=2024.2",
"regex>=2024.9.11",
"tzlocal>=0.2",
],
entry_points={
"console_scripts": ["dateparser-download = dateparser_cli.cli:entrance"],
},
extras_require={
"calendars": ["convertdate>=2.2.1", "hijridate"],
"fasttext": ["fasttext>=0.9.1", "numpy>=1.22.0,<2"],
"langdetect": ["langdetect>=1.0.0"],
},
license="BSD",
zip_safe=False,
keywords="dateparser",
python_requires=">=3.10",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
],
)