diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 3146382f..d0a150ec 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -22,7 +22,16 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install build - - name: + - name: Rewrite relative README links to absolute for PyPI + run: | + python -c " + import re, pathlib + tag = '${{ github.event.release.tag_name }}' + base = 'https://github.com/bmw-software-engineering/trlc/tree/' + tag + '/' + readme = pathlib.Path('README.md') + readme.write_text(re.sub(r'\]\(\.\/', '](' + base, readme.read_text())) + " + - name: Build package run: | make package - name: Archive wheel files diff --git a/pylint3.cfg b/.pylintrc similarity index 100% rename from pylint3.cfg rename to .pylintrc diff --git a/Makefile b/Makefile index 78f79416..7af6cd33 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: docs test style lint package lint: style - @python3 -m pylint --rcfile=pylint3.cfg \ + @python3 -m pylint --rcfile=.pylintrc \ --reports=no \ trlc trlc*.py lobster-*.py diff --git a/pyproject.toml b/pyproject.toml index 4c508e50..5536dbae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,48 @@ +[build-system] +requires = ["setuptools", "setuptools-scm", "wheel", "toml"] +build-backend = "setuptools.build_meta" + +[project] +name = "trlc" +version = "3.0.1dev" +description = "Treat Requirements Like Code" +readme = "README.md" +requires-python = ">=3.8, <3.15" +authors = [ + { name = "Bayerische Motoren Werke Aktiengesellschaft (BMW AG)", email = "philipp.wullstein-kammler@bmw.de" } +] +license = "GPL-3.0" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Topic :: Documentation", + "Topic :: Software Development" +] + +dependencies = [ + "pyvcg==1.0.9", + "cvc5>=1.3.2", + "bigtree" +] + +[project.optional-dependencies] +dev = [ + "pycodestyle>=2.12", + "coverage>=7.2", + "sphinx>=7.0", + "build>=1.2.0", + "pylint<4.0" +] + +[project.urls] +documentation = "https://github.com/bmw-software-engineering/trlc#documentation" +repository = "https://github.com/bmw-software-engineering/trlc" +tracker = "https://github.com/bmw-software-engineering/trlc/issues" + +[project.scripts] +trlc = "trlc:trlc.main" + [tool.ty.rules] # ty is Astral's Python type checker (fast, Rust-based) # Add per-rule overrides here as needed, e.g.: @@ -50,3 +95,9 @@ good-names = ["i", "j", "k", "c", "f", "fd", "zf", "n", "ap", "rv", "mh", "sm", [tool.pylint.format] max-line-length = 88 + +[tool.setuptools] +packages = ["trlc"] + +[tool.setuptools.package-data] +trlc = ["pyproject.toml"] diff --git a/setup.py b/setup.py deleted file mode 100644 index e43a9176..00000000 --- a/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 - -import re -import sys -import setuptools - -from trlc import version - -with open("README.md", "r") as fd: - long_description = fd.read() - -# For the readme to look right on PyPI we need to translate any -# relative links to absolute links to github. -fixes = [] -for match in re.finditer(r"\[(.*)\]\((.*)\)", long_description): - if not match.group(2).startswith("http"): - fixes.append((match.span(0)[0], match.span(0)[1], - "[%s](%s/blob/main/%s)" % (match.group(1), - version.GITHUB_PROJECT, - match.group(2)))) - -for begin, end, text in reversed(fixes): - long_description = (long_description[:begin] + - text + - long_description[end:]) - -project_urls = { - "Bug Tracker" : version.BUGS_URL, - "Documentation" : version.DOCS_URL, - "Source Code" : version.CODE_URL, -} - -setuptools.setup( - name="trlc", - version=version.TRLC_VERSION, - author="Bayerische Motoren Werke Aktiengesellschaft (BMW AG)", - author_email="philipp.wullstein-kammler@bmw.de", - description="Treat Requirements Like Code", - long_description=long_description, - long_description_content_type="text/markdown", - url=project_urls["Source Code"], - project_urls=project_urls, - license="GNU General Public License v3", - packages=setuptools.find_packages(), - install_requires="PyVCG[api]==1.0.8", - python_requires=">=3.8, <3.15", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", - "Topic :: Documentation", - "Topic :: Software Development", - ], - entry_points={ - "console_scripts": ["trlc = trlc.trlc:main"], - }, -)