Skip to content

Commit

Permalink
PEP-517 (#829)
Browse files Browse the repository at this point in the history
* Convert to PEP-517 project

* Move pylint and coverage configs to pyproject.toml

* Remove autogenerated C files
  • Loading branch information
ZipFile authored Nov 10, 2024
1 parent abf2a25 commit 494c457
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 268,889 deletions.
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
with:
python-version: 3.12
- run: pip install tox 'cython>=3,<4'
- run: make cythonize
- run: tox -vv
env:
TOXENV: coveralls
Expand Down
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ venv*/
# Vim Rope
.ropeproject/

# C extensions
src/dependency_injector/*.h
src/dependency_injector/*.so
src/dependency_injector/containers/*.h
src/dependency_injector/containers/*.so
src/dependency_injector/providers/*.h
src/dependency_injector/providers/*.so
# Cython artifacts
src/**/*.c
src/**/*.h
src/**/*.so
src/**/*.html

# Workspace for samples
.workspace/
Expand Down
49 changes: 0 additions & 49 deletions .pylintrc

This file was deleted.

32 changes: 10 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
VERSION := $(shell python setup.py --version)

CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')

CYTHON_DIRECTIVES = -Xlanguage_level=3

ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
CYTHON_DIRECTIVES += -Xprofile=True
CYTHON_DIRECTIVES += -Xlinetrace=True
endif

export COVERAGE_RCFILE := pyproject.toml

clean:
# Clean sources
Expand All @@ -25,21 +17,17 @@ clean:
find examples -name '*.py[co]' -delete
find examples -name '__pycache__' -delete

cythonize:
# Compile Cython to C
cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC)
build: clean
# Compile C extensions
python setup.py build_ext --inplace
# Move all Cython html reports
mkdir -p reports/cython/
find src -name '*.html' -exec mv {} reports/cython/ \;

build: clean cythonize
# Compile C extensions
python setup.py build_ext --inplace

docs-live:
sphinx-autobuild docs docs/_build/html

install: uninstall clean cythonize
install: uninstall clean build
pip install -ve .

uninstall:
Expand All @@ -48,9 +36,9 @@ uninstall:
test:
# Unit tests with coverage report
coverage erase
coverage run --rcfile=./.coveragerc -m pytest -c tests/.configs/pytest.ini
coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc
coverage run -m pytest -c tests/.configs/pytest.ini
coverage report
coverage html

check:
flake8 src/dependency_injector/
Expand All @@ -61,9 +49,9 @@ check:

mypy tests/typing

test-publish: cythonize
test-publish: build
# Create distributions
python setup.py sdist
python -m build --sdist
# Upload distributions to PyPI
twine upload --repository testpypi dist/dependency-injector-$(VERSION)*

Expand Down
101 changes: 101 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[build-system]
requires = ["setuptools", "Cython"]
build-backend = "setuptools.build_meta"

[project]
name = "dependency-injector"
authors = [
{name = "Roman Mogylatov", email = "[email protected]"},
]
maintainers = [
{name = "Roman Mogylatov", email = "[email protected]"},
]
description = "Dependency injection framework for Python"
readme = {file = "README.rst", content-type = "text/x-rst"}
license = {file = "LICENSE.rst", content-type = "text/x-rst"}
requires-python = ">=3.7"
keywords = [
"Dependency injection",
"DI",
"Inversion of Control",
"IoC",
"Factory",
"Singleton",
"Design patterns",
"Flask",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: AsyncIO",
"Framework :: Bottle",
"Framework :: Django",
"Framework :: Flask",
"Framework :: Pylons",
"Framework :: Pyramid",
"Framework :: Pytest",
"Framework :: TurboGears",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dynamic = ["version"]
dependencies = ["six"]

[project.optional-dependencies]
yaml = ["pyyaml"]
pydantic = ["pydantic"]
flask = ["flask"]
aiohttp = ["aiohttp"]

[project.urls]
Homepage = "https://github.com/ets-labs/python-dependency-injector"
Documentation = "https://python-dependency-injector.ets-labs.org/"
Download = "https://pypi.python.org/pypi/dependency_injector"

[tool.setuptools]
package-dir = {"" = "src"}

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
dependency_injector = ["*.pxd", "*.pyi", "py.typed"]

[tool.setuptools.dynamic]
version = {attr = "dependency_injector.__version__"}

[tool.coverage.run]
branch = false
relative_files = true
source_pkgs = ["dependency_injector"]
plugins = ["Cython.Coverage"]

[tool.coverage.html]
directory = "reports/unittests/"

[tool.coverage.report]
show_missing = true

[tool.isort]
profile = "black"

[tool.pylint.main]
ignore = ["tests"]

[tool.pylint.design]
min-public-methods = 0
max-public-methods = 30
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pytest-asyncio
tox
coverage
flake8
flake8-pyproject
pydocstyle
sphinx_autobuild
pip
Expand Down
Loading

0 comments on commit 494c457

Please sign in to comment.