Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 50 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,67 @@ on:
pull_request:

jobs:
checkreqs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
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 .
run: uv sync --extra test --extra 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
run: |
make lint
- name: Metacheckdeps
run: |
make checkdeps

build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- uses: astral-sh/setup-uv@v3
- name: Install
run: uv sync --extra test --extra dev
- name: Build
run: uv 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')
environment: pypi
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ celerybeat-schedule

# Environments
.env
.venv
.venv*
env/
venv/
ENV/
Expand All @@ -105,3 +105,9 @@ venv.bak/

# Visual Studio Code
.vscode/

# Vim swapfiles
*.sw[op]

# Setuptools-scm
_version.py
29 changes: 10 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
PYTHON?=python
SOURCES=checkdeps setup.py

.PHONY: venv
venv:
$(PYTHON) -m venv .venv
source .venv/bin/activate && make setup
@echo 'run `source .venv/bin/activate` to use virtualenv'

# 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:
uv sync --extra dev --extra test

.PHONY: setup
setup:
python -m pip install -Ur requirements-dev.txt
uv sync --extra dev --extra test

.PHONY: test
test:
python -m coverage run -m checkdeps.tests $(TESTOPTS)
python -m coverage report
uv run coverage run -m pytest $(TESTOPTS)
uv run coverage report

.PHONY: format
format:
python -m ufmt format $(SOURCES)
uv run ruff format
uv run ruff check --fix

.PHONY: lint
lint:
python -m ufmt check $(SOURCES)
python -m flake8 $(SOURCES)
python -m checkdeps checkdeps --allow-names checkdeps
mypy --strict checkdeps
uv run ruff check
uv run python -m checkdeps --allow-names checkdeps checkdeps
uv run mypy --strict --install-types --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 @@ -44,9 +44,18 @@ more self-contained.
* Offer to add missing deps
* Better handling of version-dependent deps in an `if` or `try`/`except`

# Version Compat

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

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"
Empty file added checkdeps/py.typed
Empty file.
93 changes: 93 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[build-system]
requires = [
"setuptools >= 77",
"setuptools-scm >= 8",
]
build-backend = "setuptools.build_meta"

[project]
name = "checkdeps"
description = "Ensures your first-order deps are correct"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
authors = [
{ name = "Tim Hatch", email = "tim@timhatch.com" },
]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dynamic = ["version"]
dependencies = []

[project.urls]
Homepage = "https://github.com/python-packaging/checkdeps/"

[project.optional-dependencies]
dev = [
"build >= 1",
"checkdeps == 0.9.0",
"mypy == 1.19.1",
"ruff == 0.15.6",
]
test = [
"coverage >= 7.14",
"pytest >= 8",
]

[project.scripts]
# foo = "foo:bar"

[tool.setuptools]
packages = { find = {} }
include-package-data = true

[tool.setuptools.package-data]
"checkdeps" = ["py.typed"]

[tool.setuptools_scm]
version_file = "checkdeps/_version.py"

[tool.coverage.run]
branch = true
parallel = true
source = ["checkdeps", "tests"]

[tool.coverage.report]
fail_under = 70
precision = 1
show_missing = true
skip_covered = true

[tool.pytest.ini_options]
addopts = "-ra"
testpaths = ["tests"]

[tool.mypy]
ignore_missing_imports = true

[tool.ruff]
line-length = 88
target-version = "py310"

[tool.ruff.lint]
select = [
"E4",
"E7",
"E9",
"F",
"I", # isort
]

[tool.ruff.lint.isort]
order-by-type = false

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"PLR2004", # Magic value used instead of constant (only in tests)
]
Empty file added tests/conftest.py
Empty file.