diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab1f37f..5d3f462 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,13 +9,16 @@ on: - v* pull_request: +env: + UV_SYSTEM_PYTHON: 1 + jobs: - checkdeps: + test: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] os: [macOS-latest, ubuntu-latest, windows-latest] steps: @@ -25,14 +28,48 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - uses: astral-sh/setup-uv@v3 - name: Install run: | - python -m pip install --upgrade pip - make setup - pip install -U . + uv pip install -e .[test] - name: Test run: make test - name: Lint - run: make lint + run: | + uv pip install -e .[test,dev] + make lint + if: ${{ matrix.python-version != '3.9' && matrix.python-version != '3.8'}} - name: Checkdeps run: make checkdeps + + build: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - uses: astral-sh/setup-uv@v3 + - name: Install + run: uv pip install build + - name: Build + run: python -m build + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: sdist + path: dist + + publish: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v3 + with: + name: sdist + path: dist + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 0a4bafc..d6fda1d 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,9 @@ venv.bak/ # Visual Studio Code .vscode/ + +# Vim swapfiles +*.sw[op] + +# Setuptools-scm +_version.py diff --git a/Makefile b/Makefile index de808a0..6f78990 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,18 @@ PYTHON?=python SOURCES=checkdeps setup.py +UV:=$(shell uv --version) +ifdef UV + VENV:=uv venv + PIP:=uv pip +else + VENV:=python -m venv + PIP:=python -m pip +endif + .PHONY: venv venv: - $(PYTHON) -m venv .venv + $(VENV) .venv source .venv/bin/activate && make setup @echo 'run `source .venv/bin/activate` to use virtualenv' @@ -12,7 +21,7 @@ venv: .PHONY: setup setup: - python -m pip install -Ue .[dev,test] + $(PIP) install -Ue .[dev,test] .PHONY: test test: @@ -21,13 +30,15 @@ test: .PHONY: format format: - python -m ufmt format $(SOURCES) + ruff format + ruff check --fix .PHONY: lint lint: - python -m ufmt check $(SOURCES) - python -m flake8 $(SOURCES) - mypy --strict --install-types --non-interactive -p checkdeps + ruff check $(SOURCES) + python -m checkdeps --allow-names checkdeps,toml checkdeps + $(PIP) install types-toml + mypy --strict --non-interactive checkdeps .PHONY: release release: diff --git a/README.md b/README.md index c6d9253..14a8100 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,18 @@ more self-contained. * Offer to add missing deps * Better handling of version-dependent deps in an `if` or `try`/`except` +# Version Compat + +Usage of this library should work back to 3.8, but development (and mypy +compatibility) only on 3.10-3.12. Linting requires 3.12 for full fidelity. + +# Versioning + +This library follows [meanver](https://meanver.org/) which basically means +[semver](https://semver.org/) along with a promise to rename when the major +version changes. + # License checkdeps is copyright [Tim Hatch](https://timhatch.com/), and licensed under -the MIT license. I am providing code in this repository to you under an open -source license. This is my personal repository; the license you receive to -my code is from me and not from my employer. See the `LICENSE` file for details. +the MIT license. See the `LICENSE` file for details. diff --git a/checkdeps/__init__.py b/checkdeps/__init__.py index e69de29..9976658 100644 --- a/checkdeps/__init__.py +++ b/checkdeps/__init__.py @@ -0,0 +1,4 @@ +try: + from ._version import __version__ +except ImportError: # pragma: no cover + __version__ = "dev" diff --git a/setup.cfg b/setup.cfg index ee76a31..0e26097 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,10 +10,10 @@ author_email = tim@timhatch.com [options] packages = find: +python_requires = >=3.8 setup_requires = setuptools_scm >= 8 setuptools >= 65 -python_requires = >=3.10 include_package_data = true install_requires = click>=7.0 @@ -24,15 +24,11 @@ install_requires = [options.extras_require] dev = - black == 23.12.1 - # checkdeps == 0.0.2 - flake8 == 7.0.0 - mypy == 1.8.0 - tox == 4.12.1 - twine == 4.0.2 - ufmt == 2.3.0 - usort == 1.0.7 - wheel == 0.42.0 + ruff == 0.8.0 + checkdeps == 0.9.0 + mypy == 1.13.0 + tox == 4.23.2 + test = coverage >= 6 @@ -59,7 +55,7 @@ skip_covered = True ignore_missing_imports = True [tox:tox] -envlist = py{310,311,312}, coverage +envlist = py{38,39,310,311,312,313}, coverage [testenv] deps = .[test] @@ -77,8 +73,5 @@ commands = coverage combine coverage report depends = - py{310,311,312} + py{38,39,310,311,312,313} -[flake8] -ignore = E203, E231, E266, E302, E501, W503 -max-line-length = 88 diff --git a/setup.py b/setup.py index d5d43d7..e9f8f46 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,3 @@ from setuptools import setup -setup(use_scm_version=True) +setup(use_scm_version={"write_to": "checkdeps/_version.py"})