From 4c53f88cca5b2477fd9dbd0eb0c07a6a2b77df5c Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Wed, 18 Mar 2026 10:00:55 -0700 Subject: [PATCH] Update skel 2026-03-18 rev: adae100 --- .github/workflows/build.yml | 69 ++++++++++++++++++++++--------------- .gitignore | 6 ++++ Makefile | 42 +++++++++++----------- README.md | 14 +++++--- setup.cfg | 31 ++++++----------- setup.py | 2 +- tests/conftest.py | 0 vmodule/__init__.py | 4 +-- 8 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 tests/conftest.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cea658d..f236aeb 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: - vmodule-just-tests: + test: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] os: [macOS-latest, ubuntu-latest, windows-latest] steps: @@ -26,37 +29,47 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true + - 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,dev] - name: Test - run: make test + run: | + git config --global user.name "Unit Test" + git config --global user.email "example@example.com" + make test - name: Lint - run: make lint - - vmodule: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.11", "3.12"] - os: [macOS-latest, ubuntu-latest, windows-latest] + run: | + make lint + build: + needs: test + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set Up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.14" + - uses: astral-sh/setup-uv@v3 - name: Install - run: | - python -m pip install --upgrade pip - make setup - pip install -U . - - name: Test - run: make test - - name: Lint - run: make lint + run: uv pip install build + - name: Build + run: python -m build + - name: Upload + uses: actions/upload-artifact@v4 + 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@v4 + 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 17fa566..9e18c3b 100644 --- a/Makefile +++ b/Makefile @@ -1,37 +1,37 @@ -PYTHON?=python -SOURCES=vmodule setup.py +ifeq ($(OS),Windows_NT) + ACTIVATE:=.venv/Scripts/activate +else + ACTIVATE:=.venv/bin/activate +endif -.PHONY: venv -venv: - $(PYTHON) -m venv .venv - source .venv/bin/activate && make setup - @echo 'run `source .venv/bin/activate` to use virtualenv' +UV:=$(shell uv --version) +ifdef UV + VENV:=uv venv + PIP:=uv pip +else + VENV:=python -m venv + PIP:=python -m pip +endif -# The rest of these are intended to be run within the venv, where python points -# to whatever was used to set up the venv. +.venv: + $(VENV) .venv .PHONY: setup -setup: - python -m pip install -Ue .[dev,test] +setup: .venv + source $(ACTIVATE) && $(PIP) install -Ue .[dev,test] .PHONY: test test: - python -m coverage run -m vmodule.tests $(TESTOPTS) + python -m coverage run -m pytest $(TESTOPTS) python -m coverage report .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) + ruff check python -m checkdeps --allow-names vmodule vmodule mypy --strict --install-types --non-interactive vmodule - -.PHONY: release -release: - rm -rf dist - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/README.md b/README.md index 8ad3dbf..14441c1 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,16 @@ # Version Compat -Usage of this library should work back to 3.7, but development (and mypy -compatibility) only on 3.10-3.12. Linting requires 3.12 for full fidelity. +This library is compatile with Python 3.10+, but should be linted under the +newest stable version. + +# 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 vmodule 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/setup.cfg b/setup.cfg index fb624d9..42a6389 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,27 +10,23 @@ author_email = tim@timhatch.com [options] packages = find: -python_requires = >=3.7 +python_requires = >=3.10 setup_requires = - setuptools_scm < 8; python_version<'3.8' - setuptools_scm >= 8; python_version>='3.8' + setuptools_scm >= 8 setuptools >= 65 include_package_data = true install_requires = [options.extras_require] dev = - black == 23.12.1 checkdeps == 0.9.0 - 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 + mypy == 1.19.1 + ruff == 0.15.6 + tox == 4.50.0 + tox-uv == 1.33.4 test = coverage >= 6 + pytest >= 8 [options.entry_points] # console_scripts = @@ -42,8 +38,7 @@ strict = true [coverage:run] branch = True -include = vmodule/* -omit = vmodule/tests/* +source = vmodule,tests [coverage:report] fail_under = 70 @@ -55,13 +50,12 @@ skip_covered = True ignore_missing_imports = True [tox:tox] -envlist = py{37,38,39,310,311,312}, coverage +envlist = py{310,311,312,313,314}, coverage [testenv] deps = .[test] -allowlist_externals = make commands = - make test + coverage run -m pytest setenv = COVERAGE_FILE={toxworkdir}/.coverage.{envname} @@ -73,8 +67,5 @@ commands = coverage combine coverage report depends = - py{37,38,39,310,311,312} + py{10,311,312,313,314} -[flake8] -ignore = E203, E231, E266, E302, E501, W503 -max-line-length = 88 diff --git a/setup.py b/setup.py index d5d43d7..dbbcbf6 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": "vmodule/_version.py"}) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e69de29 diff --git a/vmodule/__init__.py b/vmodule/__init__.py index da9f1c2..9976658 100644 --- a/vmodule/__init__.py +++ b/vmodule/__init__.py @@ -1,4 +1,4 @@ try: - from .version import __version__ -except ImportError: + from ._version import __version__ +except ImportError: # pragma: no cover __version__ = "dev"