diff --git a/backend/__init__.py b/backend/__init__.py index 63024b2..645ef81 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -1,6 +1,7 @@ """ Self-hosted backend for self-build (bootstrap). """ + from .wheel import build_wheel from .sdist import build_sdist diff --git a/backend/sdist.py b/backend/sdist.py index 0179605..3f52030 100644 --- a/backend/sdist.py +++ b/backend/sdist.py @@ -10,6 +10,7 @@ - include *.py for now - exclude __pycache__ and .pyc """ + from io import BytesIO from pathlib import Path import logging diff --git a/backend/wheel.py b/backend/wheel.py index 71063c5..c58a6a5 100644 --- a/backend/wheel.py +++ b/backend/wheel.py @@ -10,6 +10,7 @@ - include *.py for now - exclude __pycache__ and .pyc """ + from base64 import urlsafe_b64encode from io import TextIOWrapper, BytesIO from pathlib import Path diff --git a/src/pyproject_installer/__main__.py b/src/pyproject_installer/__main__.py index 641a632..3c9e0f5 100644 --- a/src/pyproject_installer/__main__.py +++ b/src/pyproject_installer/__main__.py @@ -11,6 +11,7 @@ - RECORD is dropped (PEP627) - signature verification of signed wheel is not supported """ + from pathlib import Path import argparse import json diff --git a/src/pyproject_installer/lib/backend_helper/backend_caller.py b/src/pyproject_installer/lib/backend_helper/backend_caller.py index c77e249..189690b 100644 --- a/src/pyproject_installer/lib/backend_helper/backend_caller.py +++ b/src/pyproject_installer/lib/backend_helper/backend_caller.py @@ -2,6 +2,7 @@ Intended to be run in subprocess to call build backend's hooks. Must not have dependencies other than stdlib. """ + from importlib import import_module from pathlib import Path import argparse diff --git a/tests/integration/test_buildable.py b/tests/integration/test_buildable.py index 3799c57..cac9324 100644 --- a/tests/integration/test_buildable.py +++ b/tests/integration/test_buildable.py @@ -1,6 +1,7 @@ """ Check if pyproject_installer is buildable by other tools like `build` or `pip` """ + import subprocess diff --git a/tests/unit/test_build/test_pyproject_parser.py b/tests/unit/test_build/test_pyproject_parser.py index 2810ffd..c99a4d8 100644 --- a/tests/unit/test_build/test_pyproject_parser.py +++ b/tests/unit/test_build/test_pyproject_parser.py @@ -1,4 +1,5 @@ """Tests for parser of pyproject.toml""" + import json import textwrap import sys diff --git a/tests/unit/test_install/test_installer.py b/tests/unit/test_install/test_installer.py index 600eff4..82df631 100644 --- a/tests/unit/test_install/test_installer.py +++ b/tests/unit/test_install/test_installer.py @@ -338,9 +338,9 @@ def test_data_invalid_scheme_key(wheel_contents, wheel, installed_wheel): @pytest.mark.parametrize("ep_spec", ("foo", "foo.bar")) def test_invalid_entry_points(ep_spec, wheel_contents, wheel, installed_wheel): contents = wheel_contents() - contents[ - "foo-1.0.dist-info/entry_points.txt" - ] = f"[console_scripts]\nbar = {ep_spec}\n" + contents["foo-1.0.dist-info/entry_points.txt"] = ( + f"[console_scripts]\nbar = {ep_spec}\n" + ) with pytest.raises(ValueError, match="Invalid entry_points specification"): install_wheel( wheel(contents=contents), destdir=installed_wheel().destdir @@ -414,9 +414,9 @@ def test_installation_filelist( strip_dist_info, wheel_contents, wheel, installed_wheel ): contents = wheel_contents() - contents[ - "foo-1.0.dist-info/entry_points.txt" - ] = "[console_scripts]\nbar = foo:main\n" + contents["foo-1.0.dist-info/entry_points.txt"] = ( + "[console_scripts]\nbar = foo:main\n" + ) dest_wheel = installed_wheel() kwargs = {"destdir": dest_wheel.destdir} @@ -552,9 +552,9 @@ def test_entry_points_scripts( "pyproject_installer.install_cmd._install.sys.executable", sys_exec ) contents = wheel_contents() - contents[ - "foo-1.0.dist-info/entry_points.txt" - ] = "[console_scripts]\nbar = foo:main\n" + contents["foo-1.0.dist-info/entry_points.txt"] = ( + "[console_scripts]\nbar = foo:main\n" + ) dest_wheel = installed_wheel() diff --git a/tests/unit/test_run/test_env.py b/tests/unit/test_run/test_env.py index 0ede743..b8ca17f 100644 --- a/tests/unit/test_run/test_env.py +++ b/tests/unit/test_run/test_env.py @@ -52,9 +52,9 @@ def main(): print("Hello, World! ({script_name})") """ ) - contents[ - f"{contents.distinfo}/entry_points.txt" - ] = f"[console_scripts]\n{script_name} = {distr}:main\n" + contents[f"{contents.distinfo}/entry_points.txt"] = ( + f"[console_scripts]\n{script_name} = {distr}:main\n" + ) return wheel(name=f"{distr}-1.0-py3-none-any.whl", contents=contents) diff --git a/tools/vendored.py b/tools/vendored.py index 933c71a..798012b 100644 --- a/tools/vendored.py +++ b/tools/vendored.py @@ -13,6 +13,7 @@ - packaging: https://github.com/pypa/packaging git diff 23.1:src/packaging @:src/pyproject_installer/_vendor/packaging """ + from pathlib import Path import sys import subprocess