Skip to content

Commit 494c457

Browse files
authored
PEP-517 (#829)
* Convert to PEP-517 project * Move pylint and coverage configs to pyproject.toml * Remove autogenerated C files
1 parent abf2a25 commit 494c457

File tree

12 files changed

+160
-268889
lines changed

12 files changed

+160
-268889
lines changed

.coveragerc

-10
This file was deleted.

.github/workflows/tests-and-linters.yml

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
with:
5151
python-version: 3.12
5252
- run: pip install tox 'cython>=3,<4'
53-
- run: make cythonize
5453
- run: tox -vv
5554
env:
5655
TOXENV: coveralls

.gitignore

+5-7
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ venv*/
6363
# Vim Rope
6464
.ropeproject/
6565

66-
# C extensions
67-
src/dependency_injector/*.h
68-
src/dependency_injector/*.so
69-
src/dependency_injector/containers/*.h
70-
src/dependency_injector/containers/*.so
71-
src/dependency_injector/providers/*.h
72-
src/dependency_injector/providers/*.so
66+
# Cython artifacts
67+
src/**/*.c
68+
src/**/*.h
69+
src/**/*.so
70+
src/**/*.html
7371

7472
# Workspace for samples
7573
.workspace/

.pylintrc

-49
This file was deleted.

Makefile

+10-22
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
VERSION := $(shell python setup.py --version)
22

3-
CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')
4-
5-
CYTHON_DIRECTIVES = -Xlanguage_level=3
6-
7-
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
8-
CYTHON_DIRECTIVES += -Xprofile=True
9-
CYTHON_DIRECTIVES += -Xlinetrace=True
10-
endif
11-
3+
export COVERAGE_RCFILE := pyproject.toml
124

135
clean:
146
# Clean sources
@@ -25,21 +17,17 @@ clean:
2517
find examples -name '*.py[co]' -delete
2618
find examples -name '__pycache__' -delete
2719

28-
cythonize:
29-
# Compile Cython to C
30-
cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC)
20+
build: clean
21+
# Compile C extensions
22+
python setup.py build_ext --inplace
3123
# Move all Cython html reports
3224
mkdir -p reports/cython/
3325
find src -name '*.html' -exec mv {} reports/cython/ \;
3426

35-
build: clean cythonize
36-
# Compile C extensions
37-
python setup.py build_ext --inplace
38-
3927
docs-live:
4028
sphinx-autobuild docs docs/_build/html
4129

42-
install: uninstall clean cythonize
30+
install: uninstall clean build
4331
pip install -ve .
4432

4533
uninstall:
@@ -48,9 +36,9 @@ uninstall:
4836
test:
4937
# Unit tests with coverage report
5038
coverage erase
51-
coverage run --rcfile=./.coveragerc -m pytest -c tests/.configs/pytest.ini
52-
coverage report --rcfile=./.coveragerc
53-
coverage html --rcfile=./.coveragerc
39+
coverage run -m pytest -c tests/.configs/pytest.ini
40+
coverage report
41+
coverage html
5442

5543
check:
5644
flake8 src/dependency_injector/
@@ -61,9 +49,9 @@ check:
6149

6250
mypy tests/typing
6351

64-
test-publish: cythonize
52+
test-publish: build
6553
# Create distributions
66-
python setup.py sdist
54+
python -m build --sdist
6755
# Upload distributions to PyPI
6856
twine upload --repository testpypi dist/dependency-injector-$(VERSION)*
6957

pyproject.toml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
[build-system]
2+
requires = ["setuptools", "Cython"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "dependency-injector"
7+
authors = [
8+
{name = "Roman Mogylatov", email = "[email protected]"},
9+
]
10+
maintainers = [
11+
{name = "Roman Mogylatov", email = "[email protected]"},
12+
]
13+
description = "Dependency injection framework for Python"
14+
readme = {file = "README.rst", content-type = "text/x-rst"}
15+
license = {file = "LICENSE.rst", content-type = "text/x-rst"}
16+
requires-python = ">=3.7"
17+
keywords = [
18+
"Dependency injection",
19+
"DI",
20+
"Inversion of Control",
21+
"IoC",
22+
"Factory",
23+
"Singleton",
24+
"Design patterns",
25+
"Flask",
26+
]
27+
classifiers = [
28+
"Development Status :: 5 - Production/Stable",
29+
"Intended Audience :: Developers",
30+
"License :: OSI Approved :: BSD License",
31+
"Operating System :: OS Independent",
32+
"Programming Language :: Python",
33+
"Programming Language :: Python :: 3",
34+
"Programming Language :: Python :: 3.7",
35+
"Programming Language :: Python :: 3.8",
36+
"Programming Language :: Python :: 3.9",
37+
"Programming Language :: Python :: 3.10",
38+
"Programming Language :: Python :: 3.11",
39+
"Programming Language :: Python :: 3.12",
40+
"Programming Language :: Python :: 3.13",
41+
"Programming Language :: Python :: Implementation :: CPython",
42+
"Programming Language :: Python :: Implementation :: PyPy",
43+
"Framework :: AsyncIO",
44+
"Framework :: Bottle",
45+
"Framework :: Django",
46+
"Framework :: Flask",
47+
"Framework :: Pylons",
48+
"Framework :: Pyramid",
49+
"Framework :: Pytest",
50+
"Framework :: TurboGears",
51+
"Topic :: Software Development",
52+
"Topic :: Software Development :: Libraries",
53+
"Topic :: Software Development :: Libraries :: Python Modules",
54+
]
55+
dynamic = ["version"]
56+
dependencies = ["six"]
57+
58+
[project.optional-dependencies]
59+
yaml = ["pyyaml"]
60+
pydantic = ["pydantic"]
61+
flask = ["flask"]
62+
aiohttp = ["aiohttp"]
63+
64+
[project.urls]
65+
Homepage = "https://github.com/ets-labs/python-dependency-injector"
66+
Documentation = "https://python-dependency-injector.ets-labs.org/"
67+
Download = "https://pypi.python.org/pypi/dependency_injector"
68+
69+
[tool.setuptools]
70+
package-dir = {"" = "src"}
71+
72+
[tool.setuptools.packages.find]
73+
where = ["src"]
74+
75+
[tool.setuptools.package-data]
76+
dependency_injector = ["*.pxd", "*.pyi", "py.typed"]
77+
78+
[tool.setuptools.dynamic]
79+
version = {attr = "dependency_injector.__version__"}
80+
81+
[tool.coverage.run]
82+
branch = false
83+
relative_files = true
84+
source_pkgs = ["dependency_injector"]
85+
plugins = ["Cython.Coverage"]
86+
87+
[tool.coverage.html]
88+
directory = "reports/unittests/"
89+
90+
[tool.coverage.report]
91+
show_missing = true
92+
93+
[tool.isort]
94+
profile = "black"
95+
96+
[tool.pylint.main]
97+
ignore = ["tests"]
98+
99+
[tool.pylint.design]
100+
min-public-methods = 0
101+
max-public-methods = 30

requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pytest-asyncio
55
tox
66
coverage
77
flake8
8+
flake8-pyproject
89
pydocstyle
910
sphinx_autobuild
1011
pip

0 commit comments

Comments
 (0)