Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
78 changes: 43 additions & 35 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,84 @@ name: tests
push:
pull_request:

env:
UV_PYTHON_DOWNLOADS: never
UV_LOCKED: "true"

jobs:

misc:
name: "Linting configs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Checkout"
uses: actions/checkout@v7
with:
fetch-depth: 12

- uses: docker://docker.io/tamasfe/taplo:latest
name: "Lint TOMLs"
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Check uv.lock"
run: uv lock --check
- name: "Lint TOMLs"
uses: docker://docker.io/tamasfe/taplo:0.10.0
with:
args: fmt --check --diff

- uses: actions/setup-python@v5
- name: "Install tox"
run: |
pip install tox
- name: "Lint YAMLs"
run: |
tox -e lint-yaml
run: uv run tox -e lint-yaml

lint:
name: "Linting"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: "Checkout"
uses: actions/checkout@v7
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: "Install tox"
run: |
pip install tox
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Lint formatting"
run: |
tox -e lint-py
run: uv run tox -e lint-py
# - name: "Type checking" TODO(trin94): revisit linter config and re-enable
# run: |
# tox -e lint-mypy
# run: uv run tox -e lint-mypy

types:
name: "Type checking (public API)"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: "Checkout"
uses: actions/checkout@v7
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: "Install tox"
run: |
pip install tox
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Type checking (public API)"
run: |
tox -e lint-types
run: uv run tox -e lint-types

tests:
name: "Run unit tests"
runs-on: ubuntu-24.04
strategy:
fail-fast: true
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: "Checkout"
uses: actions/checkout@v7
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: "Installing tox"
run: pip install tox
- name: "Executing unit tests"
run: |
tox run -e ${{ matrix.python-version }}
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Run tests"
run: >-
uv run tox -e ${{ matrix.python-version }}
--skip-missing-interpreters false
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pip-delete-this-directory.txt
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
Expand All @@ -63,6 +62,10 @@ docs/_build/
# pyenv virtualenv
.python-version

# uv
.venv/
.uv-cache/

# Generated files
_version.py
_version.pyi
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# python-inject [![Build Status](https://travis-ci.org/ivankorobkov/python-inject.svg?branch=master)](https://travis-ci.org/ivankorobkov/python-inject)
# python-inject [![Build Status](https://github.com/ivankorobkov/python-inject/actions/workflows/tests.yaml/badge.svg?branch=master)](https://github.com/ivankorobkov/python-inject/actions/workflows/tests.yaml)
Dependency injection the python way, the good way.

## Key features
Expand Down Expand Up @@ -319,6 +319,9 @@ def foo(user):
## License
Apache License 2.0

## Development
We use [uv](https://docs.astral.sh/uv/getting-started/installation/) and `make` for development. Install both, then run `make init` to get started.

## Contributors
* Ivan Korobkov [@ivankorobkov](https://github.com/ivankorobkov)
* Jaime Wyant [@jaimewyant](https://github.com/jaimewyant)
Expand Down
26 changes: 10 additions & 16 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,24 @@ SHELL := bash
MAKEFLAGS += --no-builtin-rules \
--warn-undefined-variables

.PHONY: dist pytest test
.PHONY: init dist upload clean pytest

dist:
if ! python3 -m pip freeze | grep -q build; then python3 -m pip install --upgrade build; fi
python3 -m build --outdir=dist --sdist --wheel ./
init:
uv sync

install_dev:
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade --editable=./
dist:
uv build

upload:
if ! python3 -m pip freeze | grep -q twine; then python3 -m pip install --upgrade twine; fi
python3 -m twine upload dist/*
uv publish

clean:
rm -rf ./build/*
rm -rf ./dist/*
rm -rf ./.mypy_cache
rm -rf ./.pytest_cache
rm -rf ./.ruff_cache
rm -rf ./.tox
rm -rf ./.uv-cache

pytest:
if ! command -v pytest &>/dev/null; then python3 -m pip install --upgrade pytest; fi
pytest tests

test:
if ! command -v nosetests &>/dev/null; then python3 -m pip install --upgrade nose; fi
nosetests tests
uv run pytest tests
37 changes: 20 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,26 @@ issues = "https://github.com/ivankorobkov/python-inject/issues"

[dependency-groups]
dev = [
"ipython",
"ruff",
"mypy",
"yamllint",
"typing-extensions",
"typing-extensions>=4.15.0",
{ include-group = "tox" },
{ include-group = "ruff" },
{ include-group = "mypy" },
{ include-group = "yamllint" },
{ include-group = "tests" },
]

tox = ["tox>=4.56.1", "tox-uv>=1.35.2"]
ruff = ["ruff>=0.15.20"]
mypy = ["mypy>=2.1.0"]
yamllint = ["yamllint>=1.38.0"]

tests = [
"pytest",
"pytest-cov",
"pytest>=9.1.1",
"pytest-cov>=7.1.0",
]

[tool.uv]
required-version = ">=0.11"

[build-system]
requires = ["hatchling", "hatch-vcs"]
Expand Down Expand Up @@ -212,8 +219,6 @@ exclude_also = [

# Tox config
[tool.tox]
requires = ["tox>=4.23", "tox-uv>=1.13"]
runner = "uv-venv-lock-runner"
skip_missing_interpreters = true

env_list = [
Expand Down Expand Up @@ -247,6 +252,7 @@ lint = [

# default env
[tool.tox.env_run_base]
runner = "uv-venv-lock-runner"
description = "Run unit tests with coverage report ({env_name})"
use_develop = true
dependency_groups = ["tests"]
Expand All @@ -255,8 +261,7 @@ commands = [["pytest", { replace = "posargs", extend = true }]]
# tox envs
[tool.tox.env.lint-py]
description = "Lint python files"
deps = ["ruff"]
skip_install = true
dependency_groups = ["ruff"]
commands = [
[
"ruff",
Expand All @@ -277,7 +282,7 @@ commands = [

[tool.tox.env.lint-types]
description = "Type-check the public-API typing guards"
deps = ["mypy"]
dependency_groups = ["mypy"]
commands = [
[
"mypy",
Expand All @@ -289,7 +294,7 @@ commands = [

[tool.tox.env.lint-mypy]
description = "Type checking"
deps = ["mypy"]
dependency_groups = ["mypy"]
commands = [["mypy", { replace = "posargs", default = ["{tox_root}"], extend = true }]]

[tool.tox.env.lint-toml]
Expand All @@ -303,8 +308,7 @@ commands = [

[tool.tox.env.lint-yaml]
description = "Lint YAML files"
deps = ["yamllint"]
skip_install = true
dependency_groups = ["yamllint"]
commands = [
[
"yamllint",
Expand All @@ -317,8 +321,7 @@ commands = [

[tool.tox.env.fmt-py]
description = "Format python files"
deps = ["ruff"]
skip_install = true
dependency_groups = ["ruff"]
commands = [
[
"ruff",
Expand Down
Loading
Loading