Skip to content
Merged
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
119 changes: 0 additions & 119 deletions check_init_and_setup_coincide.py

This file was deleted.

25 changes: 25 additions & 0 deletions check_version_consistent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Check that the version in ``pyproject.toml`` and ``__init__.py`` coincide."""

import importlib.metadata
import sys

import abnf_to_regexp


def main() -> None:
"""Execute the main routine."""
init_version = abnf_to_regexp.__version__

pyproject_toml_version = importlib.metadata.version("abnf-to-regexp")

if init_version != pyproject_toml_version:
print(
f"The version in {abnf_to_regexp.__file__} is: {init_version!r}, "
f"but the version in pyproject.toml is: {pyproject_toml_version!r}",
file=sys.stderr,
)
sys.exit(1)


if __name__ == "__main__":
main()
19 changes: 11 additions & 8 deletions precommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Step(enum.Enum):
PYLINT = "pylint"
TEST = "test"
DOCTEST = "doctest"
CHECK_INIT_AND_SETUP_COINCIDE = "check-init-and-setup-coincide"
CHECK_VERSION_CONSISTENT = "check-version-consistent"
CHECK_HELP_IN_README = "check-help-in-readme"


Expand Down Expand Up @@ -72,8 +72,7 @@ def main() -> int:
black_targets = [
"abnf_to_regexp",
"precommit.py",
"setup.py",
"check_init_and_setup_coincide.py",
"check_version_consistent.py",
"check_help_in_readme.py",
"dev_scripts"
]
Expand Down Expand Up @@ -160,14 +159,18 @@ def main() -> int:
print("Skipped doctesting.")

if (
Step.CHECK_INIT_AND_SETUP_COINCIDE in selects
and Step.CHECK_INIT_AND_SETUP_COINCIDE not in skips
Step.CHECK_VERSION_CONSISTENT in selects
and Step.CHECK_VERSION_CONSISTENT not in skips
):
print("Checking that abnf_to_regexp/__init__.py and setup.py coincide...")
subprocess.check_call([sys.executable, "check_init_and_setup_coincide.py"])
print(
"Checking that the version is consistent between "
"abnf_to_regexp/__init__.py and pyproject.toml ..."
)
subprocess.check_call([sys.executable, "check_version_consistent.py"])
else:
print(
"Skipped checking that abnf_to_regexp/__init__.py and " "setup.py coincide."
"Skipped checking that the versions in abnf_to_regexp/__init__.py "
"and pyproject.toml coincide."
)

if Step.CHECK_HELP_IN_README in selects and Step.CHECK_HELP_IN_README not in skips:
Expand Down
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "abnf-to-regexp"
version = "1.1.3"
description = "Convert ABNF grammars to Python regular expressions."
readme = "README.rst"
license = {text = "MIT"}
authors = [
{name = "Marko Ristin", email = "marko@ristin.ch"}
]
keywords = ["abnf", "backus-naur", "convert", "regular", "expressions"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.9"
dependencies = [
"icontract>=2.5.1,<3",
"regex==2021.4.4",
"abnf>=2.0,<2.3.0",
"sortedcontainers>=2,<3",
]

[project.optional-dependencies]
dev = [
"black==24.3.0",
"mypy==1.18.2",
"pylint==3.3.9; python_version>='3.9' and python_version<'3.12'",
"pylint==4.0.2; python_version>='3.12'",
"pydocstyle>=2.1.1,<3",
"coverage>=7,<8",
"docutils>=0.14,<1",
"pygments>=2,<3",
]

[project.scripts]
abnf-to-regexp = "abnf_to_regexp.main:main"

[project.urls]
Homepage = "https://github.com/aas-core-works/abnf-to-regexp"

[tool.setuptools]
packages = ["abnf_to_regexp"]

[tool.setuptools.package-data]
abnf_to_regexp = ["py.typed"]

[tool.setuptools.exclude-package-data]
"*" = ["tests*"]
62 changes: 0 additions & 62 deletions setup.py

This file was deleted.