Skip to content

Commit

Permalink
Merge branch 'skel'
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch committed Nov 26, 2024
2 parents 743e1a6 + 59eab19 commit d6dc481
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 31 deletions.
49 changes: 43 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ venv.bak/

# Visual Studio Code
.vscode/

# Vim swapfiles
*.sw[op]

# Setuptools-scm
_version.py
23 changes: 17 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -12,7 +21,7 @@ venv:

.PHONY: setup
setup:
python -m pip install -Ue .[dev,test]
$(PIP) install -Ue .[dev,test]

.PHONY: test
test:
Expand All @@ -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:
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions checkdeps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from ._version import __version__
except ImportError: # pragma: no cover
__version__ = "dev"
23 changes: 8 additions & 15 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ author_email = [email protected]

[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
Expand All @@ -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

Expand All @@ -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]
Expand All @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from setuptools import setup

setup(use_scm_version=True)
setup(use_scm_version={"write_to": "checkdeps/_version.py"})

0 comments on commit d6dc481

Please sign in to comment.