Skip to content

Build improvements #888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
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
37 changes: 27 additions & 10 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,26 @@ jobs:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2019, macos-14]
env:
CIBW_SKIP: cp27-*
CIBW_ENABLE: pypy
CIBW_ENVIRONMENT: >-
PIP_CONFIG_SETTINGS="build_ext=-j4"
DEPENDENCY_INJECTOR_LIMITED_API="1"
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.23.3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-x86-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

publish:
name: Publish on PyPI
test-publish:
name: Upload release to TestPyPI
needs: [build-sdist, build-wheels]
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
environment: test-pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -84,11 +90,22 @@ jobs:
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# For publishing to Test PyPI, uncomment next two lines:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

publish:
name: Upload release to PyPI
needs: [build-sdist, build-wheels, test-publish]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1

publish-docs:
name: Publish docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 3.12
- run: pip install tox 'cython>=3,<4'
- run: pip install tox
- run: tox -vv
env:
TOXENV: coveralls
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ lib64/
parts/
sdist/
var/
wheelhouse/
*.egg-info/
.installed.cfg
*.egg
Expand Down
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
recursive-include src/dependency_injector *.py* *.c
recursive-include src/dependency_injector *.py* *.c py.typed
recursive-include tests *.py
include README.rst
include CONTRIBUTORS.rst
include LICENSE.rst
include requirements.txt
include setup.py
include tox.ini
include py.typed
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "Cython"]
requires = ["setuptools", "Cython>=3.1.1"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -102,6 +102,7 @@ max-public-methods = 30
[tool.pytest.ini_options]
testpaths = ["tests/unit/"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
markers = [
"pydantic: Tests with Pydantic as a dependency",
]
Expand Down
5 changes: 3 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cython==3.1.0
cython==3.1.1
setuptools
pytest
pytest-asyncio
Expand All @@ -13,7 +13,8 @@ mypy
pyyaml
httpx
fastapi
pydantic==1.10.17
pydantic
pydantic-settings
numpy
scipy
boto3
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
"""`Dependency injector` setup script."""

import os
import sys

from Cython.Build import cythonize
from Cython.Compiler import Options
from setuptools import Extension, setup

debug = os.environ.get("DEPENDENCY_INJECTOR_DEBUG_MODE") == "1"
limited_api = os.environ.get("DEPENDENCY_INJECTOR_LIMITED_API") == "1"
limited_api = (
os.environ.get("DEPENDENCY_INJECTOR_LIMITED_API") == "1"
and sys.implementation.name == "cpython"
)
defined_macros = []
options = {}
compiler_directives = {
Expand All @@ -31,7 +35,7 @@
if limited_api:
options.setdefault("bdist_wheel", {})
options["bdist_wheel"]["py_limited_api"] = "cp38"
defined_macros.append(("Py_LIMITED_API", 0x03080000))
defined_macros.append(("Py_LIMITED_API", "0x03080000"))

setup(
options=options,
Expand Down
2 changes: 1 addition & 1 deletion src/dependency_injector/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Top-level package."""

__version__ = "4.46.0"
__version__ = "4.47.0a3"
"""Version number.

:type: str
Expand Down
19 changes: 1 addition & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
parallel_show_output = true
envlist=
coveralls, pylint, flake8, pydocstyle, pydantic-v1, pydantic-v2, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, pypy3.9, pypy3.10
coveralls, pylint, flake8, pydocstyle, pydantic-v1, pydantic-v2, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, pypy3.9, pypy3.10, pypy3.11

[testenv]
deps=
Expand All @@ -20,7 +20,6 @@ deps=
extras=
yaml
commands = pytest
python_files = test_*_py3*.py
setenv =
COVERAGE_RCFILE = pyproject.toml

Expand Down Expand Up @@ -61,22 +60,6 @@ commands=
coverage report
coveralls

[testenv:pypy3.9]
deps=
pytest
pytest-asyncio
httpx
flask
pydantic-settings
werkzeug
fastapi
boto3
mypy_boto3_s3
extras=
yaml
commands = pytest


[testenv:pylint]
deps=
pylint
Expand Down
Loading