pyproject-api 1.6.0__tar.gz → 1.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/.github/workflows/check.yml +16 -13
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/.github/workflows/release.yml +4 -4
- pyproject_api-1.7.0/.pre-commit-config.yaml +36 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/PKG-INFO +10 -12
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/docs/changelog.rst +4 -0
- pyproject_api-1.7.0/pyproject.toml +151 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/__init__.py +9 -8
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/_backend.py +20 -13
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/_backend.pyi +1 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/_frontend.py +3 -3
- pyproject_api-1.7.0/src/pyproject_api/_version.py +16 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/_via_fresh_subprocess.py +1 -1
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/demo_pkg_inline/build.py +1 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/demo_pkg_inline/pyproject.toml +1 -1
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/test_frontend.py +1 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/test_frontend_setuptools.py +1 -4
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/test_main.py +1 -1
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/test_version.py +1 -1
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tox.ini +7 -5
- pyproject_api-1.6.0/.pre-commit-config.yaml +0 -44
- pyproject_api-1.6.0/pyproject.toml +0 -115
- pyproject_api-1.6.0/src/pyproject_api/_version.py +0 -4
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/.github/dependabot.yml +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/.github/release.yml +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/.gitignore +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/.readthedocs.yml +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/CODE_OF_CONDUCT.md +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/LICENSE +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/README.md +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/docs/conf.py +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/docs/index.rst +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/__main__.py +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/_util.py +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/src/pyproject_api/py.typed +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/_build_sdist.py +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/test_backend.py +0 -0
- {pyproject_api-1.6.0 → pyproject_api-1.7.0}/tests/test_util.py +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
name: check
|
|
2
2
|
on:
|
|
3
|
+
workflow_dispatch:
|
|
3
4
|
push:
|
|
5
|
+
branches: ["main"]
|
|
4
6
|
tags-ignore: ["**"]
|
|
5
7
|
pull_request:
|
|
6
8
|
schedule:
|
|
@@ -18,7 +20,8 @@ jobs:
|
|
|
18
20
|
fail-fast: false
|
|
19
21
|
matrix:
|
|
20
22
|
py:
|
|
21
|
-
- "3.
|
|
23
|
+
- "3.13.0-beta.2"
|
|
24
|
+
- "3.12"
|
|
22
25
|
- "3.11"
|
|
23
26
|
- "3.10"
|
|
24
27
|
- "3.9"
|
|
@@ -29,16 +32,16 @@ jobs:
|
|
|
29
32
|
- macos-latest
|
|
30
33
|
steps:
|
|
31
34
|
- name: Setup python for tox
|
|
32
|
-
uses: actions/setup-python@
|
|
35
|
+
uses: actions/setup-python@v5
|
|
33
36
|
with:
|
|
34
|
-
python-version: "3.
|
|
35
|
-
- uses: actions/checkout@
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
- uses: actions/checkout@v4
|
|
36
39
|
with:
|
|
37
40
|
fetch-depth: 0
|
|
38
|
-
- name: Install tox
|
|
39
|
-
run: python -m pip install tox
|
|
41
|
+
- name: Install tox-uv
|
|
42
|
+
run: python -m pip install tox-uv
|
|
40
43
|
- name: Setup python for test ${{ matrix.py }}
|
|
41
|
-
uses: actions/setup-python@
|
|
44
|
+
uses: actions/setup-python@v5
|
|
42
45
|
with:
|
|
43
46
|
python-version: ${{ matrix.py }}
|
|
44
47
|
- name: Pick environment to run
|
|
@@ -75,15 +78,15 @@ jobs:
|
|
|
75
78
|
exclude:
|
|
76
79
|
- { os: windows-latest, tox_env: pkg_meta }
|
|
77
80
|
steps:
|
|
78
|
-
- uses: actions/checkout@
|
|
81
|
+
- uses: actions/checkout@v4
|
|
79
82
|
with:
|
|
80
83
|
fetch-depth: 0
|
|
81
|
-
- name: Setup Python 3.
|
|
82
|
-
uses: actions/setup-python@
|
|
84
|
+
- name: Setup Python 3.12
|
|
85
|
+
uses: actions/setup-python@v5
|
|
83
86
|
with:
|
|
84
|
-
python-version: "3.
|
|
85
|
-
- name: Install tox
|
|
86
|
-
run: python -m pip install tox
|
|
87
|
+
python-version: "3.12"
|
|
88
|
+
- name: Install tox-uv
|
|
89
|
+
run: python -m pip install tox-uv
|
|
87
90
|
- name: Run check for ${{ matrix.tox_env }}
|
|
88
91
|
run: tox -e ${{ matrix.tox_env }}
|
|
89
92
|
env:
|
|
@@ -13,15 +13,15 @@ jobs:
|
|
|
13
13
|
id-token: write
|
|
14
14
|
steps:
|
|
15
15
|
- name: Setup python to build package
|
|
16
|
-
uses: actions/setup-python@
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
17
|
with:
|
|
18
|
-
python-version: "3.
|
|
18
|
+
python-version: "3.12"
|
|
19
19
|
- name: Install build
|
|
20
20
|
run: python -m pip install build
|
|
21
|
-
- uses: actions/checkout@
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
22
|
with:
|
|
23
23
|
fetch-depth: 0
|
|
24
24
|
- name: Build package
|
|
25
25
|
run: pyproject-build -s -w . -o dist
|
|
26
26
|
- name: Publish to PyPI
|
|
27
|
-
uses: pypa/gh-action-pypi-publish@v1.
|
|
27
|
+
uses: pypa/gh-action-pypi-publish@v1.9.0
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.6.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: end-of-file-fixer
|
|
6
|
+
- id: trailing-whitespace
|
|
7
|
+
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
8
|
+
rev: 0.28.5
|
|
9
|
+
hooks:
|
|
10
|
+
- id: check-github-workflows
|
|
11
|
+
args: [ "--verbose" ]
|
|
12
|
+
- repo: https://github.com/codespell-project/codespell
|
|
13
|
+
rev: v2.3.0
|
|
14
|
+
hooks:
|
|
15
|
+
- id: codespell
|
|
16
|
+
additional_dependencies: ["tomli>=2.0.1"]
|
|
17
|
+
- repo: https://github.com/tox-dev/tox-ini-fmt
|
|
18
|
+
rev: "1.3.1"
|
|
19
|
+
hooks:
|
|
20
|
+
- id: tox-ini-fmt
|
|
21
|
+
args: ["-p", "fix"]
|
|
22
|
+
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
23
|
+
rev: "2.1.3"
|
|
24
|
+
hooks:
|
|
25
|
+
- id: pyproject-fmt
|
|
26
|
+
additional_dependencies: ["tox>=4.15.1"]
|
|
27
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
28
|
+
rev: "v0.4.10"
|
|
29
|
+
hooks:
|
|
30
|
+
- id: ruff-format
|
|
31
|
+
- id: ruff
|
|
32
|
+
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
|
|
33
|
+
- repo: meta
|
|
34
|
+
hooks:
|
|
35
|
+
- id: check-hooks-apply
|
|
36
|
+
- id: check-useless-excludes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: pyproject-api
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: API to interact with the python pyproject.toml based projects
|
|
5
|
-
Project-URL: Homepage,
|
|
5
|
+
Project-URL: Homepage, https://pyproject-api.readthedocs.io
|
|
6
6
|
Project-URL: Source, https://github.com/tox-dev/pyproject-api
|
|
7
7
|
Project-URL: Tracker, https://github.com/tox-dev/pyproject-api/issues
|
|
8
8
|
Author-email: Bernát Gábor <gaborjbernat@gmail.com>
|
|
@@ -27,19 +27,17 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
27
27
|
Classifier: Topic :: Software Development :: Testing
|
|
28
28
|
Classifier: Topic :: Utilities
|
|
29
29
|
Requires-Python: >=3.8
|
|
30
|
-
Requires-Dist: packaging>=
|
|
30
|
+
Requires-Dist: packaging>=24.1
|
|
31
31
|
Requires-Dist: tomli>=2.0.1; python_version < '3.11'
|
|
32
32
|
Provides-Extra: docs
|
|
33
|
-
Requires-Dist: furo>=
|
|
34
|
-
Requires-Dist: sphinx-autodoc-typehints>=1
|
|
35
|
-
Requires-Dist: sphinx<7.2; extra == 'docs'
|
|
33
|
+
Requires-Dist: furo>=2024.5.6; extra == 'docs'
|
|
34
|
+
Requires-Dist: sphinx-autodoc-typehints>=2.2.1; extra == 'docs'
|
|
36
35
|
Provides-Extra: testing
|
|
37
36
|
Requires-Dist: covdefaults>=2.3; extra == 'testing'
|
|
38
|
-
Requires-Dist: pytest-cov>=
|
|
39
|
-
Requires-Dist: pytest-mock>=3.
|
|
40
|
-
Requires-Dist: pytest>=
|
|
41
|
-
Requires-Dist: setuptools>=
|
|
42
|
-
Requires-Dist: wheel>=0.41.2; extra == 'testing'
|
|
37
|
+
Requires-Dist: pytest-cov>=5; extra == 'testing'
|
|
38
|
+
Requires-Dist: pytest-mock>=3.14; extra == 'testing'
|
|
39
|
+
Requires-Dist: pytest>=8.2.2; extra == 'testing'
|
|
40
|
+
Requires-Dist: setuptools>=70.1; extra == 'testing'
|
|
43
41
|
Description-Content-Type: text/markdown
|
|
44
42
|
|
|
45
43
|
# [`pyproject-api`](https://pyproject-api.readthedocs.io/en/latest/)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
Release History
|
|
2
2
|
===============
|
|
3
3
|
|
|
4
|
+
v1.6.1 - (2023-08-29)
|
|
5
|
+
---------------------
|
|
6
|
+
- Fix :meth:`pyproject_api.Frontend.metadata_from_built` only extracts one of the dist info files.
|
|
7
|
+
|
|
4
8
|
v1.6.0 - (2023-08-29)
|
|
5
9
|
---------------------
|
|
6
10
|
- Remove ``build_<wheel|editable>`` from ``prepare_metadata_for_build_<wheel|editable>`` to allow separate config
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "hatchling.build"
|
|
3
|
+
requires = [
|
|
4
|
+
"hatch-vcs>=0.4",
|
|
5
|
+
"hatchling>=1.24.2",
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "pyproject-api"
|
|
10
|
+
description = "API to interact with the python pyproject.toml based projects"
|
|
11
|
+
readme.content-type = "text/markdown"
|
|
12
|
+
readme.file = "README.md"
|
|
13
|
+
keywords = [
|
|
14
|
+
"environments",
|
|
15
|
+
"isolated",
|
|
16
|
+
"testing",
|
|
17
|
+
"virtual",
|
|
18
|
+
]
|
|
19
|
+
license = "MIT"
|
|
20
|
+
maintainers = [
|
|
21
|
+
{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" },
|
|
22
|
+
]
|
|
23
|
+
authors = [
|
|
24
|
+
{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" },
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.8"
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 5 - Production/Stable",
|
|
29
|
+
"Framework :: tox",
|
|
30
|
+
"Intended Audience :: Developers",
|
|
31
|
+
"License :: OSI Approved :: MIT License",
|
|
32
|
+
"Operating System :: MacOS :: MacOS X",
|
|
33
|
+
"Operating System :: Microsoft :: Windows",
|
|
34
|
+
"Operating System :: POSIX",
|
|
35
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
36
|
+
"Programming Language :: Python :: 3.8",
|
|
37
|
+
"Programming Language :: Python :: 3.9",
|
|
38
|
+
"Programming Language :: Python :: 3.10",
|
|
39
|
+
"Programming Language :: Python :: 3.11",
|
|
40
|
+
"Programming Language :: Python :: 3.12",
|
|
41
|
+
"Topic :: Software Development :: Libraries",
|
|
42
|
+
"Topic :: Software Development :: Testing",
|
|
43
|
+
"Topic :: Utilities",
|
|
44
|
+
]
|
|
45
|
+
dynamic = [
|
|
46
|
+
"version",
|
|
47
|
+
]
|
|
48
|
+
dependencies = [
|
|
49
|
+
"packaging>=24.1",
|
|
50
|
+
"tomli>=2.0.1; python_version<'3.11'",
|
|
51
|
+
]
|
|
52
|
+
optional-dependencies.docs = [
|
|
53
|
+
"furo>=2024.5.6",
|
|
54
|
+
"sphinx-autodoc-typehints>=2.2.1",
|
|
55
|
+
]
|
|
56
|
+
optional-dependencies.testing = [
|
|
57
|
+
"covdefaults>=2.3",
|
|
58
|
+
"pytest>=8.2.2",
|
|
59
|
+
"pytest-cov>=5",
|
|
60
|
+
"pytest-mock>=3.14",
|
|
61
|
+
"setuptools>=70.1",
|
|
62
|
+
]
|
|
63
|
+
urls.Homepage = "https://pyproject-api.readthedocs.io"
|
|
64
|
+
urls.Source = "https://github.com/tox-dev/pyproject-api"
|
|
65
|
+
urls.Tracker = "https://github.com/tox-dev/pyproject-api/issues"
|
|
66
|
+
|
|
67
|
+
[tool.hatch]
|
|
68
|
+
build.hooks.vcs.version-file = "src/pyproject_api/_version.py"
|
|
69
|
+
version.source = "vcs"
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
target-version = "py38"
|
|
73
|
+
line-length = 120
|
|
74
|
+
format.preview = true
|
|
75
|
+
format.docstring-code-line-length = 100
|
|
76
|
+
format.docstring-code-format = true
|
|
77
|
+
lint.select = [
|
|
78
|
+
"ALL",
|
|
79
|
+
]
|
|
80
|
+
lint.ignore = [
|
|
81
|
+
"ANN101", # Missing type annotation for `self` in method
|
|
82
|
+
"ANN102", # Missing type annotation for `cls` in classmethod
|
|
83
|
+
"ANN401", # Dynamically typed expressions
|
|
84
|
+
"COM812", # Conflict with formatter
|
|
85
|
+
"CPY", # No copyright statements
|
|
86
|
+
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
|
|
87
|
+
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
|
|
88
|
+
"INP001", # no implicit namespaces here
|
|
89
|
+
"ISC001", # Conflict with formatter
|
|
90
|
+
"S104", # Possible binding to all interface
|
|
91
|
+
]
|
|
92
|
+
lint.per-file-ignores."src/pyproject_api/_backend.py" = [
|
|
93
|
+
"ANN",
|
|
94
|
+
"I002",
|
|
95
|
+
"T201",
|
|
96
|
+
"UP",
|
|
97
|
+
] # no type annotations
|
|
98
|
+
lint.per-file-ignores."src/pyproject_api/_backend.pyi" = [
|
|
99
|
+
"E301",
|
|
100
|
+
"E302",
|
|
101
|
+
] # https://github.com/astral-sh/ruff/issues/10077
|
|
102
|
+
lint.per-file-ignores."tests/**/*.py" = [
|
|
103
|
+
"D", # don't care about documentation in tests
|
|
104
|
+
"FBT", # don"t care about booleans as positional arguments in tests
|
|
105
|
+
"INP001", # no implicit namespace
|
|
106
|
+
"PLC2701", # private imports
|
|
107
|
+
"PLR0913", # too many positional arguments
|
|
108
|
+
"PLR0917", # too many positional arguments
|
|
109
|
+
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
|
|
110
|
+
"S101", # asserts allowed in tests...
|
|
111
|
+
"S603", # `subprocess` call: check for execution of untrusted input
|
|
112
|
+
]
|
|
113
|
+
lint.isort = { known-first-party = [
|
|
114
|
+
"pyproject_api",
|
|
115
|
+
], required-imports = [
|
|
116
|
+
"from __future__ import annotations",
|
|
117
|
+
] }
|
|
118
|
+
lint.preview = true
|
|
119
|
+
|
|
120
|
+
[tool.codespell]
|
|
121
|
+
builtin = "clear,usage,en-GB_to_en-US"
|
|
122
|
+
write-changes = true
|
|
123
|
+
count = true
|
|
124
|
+
|
|
125
|
+
[tool.coverage]
|
|
126
|
+
html.show_contexts = true
|
|
127
|
+
html.skip_covered = false
|
|
128
|
+
paths.source = [
|
|
129
|
+
"src",
|
|
130
|
+
".tox*/*/lib/python*/site-packages",
|
|
131
|
+
".tox*/pypy*/site-packages",
|
|
132
|
+
".tox*\\*\\Lib\\site-packages",
|
|
133
|
+
"*/src",
|
|
134
|
+
"*\\src",
|
|
135
|
+
]
|
|
136
|
+
report.omit = [
|
|
137
|
+
]
|
|
138
|
+
run.parallel = true
|
|
139
|
+
run.plugins = [
|
|
140
|
+
"covdefaults",
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
[tool.mypy]
|
|
144
|
+
python_version = "3.11"
|
|
145
|
+
show_error_codes = true
|
|
146
|
+
strict = true
|
|
147
|
+
overrides = [
|
|
148
|
+
{ module = [
|
|
149
|
+
"virtualenv.*",
|
|
150
|
+
], ignore_missing_imports = true },
|
|
151
|
+
]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""PyProject API interface."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
from ._frontend import (
|
|
@@ -22,18 +23,18 @@ from ._via_fresh_subprocess import SubprocessFrontend
|
|
|
22
23
|
__version__ = version
|
|
23
24
|
|
|
24
25
|
__all__ = [
|
|
25
|
-
"__version__",
|
|
26
|
-
"Frontend",
|
|
27
26
|
"BackendFailed",
|
|
28
27
|
"CmdStatus",
|
|
28
|
+
"EditableResult",
|
|
29
|
+
"Frontend",
|
|
30
|
+
"MetadataForBuildEditableResult",
|
|
31
|
+
"MetadataForBuildWheelResult",
|
|
32
|
+
"OptionalHooks",
|
|
33
|
+
"RequiresBuildEditableResult",
|
|
29
34
|
"RequiresBuildSdistResult",
|
|
30
35
|
"RequiresBuildWheelResult",
|
|
31
|
-
"RequiresBuildEditableResult",
|
|
32
|
-
"MetadataForBuildWheelResult",
|
|
33
|
-
"MetadataForBuildEditableResult",
|
|
34
36
|
"SdistResult",
|
|
35
|
-
"WheelResult",
|
|
36
|
-
"EditableResult",
|
|
37
37
|
"SubprocessFrontend",
|
|
38
|
-
"
|
|
38
|
+
"WheelResult",
|
|
39
|
+
"__version__",
|
|
39
40
|
]
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Handles communication on the backend side between frontend and backend.
|
|
2
3
|
|
|
3
4
|
Please keep this file Python 2.7 compatible.
|
|
4
5
|
See https://tox.readthedocs.io/en/rewrite/development.html#code-style-guide
|
|
5
6
|
"""
|
|
7
|
+
|
|
6
8
|
from __future__ import print_function
|
|
7
9
|
|
|
8
10
|
import importlib
|
|
9
11
|
import json
|
|
12
|
+
import locale
|
|
10
13
|
import os
|
|
11
14
|
import sys
|
|
12
15
|
import traceback
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
class MissingCommand(TypeError):
|
|
16
|
-
"""Missing command"""
|
|
18
|
+
class MissingCommand(TypeError): # noqa: N818
|
|
19
|
+
"""Missing command."""
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
class BackendProxy:
|
|
@@ -28,13 +31,14 @@ class BackendProxy:
|
|
|
28
31
|
def __call__(self, name, *args, **kwargs):
|
|
29
32
|
on_object = self if name.startswith("_") else self.backend
|
|
30
33
|
if not hasattr(on_object, name):
|
|
31
|
-
|
|
34
|
+
msg = "{!r} has no attribute {!r}".format(on_object, name)
|
|
35
|
+
raise MissingCommand(msg)
|
|
32
36
|
return getattr(on_object, name)(*args, **kwargs)
|
|
33
37
|
|
|
34
38
|
def __str__(self):
|
|
35
39
|
return "{}(backend={})".format(self.__class__.__name__, self.backend)
|
|
36
40
|
|
|
37
|
-
def _exit(self):
|
|
41
|
+
def _exit(self): # noqa: PLR6301
|
|
38
42
|
return 0
|
|
39
43
|
|
|
40
44
|
def _optional_hooks(self):
|
|
@@ -56,11 +60,11 @@ def flush():
|
|
|
56
60
|
sys.stdout.flush()
|
|
57
61
|
|
|
58
62
|
|
|
59
|
-
def run(argv):
|
|
63
|
+
def run(argv): # noqa: C901, PLR0912, PLR0915
|
|
60
64
|
reuse_process = argv[0].lower() == "true"
|
|
61
65
|
|
|
62
66
|
try:
|
|
63
|
-
backend_proxy = BackendProxy(argv[1], None if len(argv) == 2 else argv[2])
|
|
67
|
+
backend_proxy = BackendProxy(argv[1], None if len(argv) == 2 else argv[2]) # noqa: PLR2004
|
|
64
68
|
except BaseException:
|
|
65
69
|
print("failed to start backend", file=sys.stderr)
|
|
66
70
|
raise
|
|
@@ -74,11 +78,12 @@ def run(argv):
|
|
|
74
78
|
continue
|
|
75
79
|
flush() # flush any output generated before
|
|
76
80
|
try:
|
|
77
|
-
|
|
81
|
+
# python 2 does not support loading from bytearray
|
|
82
|
+
if sys.version_info[0] == 2: # pragma: no branch # noqa: PLR2004
|
|
78
83
|
content = content.decode() # pragma: no cover
|
|
79
84
|
parsed_message = json.loads(content)
|
|
80
85
|
result_file = parsed_message["result"]
|
|
81
|
-
except Exception:
|
|
86
|
+
except Exception: # noqa: BLE001
|
|
82
87
|
# ignore messages that are not valid JSON and contain a valid result path
|
|
83
88
|
print("Backend: incorrect request to backend: {}".format(content), file=sys.stderr)
|
|
84
89
|
flush()
|
|
@@ -91,7 +96,7 @@ def run(argv):
|
|
|
91
96
|
result["return"] = outcome
|
|
92
97
|
if cmd == "_exit":
|
|
93
98
|
break
|
|
94
|
-
except BaseException as exception:
|
|
99
|
+
except BaseException as exception: # noqa: BLE001
|
|
95
100
|
result["code"] = exception.code if isinstance(exception, SystemExit) else 1
|
|
96
101
|
result["exc_type"] = exception.__class__.__name__
|
|
97
102
|
result["exc_msg"] = str(exception)
|
|
@@ -99,9 +104,10 @@ def run(argv):
|
|
|
99
104
|
traceback.print_exc()
|
|
100
105
|
finally:
|
|
101
106
|
try:
|
|
102
|
-
|
|
107
|
+
encoding = locale.getpreferredencoding(do_setlocale=False)
|
|
108
|
+
with open(result_file, "w", encoding=encoding) as file_handler: # noqa: PTH123
|
|
103
109
|
json.dump(result, file_handler)
|
|
104
|
-
except Exception:
|
|
110
|
+
except Exception: # noqa: BLE001
|
|
105
111
|
traceback.print_exc()
|
|
106
112
|
finally:
|
|
107
113
|
# used as done marker by frontend
|
|
@@ -119,7 +125,8 @@ def read_line(fd=0):
|
|
|
119
125
|
char = os.read(fd, 1)
|
|
120
126
|
if not char:
|
|
121
127
|
if not content:
|
|
122
|
-
|
|
128
|
+
msg = "EOF without reading anything"
|
|
129
|
+
raise EOFError(msg) # we didn't get a line at all, let the caller know
|
|
123
130
|
break # pragma: no cover
|
|
124
131
|
if char == b"\n":
|
|
125
132
|
break
|
|
@@ -6,6 +6,7 @@ class BackendProxy:
|
|
|
6
6
|
backend_module: str
|
|
7
7
|
backend_object: str | None
|
|
8
8
|
backend: Any
|
|
9
|
+
|
|
9
10
|
def __init__(self, backend_module: str, backend_obj: str | None) -> None: ...
|
|
10
11
|
def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: ...
|
|
11
12
|
def _exit(self) -> None: ...
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Build frontend for PEP-517."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
import json
|
|
@@ -174,7 +175,7 @@ class Frontend(ABC):
|
|
|
174
175
|
#: backend requirements when the ``pyproject.toml`` does not specify it
|
|
175
176
|
LEGACY_REQUIRES: tuple[Requirement, ...] = (Requirement("setuptools >= 40.8.0"), Requirement("wheel"))
|
|
176
177
|
|
|
177
|
-
def __init__( # noqa: PLR0913
|
|
178
|
+
def __init__( # noqa: PLR0913, PLR0917
|
|
178
179
|
self,
|
|
179
180
|
root: Path,
|
|
180
181
|
backend_paths: tuple[Path, ...],
|
|
@@ -480,14 +481,13 @@ class Frontend(ABC):
|
|
|
480
481
|
if root.endswith(".dist-info"):
|
|
481
482
|
basename = root
|
|
482
483
|
zip_file.extract(name, extract_to)
|
|
483
|
-
break
|
|
484
484
|
if basename is None: # pragma: no branch
|
|
485
485
|
msg = f"no .dist-info found inside generated wheel {wheel}"
|
|
486
486
|
raise RuntimeError(msg)
|
|
487
487
|
return metadata_directory / basename, out, err
|
|
488
488
|
|
|
489
489
|
@contextmanager
|
|
490
|
-
def _wheel_directory(self) -> Iterator[Path]:
|
|
490
|
+
def _wheel_directory(self) -> Iterator[Path]: # noqa: PLR6301
|
|
491
491
|
with TemporaryDirectory() as wheel_directory:
|
|
492
492
|
yield Path(wheel_directory)
|
|
493
493
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '1.7.0'
|
|
16
|
+
__version_tuple__ = version_tuple = (1, 7, 0)
|
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import os
|
|
4
4
|
import sys
|
|
5
5
|
from contextlib import contextmanager
|
|
6
|
-
from subprocess import PIPE, Popen
|
|
6
|
+
from subprocess import PIPE, Popen # noqa: S404
|
|
7
7
|
from threading import Thread
|
|
8
8
|
from typing import IO, TYPE_CHECKING, Any, Iterator, Tuple, cast
|
|
9
9
|
|
|
@@ -192,6 +192,7 @@ def test_metadata_from_built_wheel(
|
|
|
192
192
|
monkeypatch.chdir(tmp_path)
|
|
193
193
|
path, out, err = frontend.metadata_from_built(tmp_path, target)
|
|
194
194
|
assert path == tmp_path / "demo_pkg_inline-1.0.0.dist-info"
|
|
195
|
+
assert {p.name for p in path.iterdir()} == {"top_level.txt", "WHEEL", "RECORD", "METADATA"}
|
|
195
196
|
assert f" build_{target}" in out
|
|
196
197
|
assert not err
|
|
197
198
|
|
|
@@ -6,7 +6,6 @@ from stat import S_IWGRP, S_IWOTH, S_IWUSR
|
|
|
6
6
|
from typing import TYPE_CHECKING, Iterator, NamedTuple
|
|
7
7
|
|
|
8
8
|
import pytest
|
|
9
|
-
from packaging.requirements import Requirement
|
|
10
9
|
|
|
11
10
|
from pyproject_api._frontend import BackendFailed
|
|
12
11
|
from pyproject_api._via_fresh_subprocess import SubprocessFrontend
|
|
@@ -59,9 +58,7 @@ def test_setuptools_get_requires_for_build_sdist(frontend_setuptools: Subprocess
|
|
|
59
58
|
|
|
60
59
|
def test_setuptools_get_requires_for_build_wheel(frontend_setuptools: SubprocessFrontend) -> None:
|
|
61
60
|
result = frontend_setuptools.get_requires_for_build_wheel()
|
|
62
|
-
|
|
63
|
-
assert isinstance(left, Requirement)
|
|
64
|
-
assert str(left) == str(right)
|
|
61
|
+
assert not result.requires
|
|
65
62
|
assert isinstance(result.out, str)
|
|
66
63
|
assert isinstance(result.err, str)
|
|
67
64
|
|
|
@@ -3,6 +3,7 @@ requires =
|
|
|
3
3
|
tox>=4.2
|
|
4
4
|
env_list =
|
|
5
5
|
fix
|
|
6
|
+
py313
|
|
6
7
|
py312
|
|
7
8
|
py311
|
|
8
9
|
py310
|
|
@@ -37,7 +38,7 @@ labels = test
|
|
|
37
38
|
description = run formatter and linters
|
|
38
39
|
skip_install = true
|
|
39
40
|
deps =
|
|
40
|
-
pre-commit>=3.
|
|
41
|
+
pre-commit>=3.7.1
|
|
41
42
|
pass_env =
|
|
42
43
|
{[testenv]passenv}
|
|
43
44
|
PROGRAMDATA
|
|
@@ -47,7 +48,7 @@ commands =
|
|
|
47
48
|
[testenv:type]
|
|
48
49
|
description = run type check on code base
|
|
49
50
|
deps =
|
|
50
|
-
mypy==1.
|
|
51
|
+
mypy==1.10
|
|
51
52
|
set_env =
|
|
52
53
|
{tty:MYPY_FORCE_COLOR = 1}
|
|
53
54
|
commands =
|
|
@@ -66,9 +67,9 @@ commands =
|
|
|
66
67
|
description = check that the long description is valid
|
|
67
68
|
skip_install = true
|
|
68
69
|
deps =
|
|
69
|
-
build[virtualenv]>=
|
|
70
|
-
check-wheel-contents>=0.
|
|
71
|
-
twine>=
|
|
70
|
+
build[virtualenv]>=1.2.1
|
|
71
|
+
check-wheel-contents>=0.6
|
|
72
|
+
twine>=5.1
|
|
72
73
|
commands =
|
|
73
74
|
python -m build -o {envtmpdir} -s -w .
|
|
74
75
|
twine check --strict {envtmpdir}{/}*
|
|
@@ -83,3 +84,4 @@ extras =
|
|
|
83
84
|
commands =
|
|
84
85
|
python -m pip list --format=columns
|
|
85
86
|
python -c "print(r'{envpython}')"
|
|
87
|
+
uv_seed = true
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
repos:
|
|
2
|
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
-
rev: v4.4.0
|
|
4
|
-
hooks:
|
|
5
|
-
- id: end-of-file-fixer
|
|
6
|
-
- id: trailing-whitespace
|
|
7
|
-
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
8
|
-
rev: "v0.0.286"
|
|
9
|
-
hooks:
|
|
10
|
-
- id: ruff
|
|
11
|
-
exclude: src/pyproject_api/_backend.py
|
|
12
|
-
args: [--fix, --exit-non-zero-on-fix]
|
|
13
|
-
- repo: https://github.com/psf/black
|
|
14
|
-
rev: 23.7.0
|
|
15
|
-
hooks:
|
|
16
|
-
- id: black
|
|
17
|
-
- repo: https://github.com/tox-dev/tox-ini-fmt
|
|
18
|
-
rev: "1.3.1"
|
|
19
|
-
hooks:
|
|
20
|
-
- id: tox-ini-fmt
|
|
21
|
-
args: ["-p", "fix"]
|
|
22
|
-
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
23
|
-
rev: "1.1.0"
|
|
24
|
-
hooks:
|
|
25
|
-
- id: pyproject-fmt
|
|
26
|
-
additional_dependencies: ["tox>=4.10"]
|
|
27
|
-
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
28
|
-
rev: "v3.0.2"
|
|
29
|
-
hooks:
|
|
30
|
-
- id: prettier
|
|
31
|
-
args: ["--print-width=120", "--prose-wrap=always"]
|
|
32
|
-
- repo: https://github.com/asottile/blacken-docs
|
|
33
|
-
rev: 1.16.0
|
|
34
|
-
hooks:
|
|
35
|
-
- id: blacken-docs
|
|
36
|
-
additional_dependencies: [black==23.7]
|
|
37
|
-
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
38
|
-
rev: v1.10.0
|
|
39
|
-
hooks:
|
|
40
|
-
- id: rst-backticks
|
|
41
|
-
- repo: meta
|
|
42
|
-
hooks:
|
|
43
|
-
- id: check-hooks-apply
|
|
44
|
-
- id: check-useless-excludes
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
build-backend = "hatchling.build"
|
|
3
|
-
requires = [
|
|
4
|
-
"hatch-vcs>=0.3",
|
|
5
|
-
"hatchling>=1.18",
|
|
6
|
-
]
|
|
7
|
-
|
|
8
|
-
[project]
|
|
9
|
-
name = "pyproject-api"
|
|
10
|
-
description = "API to interact with the python pyproject.toml based projects"
|
|
11
|
-
readme.content-type = "text/markdown"
|
|
12
|
-
readme.file = "README.md"
|
|
13
|
-
keywords = [
|
|
14
|
-
"environments",
|
|
15
|
-
"isolated",
|
|
16
|
-
"testing",
|
|
17
|
-
"virtual",
|
|
18
|
-
]
|
|
19
|
-
license = "MIT"
|
|
20
|
-
maintainers = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }]
|
|
21
|
-
authors = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }]
|
|
22
|
-
requires-python = ">=3.8"
|
|
23
|
-
classifiers = [
|
|
24
|
-
"Development Status :: 5 - Production/Stable",
|
|
25
|
-
"Framework :: tox",
|
|
26
|
-
"Intended Audience :: Developers",
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
|
-
"Operating System :: MacOS :: MacOS X",
|
|
29
|
-
"Operating System :: Microsoft :: Windows",
|
|
30
|
-
"Operating System :: POSIX",
|
|
31
|
-
"Programming Language :: Python :: 3 :: Only",
|
|
32
|
-
"Programming Language :: Python :: 3.8",
|
|
33
|
-
"Programming Language :: Python :: 3.9",
|
|
34
|
-
"Programming Language :: Python :: 3.10",
|
|
35
|
-
"Programming Language :: Python :: 3.11",
|
|
36
|
-
"Programming Language :: Python :: 3.12",
|
|
37
|
-
"Topic :: Software Development :: Libraries",
|
|
38
|
-
"Topic :: Software Development :: Testing",
|
|
39
|
-
"Topic :: Utilities",
|
|
40
|
-
]
|
|
41
|
-
dynamic = [
|
|
42
|
-
"version",
|
|
43
|
-
]
|
|
44
|
-
dependencies = [
|
|
45
|
-
"packaging>=23.1",
|
|
46
|
-
'tomli>=2.0.1; python_version < "3.11"',
|
|
47
|
-
]
|
|
48
|
-
optional-dependencies.docs = [
|
|
49
|
-
"furo>=2023.8.19",
|
|
50
|
-
"sphinx<7.2",
|
|
51
|
-
"sphinx-autodoc-typehints>=1.24",
|
|
52
|
-
]
|
|
53
|
-
optional-dependencies.testing = [
|
|
54
|
-
"covdefaults>=2.3",
|
|
55
|
-
"pytest>=7.4",
|
|
56
|
-
"pytest-cov>=4.1",
|
|
57
|
-
"pytest-mock>=3.11.1",
|
|
58
|
-
"setuptools>=68.1.2",
|
|
59
|
-
"wheel>=0.41.2",
|
|
60
|
-
]
|
|
61
|
-
urls.Homepage = "http://pyproject_api.readthedocs.org"
|
|
62
|
-
urls.Source = "https://github.com/tox-dev/pyproject-api"
|
|
63
|
-
urls.Tracker = "https://github.com/tox-dev/pyproject-api/issues"
|
|
64
|
-
|
|
65
|
-
[tool.hatch]
|
|
66
|
-
build.hooks.vcs.version-file = "src/pyproject_api/_version.py"
|
|
67
|
-
version.source = "vcs"
|
|
68
|
-
|
|
69
|
-
[tool.black]
|
|
70
|
-
line-length = 120
|
|
71
|
-
|
|
72
|
-
[tool.ruff]
|
|
73
|
-
select = ["ALL"]
|
|
74
|
-
line-length = 120
|
|
75
|
-
target-version = "py38"
|
|
76
|
-
isort = {known-first-party = ["pyproject_api"], required-imports = ["from __future__ import annotations"]}
|
|
77
|
-
ignore = [
|
|
78
|
-
"INP001", # no implicit namespaces here
|
|
79
|
-
"ANN101", # Missing type annotation for `self` in method
|
|
80
|
-
"ANN102", # Missing type annotation for `cls` in classmethod"
|
|
81
|
-
"ANN401", # Dynamically typed expressions
|
|
82
|
-
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
|
|
83
|
-
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
|
|
84
|
-
"S104", # Possible binding to all interface
|
|
85
|
-
]
|
|
86
|
-
[tool.ruff.per-file-ignores]
|
|
87
|
-
"tests/**/*.py" = [
|
|
88
|
-
"S101", # asserts allowed in tests...
|
|
89
|
-
"FBT", # don"t care about booleans as positional arguments in tests
|
|
90
|
-
"INP001", # no implicit namespace
|
|
91
|
-
"D", # don"t care about documentation in tests
|
|
92
|
-
"S603", # `subprocess` call: check for execution of untrusted input
|
|
93
|
-
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
|
|
94
|
-
]
|
|
95
|
-
|
|
96
|
-
[tool.coverage]
|
|
97
|
-
html.show_contexts = true
|
|
98
|
-
html.skip_covered = false
|
|
99
|
-
paths.source = [
|
|
100
|
-
"src",
|
|
101
|
-
".tox*/*/lib/python*/site-packages",
|
|
102
|
-
".tox*/pypy*/site-packages",
|
|
103
|
-
".tox*\\*\\Lib\\site-packages",
|
|
104
|
-
"*/src",
|
|
105
|
-
"*\\src",
|
|
106
|
-
]
|
|
107
|
-
report.omit = []
|
|
108
|
-
run.parallel = true
|
|
109
|
-
run.plugins = ["covdefaults"]
|
|
110
|
-
|
|
111
|
-
[tool.mypy]
|
|
112
|
-
python_version = "3.11"
|
|
113
|
-
show_error_codes = true
|
|
114
|
-
strict = true
|
|
115
|
-
overrides = [{ module = ["virtualenv.*"], ignore_missing_imports = true }]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|