Skip to content

Commit

Permalink
python: Provide pyproject.toml (#172)
Browse files Browse the repository at this point in the history
* "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)
  • Loading branch information
jenisys authored Oct 6, 2024
1 parent f5dbbbf commit 6e6c5bc
Show file tree
Hide file tree
Showing 14 changed files with 180 additions and 173 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Changed
- [Python] Reuse the action cucumber/action-publish-pypi in release ([#147](https://github.com/cucumber/tag-expressions/pull/147))
- [Python] Provide "pyproject.toml" file that supersedes "setup.py" ([#172](https://github.com/cucumber/tag-expressions/pull/172)
- [Ruby] Fixed up remaining simple cops and began to reduce complexity of code ([#158](https://github.com/cucumber/tag-expressions/pull/158))

## [6.1.0] - 2024-01-10
Expand Down
6 changes: 0 additions & 6 deletions python/.bumpversion.cfg

This file was deleted.

7 changes: 6 additions & 1 deletion python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ __*/
.eggs/
.hypothesis/
.idea/
.pytest_cache
.pytest_cache/
.tox/
.venv*/
.DS_Store
.coverage
.deps
.pdm.toml
.tested

# -- TEMPORARY FILE:
# Provided by setuptools-scm with version-info from git-tag(s).
# Generated by "python -mbuild" when package is generated.
cucumber_tag_expressions/_version.py
15 changes: 11 additions & 4 deletions python/README.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
Cucumber Tag Expressions for Python
===============================================================================

.. image:: https://github.com/cucumber/tag-expressions/actions/workflows/test-python.yml/badge.svg
.. |badge.CI_status| image:: https://github.com/cucumber/tag-expressions/actions/workflows/test-python.yml/badge.svg
:target: https://github.com/cucumber/tag-expressions/actions/workflows/test-python.yml
:alt: CI Build Status

.. image:: https://img.shields.io/pypi/v/cucumber-tag-expressions.svg
.. |badge.latest_version| image:: https://img.shields.io/pypi/v/cucumber-tag-expressions.svg
:target: https://pypi.python.org/pypi/cucumber-tag-expressions
:alt: Latest Version

.. image:: https://img.shields.io/pypi/l/cucumber-tag-expressions.svg
:target: https://pypi.python.org/pypi/cucumber-tag-expressions/
.. |badge.license| image:: https://img.shields.io/pypi/l/cucumber-tag-expressions.svg
:target: https://pypi.python.org/pypi/cucumber-tag-expressions
:alt: License

.. |badge.downloads| image:: https://img.shields.io/pypi/dm/cucumber-tag-expressions.svg
:target: https://pypi.python.org/pypi/cucumber-tag-expressions
:alt: Downloads

.. |logo| image:: https://github.com/cucumber-ltd/brand/raw/master/images/png/notm/cucumber-black/cucumber-black-128.png


|badge.CI_status| |badge.latest_version| |badge.license| |badge.downloads|

Cucumber tag-expressions for Python.

|logo|
Expand Down
2 changes: 0 additions & 2 deletions python/cucumber_tag_expressions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@

from __future__ import absolute_import
from .parser import parse, TagExpressionParser, TagExpressionError

__version__ = "4.1.0"
1 change: 1 addition & 0 deletions python/py.requirements/all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
# ============================================================================

-r basic.txt
-r packaging.txt
-r develop.txt
-r ../tasks/py.requirements.txt
5 changes: 1 addition & 4 deletions python/py.requirements/develop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ pip >= 9.0.1
virtualenv >=15.0.1,<=20.4.4; python_version <= '2.7'
virtualenv >=20.4.5; python_version >= '3.0'

# -- CONFIGURATION MANAGEMENT (helpers):
# FORMER: bumpversion >= 0.4.0
bump2version >= 0.5.6

# -- RELEASE MANAGEMENT: Push package to pypi.
twine >= 1.13.0
-r packaging.txt

# -- DEVELOPMENT SUPPORT:
# -- PYTHON2/3 COMPATIBILITY: pypa/modernize
Expand Down
21 changes: 21 additions & 0 deletions python/py.requirements/packaging.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ============================================================================
# PYTHON PACKAGE REQUIREMENTS: packaging support
# ============================================================================
# DESCRIPTION:
# pip install -r <THIS_FILE>
#
# SEE ALSO:
# * http://www.pip-installer.org/
# ============================================================================

# -- PACKAGING SUPPORT:
build >= 0.5.1
setuptools
setuptools-scm
wheel

# -- DISABLED:
# setuptools >= 64.0.0; python_version >= '3.5'
# setuptools < 45.0.0; python_version < '3.5' # DROP: Python2, Python 3.4 support.
# setuptools_scm >= 8.0.0; python_version >= '3.7'
# setuptools_scm < 8.0.0; python_version < '3.7'
2 changes: 2 additions & 0 deletions python/py.requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# PYTHON PACKAGE REQUIREMENTS FOR: For testing only
# ============================================================================

-r basic.txt

# -- TESTING: Unit tests and behave self-tests.
pytest < 5.0; python_version < '3.0' # pytest >= 4.2
pytest >= 5.0; python_version >= '3.0'
Expand Down
134 changes: 134 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# =============================================================================
# PACKAGING: cucumber-tag-expressions
# =============================================================================
# SEE ALSO:
# * https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
# * https://setuptools-scm.readthedocs.io/en/latest/usage/
# * https://pypi.org/classifiers/
# =============================================================================
# PYTHON3: requires = ["setuptools>=64", "setuptools_scm>=8", "wheel"]

[build-system]
requires = ["setuptools", "setuptools_scm", "wheel"]
build-backend = "setuptools.build_meta"


[project]
name = "cucumber-tag-expressions"
authors = [
{name = "Jens Engel", email = "jenisys@noreply.github.com"},
]
description = "Provides a tag-expression parser and evaluation logic for cucumber/behave"
dynamic = ["version"]
keywords= ["BDD", "testing", "cucumber", "tag-expressions", "behave"]
license = {text = "MIT"}
readme = "README.rst"
requires-python = ">=2.7"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
]
dependencies = [
"enum34; python_version < '3.4'"
]


[project.urls]
Homepage = "https://github.com/cucumber/tag-expressions"
Download = "https://pypi.org/project/cucumber-tag-expressions"
Repository = "https://github.com/cucumber/tag-expressions"
Issues = "https://github.com/cucumber/tag-expressions/issues/"


[project.optional-dependencies]
develop = [
"setuptools",
"setuptools-scm",
"wheel",
"build >= 0.5.1",
"twine >= 1.13.0",
"coverage",
"pytest < 5.0; python_version < '3.0'",
"pytest >= 5.0; python_version >= '3.0'",
"pytest-html >= 1.19.0",
"tox >=4.21,<4.22",
"pylint",
"ruff",

# -- INVOKE SUPPORT:
"invoke >= 1.7.3",
"six >= 1.16.0",
"path >= 13.1.0; python_version >= '3.5'",
"path.py >= 11.5.0; python_version < '3.5'",
# -- PYTHON2 BACKPORTS:
"pathlib; python_version <= '3.4'",
"backports.shutil_which; python_version <= '3.3'",
"pycmd",
]
testing = [
"pytest < 5.0; python_version < '3.0'", # >= 4.2
"pytest >= 5.0; python_version >= '3.0'",
"pytest-html >= 1.19.0",
"PyYAML >= 5.4.1",
"pathlib; python_version <= '3.4'",
]


[tool.distutils.bdist_wheel]
universal = true


# -----------------------------------------------------------------------------
# PACAKING TOOL SPECIFIC PARTS:
# -----------------------------------------------------------------------------
[tool.setuptools]
platforms = ["any"]
zip-safe = true

# -- DISABLED:
# [tool.setuptools.dynamic]
# version = {attr = "cucumber_tag_expressions._version.version"}

[tool.setuptools.packages.find]
where = ["."]
include = ["cucumber_tag_expressions*"]
exclude = ["tests*"]
namespaces = false

# -- SETUPTOOLS-SCM: Generate version info from git-tag(s).
# GIT-TAG MATCHER: Only use git-tags that start with "v", like: "v6.1.0"
[tool.setuptools_scm]
git_describe_command = "git describe --match 'v[0-9]*'"
root = ".."
version_file = "cucumber_tag_expressions/_version.py"


# =============================================================================
# OTHER TOOLS
# =============================================================================
# -----------------------------------------------------------------------------
# PYLINT:
# -----------------------------------------------------------------------------
[tool.pylint.messages_control]
disable = "C0330, C0326"

[tool.pylint.format]
max-line-length = "100"
1 change: 0 additions & 1 deletion python/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ testpaths = tests
python_files = test_*.py
addopts =
--metadata PACKAGE_UNDER_TEST tag-expressions
--metadata PACKAGE_VERSION 4.0.2
--html=build/testing/report.html --self-contained-html
--junit-xml=build/testing/report.xml

Expand Down
26 changes: 0 additions & 26 deletions python/setup.cfg

This file was deleted.

Loading

0 comments on commit 6e6c5bc

Please sign in to comment.