diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 116a86c..6716586 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: 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] exclude: - python-version: "3.7" @@ -31,17 +31,21 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - uses: astral-sh/setup-uv@v3 - name: Install run: | uv pip install -e .[test] + 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: | uv pip install -e .[test,dev] make lint - if: ${{ matrix.python-version != '3.9' && matrix.python-version != '3.8' && matrix.python-version != '3.7' }} build: needs: test @@ -50,14 +54,14 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.14" - 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 + uses: actions/upload-artifact@v4 with: name: sdist path: dist @@ -69,7 +73,7 @@ jobs: permissions: id-token: write steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: sdist path: dist 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 86249fe..f340aa3 100644 --- a/README.md +++ b/README.md @@ -81,12 +81,16 @@ sets concurrent.futures to INFO # 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 e906776..d1447e3 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 = 90 @@ -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/tests/core.py b/tests/test_core.py similarity index 100% rename from vmodule/tests/core.py rename to tests/test_core.py diff --git a/vmodule/__init__.py b/vmodule/__init__.py index bc80b89..766ba5f 100644 --- a/vmodule/__init__.py +++ b/vmodule/__init__.py @@ -1,6 +1,6 @@ try: - from .version import __version__ -except ImportError: + from ._version import __version__ +except ImportError: # pragma: no cover __version__ = "dev" import logging diff --git a/vmodule/tests/__init__.py b/vmodule/tests/__init__.py deleted file mode 100644 index 536c4c8..0000000 --- a/vmodule/tests/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .core import CoreTest - -__all__ = [ - "CoreTest", -] diff --git a/vmodule/tests/__main__.py b/vmodule/tests/__main__.py deleted file mode 100644 index 428e144..0000000 --- a/vmodule/tests/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -import unittest - -if __name__ == "__main__": - unittest.main(module="vmodule.tests", verbosity=2)