diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 75771d5..f8545ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,9 +14,9 @@ jobs: uses: actions/setup-python@v3 with: python-version: '3.x' - cache: pip - cache-dependency-path: requirements/dev.txt + - name: Install tox + run: pip install tox - name: Lint - run: make lint + run: tox -e lint - name: Test - run: make test + run: tox diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aaee692..ea93533 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,14 +19,14 @@ jobs: uses: actions/setup-python@v3 with: python-version: '3.x' - cache: pip - cache-dependency-path: .github/workflows/release.yml + - name: Install project + run: pip install .[dev] - name: Lint - run: make lint + run: tox -e lint - name: Test - run: make test + run: tox - name: Install build dependencies - run: pip install -U setuptools wheel build calver + run: pip install -U setuptools wheel build - name: Build run: python -m build . - name: Publish @@ -44,7 +44,8 @@ jobs: cache-dependency-path: .github/workflows/release.yml - name: Version id: version - run: echo "::set-output name=version::$(python setup.py --version 2>/dev/null)" + run: | + echo version=$(python -c "from trove_classifiers import version; print(version.__version__)" 2>/dev/null) >> $GITHUB_OUTPUT - name: Tag uses: actions/create-release@v1 env: diff --git a/.gitignore b/.gitignore index fe11925..ae59162 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,10 @@ build/ dist/ *.egg-info/ +.tox/ +.venv/ +.env/ +env/ +venv/ +.idea/ +.vscode/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 45a0ff5..6ca1081 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ # Contributing -How to contributing to this package. +How to contribute to this package. ## Running tests Run `make test`. This checks whether the auto-generated list of classifiers diff --git a/Makefile b/Makefile deleted file mode 100644 index 81c0d1e..0000000 --- a/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -BINDIR = $(PWD)/.state/env/bin - -.state/env/pyvenv.cfg: requirements/dev.txt - rm -rf .state/env - python -m venv .state/env - - # install/upgrade general requirements - $(BINDIR)/python -m pip install --upgrade pip setuptools wheel - - # install various types of requirements - $(BINDIR)/python -m pip install -r requirements/dev.txt - -test: .state/env/pyvenv.cfg - $(BINDIR)/python -m pip install . - $(BINDIR)/pytest - $(BINDIR)/python -m tests.lib - -lint: .state/env/pyvenv.cfg - $(BINDIR)/black --check bin setup.py src tests - $(BINDIR)/python bin/sort.py src/trove_classifiers/__init__.py - $(BINDIR)/mypy src - -reformat: .state/env/pyvenv.cfg - $(BINDIR)/black tests src - -.PHONY: build test lint reformat diff --git a/pyproject.toml b/pyproject.toml index 05374a2..0dde369 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,45 @@ [build-system] -requires = ["setuptools", "calver"] +requires = ["setuptools >= 61.0"] build-backend = "setuptools.build_meta" +[project] +name = "trove-classifiers" +readme = "README.md" +description = "Canonical source for classifiers on PyPI (pypi.org)." +authors = [{name = "The PyPI Admins", email = "admin@pypi.org"}] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Typing :: Typed", +] +keywords = ["classifiers"] +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/pypa/trove-classifiers" + +[project.optional-dependencies] +dev = [ + "tox >= 4.0" +] + +[tool.setuptools] +package-dir = {"" = "src"} +include-package-data = false + +[tool.setuptools.packages.find] +where = ["src"] +namespaces = false + +[tool.setuptools.package-data] +"*" = ["py.typed"] + +[tool.setuptools.dynamic.version] +attr = "trove_classifiers.version.__version__" + + [tool.mypy] strict = true warn_unreachable = true diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 533f3b6..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -black -jinja2 -natsort -pytest -mypy diff --git a/setup.py b/setup.py deleted file mode 100644 index 826eac7..0000000 --- a/setup.py +++ /dev/null @@ -1,33 +0,0 @@ -from io import open -from os import path - -from setuptools import setup, find_packages - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the README file -with open(path.join(here, "README.md"), encoding="utf-8") as f: - long_description = f.read() - -setup( - name="trove-classifiers", - description="Canonical source for classifiers on PyPI (pypi.org).", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/pypa/trove-classifiers", - author="The PyPI Admins", - author_email="admin@pypi.org", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3", - "Typing :: Typed", - ], - keywords="classifiers", - package_dir={"": "src"}, - packages=find_packages(where="src"), - package_data={"": ["py.typed"]}, - use_calver=True, - setup_requires=["calver"], -) diff --git a/src/trove_classifiers/version.py b/src/trove_classifiers/version.py new file mode 100644 index 0000000..09d1db5 --- /dev/null +++ b/src/trove_classifiers/version.py @@ -0,0 +1 @@ +__version__ = "2022.12.22" diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..57fbe1e --- /dev/null +++ b/tox.ini @@ -0,0 +1,43 @@ +[tox] +envlist = + py311 + py310 + py39 + py38 + py37 + lint + reformat + +isolated_build = true +skip_missing_interpreters = true +minversion = 4.0 + +[testenv] +description = run the tests with pytest under {envname} +passenv = + PYTEST_* +deps = + pytest >= 7.1 +commands = + pytest {posargs} + python -m tests.lib + +[testenv:lint] +description = lint the code base +skip_install = true +deps = + black >= 22.12.0 + mypy >= 0.991 + natsort >= 8.2 +commands = + black --check bin src tests + python bin/sort.py src/trove_classifiers/__init__.py + mypy src + +[testenv:reformat] +description = format the code base +skip_install = true +deps = + black >= 22.12.0 +commands = + black tests src