summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernát Gábor <gaborjbernat@gmail.com>2022-12-29 20:25:07 -0800
committerGitHub <noreply@github.com>2022-12-29 20:25:07 -0800
commite7fa1c2b4bbbe7495077e5f2146dca9c369b08d7 (patch)
tree4262eb520549529a7f5275e82fdf4cb4baf593aa
parent95a57f2ab796c22ab8c0644ba6f9334fe5d5ca67 (diff)
downloadvirtualenv-e7fa1c2b4bbbe7495077e5f2146dca9c369b08d7.tar.gz
Move to hatchling, drop 3.6 support (#2474)
-rw-r--r--.coveragerc30
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md2
-rw-r--r--.github/workflows/check.yml19
-rw-r--r--.gitignore1
-rw-r--r--.markdownlint.yaml10
-rw-r--r--.pre-commit-config.yaml143
-rw-r--r--MANIFEST.in11
-rw-r--r--docs/_static/custom.css43
-rw-r--r--docs/conf.py2
-rw-r--r--docs/development.rst2
-rw-r--r--docs/installation.rst13
-rw-r--r--docs/render_cli.py8
-rw-r--r--pyproject.toml152
-rw-r--r--setup.cfg117
-rw-r--r--setup.py12
-rw-r--r--src/virtualenv/activation/activator.py2
-rw-r--r--src/virtualenv/activation/via_template.py7
-rw-r--r--src/virtualenv/app_data/base.py12
-rw-r--r--src/virtualenv/create/creator.py6
-rw-r--r--src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py6
-rw-r--r--src/virtualenv/create/via_global_ref/builtin/ref.py2
-rw-r--r--src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py6
-rw-r--r--src/virtualenv/discovery/windows/__init__.py3
-rw-r--r--src/virtualenv/seed/embed/via_app_data/pip_install/base.py4
-rw-r--r--src/virtualenv/seed/seeder.py2
-rw-r--r--src/virtualenv/seed/wheels/embed/__init__.py7
-rw-r--r--src/virtualenv/util/lock.py6
-rw-r--r--tasks/upgrade_wheels.py2
-rw-r--r--tests/integration/test_run_int.py3
-rw-r--r--tests/unit/config/test___main__.py2
-rw-r--r--tests/unit/create/test_creator.py14
-rw-r--r--tests/unit/discovery/test_discovery.py4
-rw-r--r--tests/unit/seed/wheels/test_acquire.py8
-rw-r--r--tests/unit/seed/wheels/test_bundle.py4
-rw-r--r--tests/unit/seed/wheels/test_periodic_update.py40
-rw-r--r--tox.ini117
-rw-r--r--whitelist.txt1
37 files changed, 404 insertions, 419 deletions
diff --git a/.coveragerc b/.coveragerc
deleted file mode 100644
index a4238c9..0000000
--- a/.coveragerc
+++ /dev/null
@@ -1,30 +0,0 @@
-[coverage:report]
-show_missing = True
-exclude_lines =
- \#\s*pragma: no cover
- ^\s*raise AssertionError\b
- ^\s*raise NotImplementedError\b
- ^\s*raise$
- ^if __name__ == ['"]__main__['"]:$
-omit =
- # site.py is ran before the coverage can be enabled, no way to measure coverage on this
- src/virtualenv/create/via_global_ref/builtin/python2/site.py
- src/virtualenv/create/via_global_ref/_virtualenv.py
- src/virtualenv/activation/python/activate_this.py
- src/virtualenv/seed/wheels/embed/pip-*.whl/*
-
-[coverage:paths]
-source =
- src
- .tox/*/lib/python*/site-packages
- .tox/pypy*/site-packages
- .tox\*\Lib\site-packages
- .tox\py\site-packages
- **/src
- **\src
-
-[coverage:run]
-branch = false
-parallel = true
-source =
- ${_COVERAGE_SRC}
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 4a6aabd..ce11674 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
-### Thanks for contributing, make sure you address all the checklists (for details on how see [development documentation](https://virtualenv.pypa.io/en/latest/development.html#development))!
+### Thanks for contributing, make sure you address all the checklists (for details on how see [development documentation](https://virtualenv.pypa.io/en/latest/development.html#development))
- [ ] ran the linter to address style issues (`tox -e fix_lint`)
- [ ] wrote descriptive pull request text
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 9640c4e..6507199 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -22,7 +22,6 @@ jobs:
- "3.9"
- "3.8"
- "3.7"
- - "3.6"
- pypy-3.9
- pypy-3.8
- pypy-3.7
@@ -30,8 +29,6 @@ jobs:
- ubuntu-20.04
- macos-12
- windows-2022
- exclude:
- - { os: macos-12, py: "pypy-3.6" } # PyPy 3.6 does not support macOS 11/12
include:
- { os: macos-12, py: "brew@3.9" }
- { os: macos-12, py: "brew@3.8" }
@@ -39,6 +36,7 @@ jobs:
- uses: taiki-e/install-action@cargo-binstall
- name: Install OS dependencies
run: |
+ set -x
for i in 1 2 3; do
echo "try $i" && \
${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install snapd fish csh -y' || true }} && \
@@ -46,6 +44,7 @@ jobs:
${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \
${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \
exit 0 || true;
+ sleep 1
done
exit 1
shell: bash
@@ -53,6 +52,13 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
+ - name: Install tox
+ run: python -m pip install tox pip -U
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Use local virtualenv for tox
+ run: python -m pip install .
- name: Install Python 2 for cross test
uses: actions/setup-python@v4
with:
@@ -78,13 +84,6 @@ jobs:
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler:
file_handler.write(env)
shell: python
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - name: Install tox
- run: python -m pip install tox
- - name: Use local virtualenv for tox
- run: python -m pip install .
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
diff --git a/.gitignore b/.gitignore
index f8aceb2..b799ed2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,7 +22,6 @@ dist
/pip-wheel-metadata
/src/virtualenv/version.py
/src/virtualenv/out
-venv*
.python-version
*wheel-store*
diff --git a/.markdownlint.yaml b/.markdownlint.yaml
new file mode 100644
index 0000000..33a1615
--- /dev/null
+++ b/.markdownlint.yaml
@@ -0,0 +1,10 @@
+MD013:
+ code_blocks: false
+ headers: false
+ line_length: 120
+ tables: false
+
+MD046:
+ style: fenced
+no-emphasis-as-header: false
+first-line-h1: false
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 45e60a1..90440e6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,64 +1,81 @@
repos:
-- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.3.0
- hooks:
- - id: check-ast
- - id: check-builtin-literals
- - id: check-docstring-first
- - id: check-merge-conflict
- - id: check-yaml
- - id: check-toml
- - id: debug-statements
- - id: end-of-file-fixer
- - id: trailing-whitespace
-- repo: https://github.com/asottile/pyupgrade
- rev: v3.2.1
- hooks:
- - id: pyupgrade
- args: ["--py36-plus"]
- exclude: "^(src/virtualenv/create/via_global_ref/_virtualenv.py|src/virtualenv/create/via_global_ref/builtin/python2/site.py|src/virtualenv/discovery/py_info.py|tasks/__main__zipapp.py)$"
-- repo: https://github.com/asottile/pyupgrade
- rev: v2.38.4
- hooks:
- - id: pyupgrade
- files: "^(src/virtualenv/create/via_global_ref/_virtualenv.py|src/virtualenv/create/via_global_ref/builtin/python2/site.py|src/virtualenv/discovery/py_info.py|tasks/__main__zipapp.py)$"
-- repo: https://github.com/PyCQA/isort
- rev: 5.10.1
- hooks:
- - id: isort
-- repo: https://github.com/psf/black
- rev: 22.10.0
- hooks:
- - id: black
- args: [--safe]
-- repo: https://github.com/asottile/blacken-docs
- rev: v1.12.1
- hooks:
- - id: blacken-docs
- additional_dependencies: [black==22.10]
-- repo: https://github.com/pre-commit/pygrep-hooks
- rev: v1.9.0
- hooks:
- - id: rst-backticks
-- repo: https://github.com/tox-dev/tox-ini-fmt
- rev: "0.5.2"
- hooks:
- - id: tox-ini-fmt
- args: ["-p", "fix_lint"]
-- repo: https://github.com/asottile/setup-cfg-fmt
- rev: v2.2.0
- hooks:
- - id: setup-cfg-fmt
- args: [--min-py3-version, "3.6 ", "--max-py-version", "3.10"]
-- repo: https://github.com/PyCQA/flake8
- rev: "5.0.4"
- hooks:
- - id: flake8
- additional_dependencies:
- - flake8-bugbear==22.10.27
- - flake8-comprehensions==3.10.1
- - flake8-pytest-style==1.6
- - flake8-spellcheck==0.28
- - flake8-unused-arguments==0.0.12
- - flake8-noqa==1.3
- - pep8-naming==0.13.2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.4.0
+ hooks:
+ - id: check-ast
+ - id: check-builtin-literals
+ - id: check-docstring-first
+ - id: check-merge-conflict
+ - id: check-yaml
+ - id: check-toml
+ - id: debug-statements
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - repo: https://github.com/asottile/add-trailing-comma
+ rev: v2.4.0
+ hooks:
+ - id: add-trailing-comma
+ args: [--py36-plus]
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v3.2.1
+ hooks:
+ - id: pyupgrade
+ args: ["--py37-plus"]
+ exclude: "^(src/virtualenv/create/via_global_ref/_virtualenv.py|src/virtualenv/create/via_global_ref/builtin/python2/site.py|src/virtualenv/discovery/py_info.py|tasks/__main__zipapp.py)$"
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v2.38.4
+ hooks:
+ - id: pyupgrade
+ files: "^(src/virtualenv/create/via_global_ref/_virtualenv.py|src/virtualenv/create/via_global_ref/builtin/python2/site.py|src/virtualenv/discovery/py_info.py|tasks/__main__zipapp.py)$"
+ - repo: https://github.com/PyCQA/isort
+ rev: 5.11.4
+ hooks:
+ - id: isort
+ - repo: https://github.com/psf/black
+ rev: 22.12.0
+ hooks:
+ - id: black
+ args: [--safe]
+ - repo: https://github.com/asottile/blacken-docs
+ rev: v1.12.1
+ hooks:
+ - id: blacken-docs
+ additional_dependencies: [black==22.12]
+ - repo: https://github.com/pre-commit/pygrep-hooks
+ rev: v1.9.0
+ hooks:
+ - id: rst-backticks
+ - repo: https://github.com/tox-dev/tox-ini-fmt
+ rev: "0.5.2"
+ hooks:
+ - id: tox-ini-fmt
+ args: ["-p", "fix"]
+ - repo: https://github.com/PyCQA/flake8
+ rev: 6.0.0
+ hooks:
+ - id: flake8
+ additional_dependencies:
+ - flake8-bugbear==22.12.6
+ - flake8-comprehensions==3.10.1
+ - flake8-pytest-style==1.6
+ - flake8-spellcheck==0.28
+ - flake8-unused-arguments==0.0.12
+ - flake8-noqa==1.3
+ - pep8-naming==0.13.3
+ - flake8-pyproject==1.2.2
+ - repo: https://github.com/pre-commit/mirrors-prettier
+ rev: "v2.7.1"
+ hooks:
+ - id: prettier
+ additional_dependencies:
+ - prettier@3.0.0-alpha.4
+ - "@prettier/plugin-xml@2.2"
+ args: ["--print-width=120", "--prose-wrap=always"]
+ - repo: https://github.com/igorshubovych/markdownlint-cli
+ rev: v0.32.2
+ hooks:
+ - id: markdownlint
+ - repo: meta
+ hooks:
+ - id: check-hooks-apply
+ - id: check-useless-excludes
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index b8959cf..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,11 +0,0 @@
-# setuptools-scm by default adds all SCM tracked files, we prune the following maintenance related ones (sdist only)
-exclude .gitattributes
-exclude .gitignore
-exclude .github/*
-
-exclude azure-pipelines.yml
-exclude readthedocs.yml
-exclude MANIFEST.in
-
-exclude tasks/release.py
-exclude tasks/upgrade_wheels.py
diff --git a/docs/_static/custom.css b/docs/_static/custom.css
index 7efa026..6893373 100644
--- a/docs/_static/custom.css
+++ b/docs/_static/custom.css
@@ -1,64 +1,65 @@
.wy-nav-content {
- padding: 1em;
+ padding: 1em;
}
#virtualenv img {
- margin-bottom: 6px;
+ margin-bottom: 6px;
}
/* Allow table content to wrap around */
-.wy-table-responsive table th, .wy-table-responsive table td {
- /* !important because RTD has conflicting stylesheets */
- white-space: normal !important;
- padding: 8px 6px !important;
+.wy-table-responsive table th,
+.wy-table-responsive table td {
+ /* !important because RTD has conflicting stylesheets */
+ white-space: normal !important;
+ padding: 8px 6px !important;
}
.wy-table-responsive table {
- width: 100%;
- margin-left: 0 !important;
+ width: 100%;
+ margin-left: 0 !important;
}
.rst-content table.docutils td ol {
- margin-bottom: 0;
+ margin-bottom: 0;
}
.rst-content table.docutils td ul {
- margin-bottom: 0;
+ margin-bottom: 0;
}
.rst-content table.docutils td p {
- margin-bottom: 0;
+ margin-bottom: 0;
}
div[class*="highlight-"] {
- margin-bottom: 12px;
+ margin-bottom: 12px;
}
/* Tweak whitespace on the release history page */
#release-history p {
- margin-bottom: 0;
- margin-top: 0;
+ margin-bottom: 0;
+ margin-top: 0;
}
#release-history h3 {
- margin-bottom: 6px;
+ margin-bottom: 6px;
}
#release-history ul {
- margin-bottom: 12px;
+ margin-bottom: 12px;
}
#release-history ul ul {
- margin-bottom: 0;
- margin-top: 0;
+ margin-bottom: 0;
+ margin-top: 0;
}
#release-history h2 {
- margin-bottom: 12px;
+ margin-bottom: 12px;
}
/* Reduce whitespace on the inline-code snippets and add softer corners */
.rst-content code {
- padding: 2px 3px;
- border-radius: 3px;
+ padding: 2px 3px;
+ border-radius: 3px;
}
diff --git a/docs/conf.py b/docs/conf.py
index 0f39331..26fef79 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -62,7 +62,7 @@ def generate_draft_news():
new = subprocess.check_output(
[sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"],
cwd=root,
- universal_newlines=True,
+ text=True,
)
dest = root / "docs" / "_draft.rst"
dest.write_text("" if "No significant changes" in new else new)
diff --git a/docs/development.rst b/docs/development.rst
index 36d8cba..ef5b75e 100644
--- a/docs/development.rst
+++ b/docs/development.rst
@@ -83,7 +83,7 @@ run:
.. code-block:: console
- tox -e fix_lint
+ tox -e fix
.. note::
diff --git a/docs/installation.rst b/docs/installation.rst
index 57e57d9..eebac4d 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -64,13 +64,6 @@ supporting Python 2.7 use
If you are looking for past version of virtualenv.pyz they are available here:
https://github.com/pypa/get-virtualenv/blob/<virtualenv version>/public/<python version>/virtualenv.pyz?raw=true
-via ``setup.py``
-----------------
-We don't recommend and officially support this method. One should prefer using an installer that supports
-`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`_ interface, such as pip ``19.0.0`` or later. That being said you
-might be able to still install a package via this method if you satisfy build dependencies before calling the install
-command (as described under :ref:`sdist`).
-
latest unreleased
-----------------
Installing an unreleased version is discouraged and should be only done for testing purposes. If you do so you'll need
@@ -88,8 +81,8 @@ Python and OS Compatibility
virtualenv works with the following Python interpreter implementations:
-- `CPython <https://www.python.org/>`_ versions 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10
-- `PyPy <https://pypy.org/>`_ 2.7, 3.6, 3.7, 3.8, 3.9
+- `CPython <https://www.python.org/>`_ versions 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
+- `PyPy <https://pypy.org/>`_ 3.7, 3.8, 3.9
This means virtualenv works on the latest patch version of each of these minor versions. Previous patch versions are
supported on a best effort approach.
@@ -97,7 +90,7 @@ supported on a best effort approach.
CPython is shipped in multiple forms, and each OS repackages it, often applying some customization along the way.
Therefore we cannot say universally that we support all platforms, but rather specify some we test against. In case
of ones not specified here the support is unknown, though likely will work. If you find some cases please open a feature
-request on our issue tracker. Note, as of ``20.16.0`` we no longer support running under Python less than 3.6, however
+request on our issue tracker. Note, as of ``20.18.0`` we no longer support running under Python less than 3.7, however
we still support creating environments for 2.7 and 3.5.
Linux
diff --git a/docs/render_cli.py b/docs/render_cli.py
index e45a37e..ca75e41 100644
--- a/docs/render_cli.py
+++ b/docs/render_cli.py
@@ -76,12 +76,16 @@ class CliTable(SphinxDirective):
return True
elif key == "creator":
if name == "venv":
- from virtualenv.create.via_global_ref.venv import ViaGlobalRefMeta
+ from virtualenv.create.via_global_ref.venv import (
+ ViaGlobalRefMeta,
+ )
meta = ViaGlobalRefMeta()
meta.symlink_error = None
return meta
- from virtualenv.create.via_global_ref.builtin.via_global_self_do import BuiltinViaGlobalRefMeta
+ from virtualenv.create.via_global_ref.builtin.via_global_self_do import (
+ BuiltinViaGlobalRefMeta,
+ )
meta = BuiltinViaGlobalRefMeta()
meta.symlink_error = None
diff --git a/pyproject.toml b/pyproject.toml
index b7a7ad8..053fc2a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,18 +1,146 @@
[build-system]
-requires = [
- "setuptools>=59.6",
- "setuptools-scm>=6.4.2",
+build-backend = "hatchling.build"
+requires = ["hatch-vcs>=0.3", "hatchling>=1.11.1"]
+
+[project]
+name = "virtualenv"
+description = "Virtual Python Environment builder"
+readme = "README.md"
+license = "MIT"
+maintainers = [{ name = "Bernat Gabor", email = "gaborjbernat@gmail.com" }]
+urls.Documentation = "https://virtualenv.pypa.io"
+urls.Homepage = "https://github.com/pypa/virtualenv"
+urls.Source = "https://github.com/pypa/virtualenv"
+urls.Tracker = "https://github.com/pypa/virtualenv/issues"
+scripts.virtualenv = "virtualenv.__main__:run_with_catch"
+requires-python = ">=3.7"
+dependencies = [
+ "distlib<1,>=0.3.6",
+ "filelock<4,>=3.4.1",
+ 'importlib-metadata>=4.8.3; python_version < "3.8"',
+ "platformdirs<3,>=2.4",
+]
+optional-dependencies.test = [
+ "covdefaults>=2.2.2",
+ "coverage>=7.0.1",
+ "coverage-enable-subprocess>=1",
+ "flaky>=3.7",
+ "packaging>=22",
+ "pytest>=7.2",
+ "pytest-env>=0.8.1",
+ "pytest-freezegun>=0.4.2",
+ "pytest-mock>=3.10",
+ "pytest-randomly>=3.12",
+ "pytest-timeout>=2.1",
+]
+optional-dependencies.docs = [
+ "proselint>=0.13",
+ "sphinx>=5.3",
+ "sphinx-argparse>=0.4",
+ "sphinx-rtd-theme>=1.1.1",
+ "towncrier>=22.12",
+]
+keywords = ["environments", "isolated", "virtual"]
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: MacOS :: MacOS X",
+ "Operating System :: Microsoft :: Windows",
+ "Operating System :: POSIX",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+ "Topic :: Software Development :: Libraries",
+ "Topic :: Software Development :: Testing",
+ "Topic :: Utilities",
+]
+dynamic = ["version"]
+
+[project.entry-points."virtualenv.activate"]
+bash = "virtualenv.activation.bash:BashActivator"
+batch = "virtualenv.activation.batch:BatchActivator"
+cshell = "virtualenv.activation.cshell:CShellActivator"
+fish = "virtualenv.activation.fish:FishActivator"
+nushell = "virtualenv.activation.nushell:NushellActivator"
+powershell = "virtualenv.activation.powershell:PowerShellActivator"
+python = "virtualenv.activation.python:PythonActivator"
+
+[project.entry-points."virtualenv.create"]
+cpython2-mac-arm-framework = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython2macOsArmFramework"
+cpython2-mac-framework = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython2macOsFramework"
+cpython2-posix = "virtualenv.create.via_global_ref.builtin.cpython.cpython2:CPython2Posix"
+cpython2-win = "virtualenv.create.via_global_ref.builtin.cpython.cpython2:CPython2Windows"
+cpython3-mac-framework = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython3macOsFramework"
+cpython3-posix = "virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Posix"
+cpython3-win = "virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Windows"
+pypy2-posix = "virtualenv.create.via_global_ref.builtin.pypy.pypy2:PyPy2Posix"
+pypy2-win = "virtualenv.create.via_global_ref.builtin.pypy.pypy2:Pypy2Windows"
+pypy3-posix = "virtualenv.create.via_global_ref.builtin.pypy.pypy3:PyPy3Posix"
+pypy3-win = "virtualenv.create.via_global_ref.builtin.pypy.pypy3:Pypy3Windows"
+venv = "virtualenv.create.via_global_ref.venv:Venv"
+
+[project.entry-points."virtualenv.discovery"]
+builtin = "virtualenv.discovery.builtin:Builtin"
+
+[project.entry-points."virtualenv.seed"]
+app-data = "virtualenv.seed.embed.via_app_data.via_app_data:FromAppData"
+pip = "virtualenv.seed.embed.pip_invoke:PipInvoke"
+
+[tool.hatch]
+build.hooks.vcs.version-file = "src/virtualenv/version.py"
+build.targets.sdist.include = ["/src", "/tests"]
+version.source = "vcs"
+
+[tool.coverage]
+html.show_contexts = true
+html.skip_covered = false
+report.omit = [
+ # site.py is ran before the coverage can be enabled, no way to measure coverage on this
+ "src/virtualenv/create/via_global_ref/builtin/python2/site.py",
+ "src/virtualenv/create/via_global_ref/_virtualenv.py",
+ "src/virtualenv/activation/python/activate_this.py",
+ "src/virtualenv/seed/wheels/embed/pip-*.whl/*",
+]
+paths.source = [
+ "src",
+ ".tox/*/lib/*/site-packages", # pypy3.8 + cpython
+ ".tox/*/site-packages", # pypy3.7
+ ".tox\\*\\Lib\\site-packages", # pypy3.8 + cpython
+ ".tox\\*\\site-packages", # pypy3.7
]
-build-backend = 'setuptools.build_meta'
+paths.other = [".", "*/virtualenv", "*\\virtualenv"]
+report.fail_under = 76
+run.source = ["${_COVERAGE_SRC}", "tests"]
+run.dynamic_context = "test_function"
+run.parallel = true
+run.plugins = ["covdefaults"]
[tool.black]
line-length = 120
-[tool.towncrier]
-package = "virtualenv"
-package_dir = "" # we purposfully do not set this as src, forcing import from site-package that has version.py
-filename = "docs/changelog.rst"
-directory = "docs/changelog"
-title_format = false
-issue_format = "`#{issue} <https://github.com/pypa/virtualenv/issues/{issue}>`_"
-template = "docs/changelog/template.jinja2"
+[tool.isort]
+profile = "black"
+known_first_party = ["virtualenv"]
+
+[tool.pep8]
+max-line-length = "120"
+
+[tool.flake8]
+max-complexity = 22
+max-line-length = 120
+unused-arguments-ignore-abstract-functions = true
+noqa-require-code = true
+dictionaries = ["en_US", "python", "technical", "django"]
+ignore = [
+ "E203", # whitespace before ':'
+ "C901", # is too complex
+ "W503", # line break before binary operator
+]
+
+[tool.pytest.ini_options]
+markers = ["slow"]
+timeout = 600
+addopts = "--tb=auto -ra --showlocals --no-success-flaky-report"
+env = ["PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command", "PYTHONIOENCODING=utf-8"]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 2b75406..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,117 +0,0 @@
-[metadata]
-name = virtualenv
-description = Virtual Python Environment builder
-long_description = file: README.md
-long_description_content_type = text/markdown
-url = https://virtualenv.pypa.io/
-author = Bernat Gabor
-author_email = gaborjbernat@gmail.com
-maintainer = Bernat Gabor
-maintainer_email = gaborjbernat@gmail.com
-license = MIT
-license_file = LICENSE
-platforms = any
-classifiers =
- Development Status :: 5 - Production/Stable
- Intended Audience :: Developers
- License :: OSI Approved :: MIT License
- Operating System :: MacOS :: MacOS X
- Operating System :: Microsoft :: Windows
- Operating System :: POSIX
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3 :: Only
- Programming Language :: Python :: Implementation :: CPython
- Programming Language :: Python :: Implementation :: PyPy
- Topic :: Software Development :: Libraries
- Topic :: Software Development :: Testing
- Topic :: Utilities
-keywords = virtual, environments, isolated
-project_urls =
- Source=https://github.com/pypa/virtualenv
- Tracker=https://github.com/pypa/virtualenv/issues
-
-[options]
-packages = find:
-install_requires =
- distlib>=0.3.6,<1
- filelock>=3.4.1,<4
- platformdirs>=2.4,<3
- importlib-metadata>=4.8.3;python_version < "3.8"
- importlib-resources>=5.4;python_version < "3.7"
-python_requires = >=3.6
-package_dir =
- =src
-zip_safe = True
-
-[options.packages.find]
-where = src
-
-[options.entry_points]
-console_scripts =
- virtualenv=virtualenv.__main__:run_with_catch
-virtualenv.activate =
- bash = virtualenv.activation.bash:BashActivator
- cshell = virtualenv.activation.cshell:CShellActivator
- batch = virtualenv.activation.batch:BatchActivator
- fish = virtualenv.activation.fish:FishActivator
- powershell = virtualenv.activation.powershell:PowerShellActivator
- python = virtualenv.activation.python:PythonActivator
- nushell = virtualenv.activation.nushell:NushellActivator
-virtualenv.create =
- venv = virtualenv.create.via_global_ref.venv:Venv
- cpython3-posix = virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Posix
- cpython3-win = virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Windows
- cpython2-posix = virtualenv.create.via_global_ref.builtin.cpython.cpython2:CPython2Posix
- cpython2-mac-framework = virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython2macOsFramework
- cpython2-mac-arm-framework = virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython2macOsArmFramework
- cpython3-mac-framework = virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython3macOsFramework
- cpython2-win = virtualenv.create.via_global_ref.builtin.cpython.cpython2:CPython2Windows
- pypy2-posix = virtualenv.create.via_global_ref.builtin.pypy.pypy2:PyPy2Posix
- pypy2-win = virtualenv.create.via_global_ref.builtin.pypy.pypy2:Pypy2Windows
- pypy3-posix = virtualenv.create.via_global_ref.builtin.pypy.pypy3:PyPy3Posix
- pypy3-win = virtualenv.create.via_global_ref.builtin.pypy.pypy3:Pypy3Windows
-virtualenv.discovery =
- builtin = virtualenv.discovery.builtin:Builtin
-virtualenv.seed =
- pip = virtualenv.seed.embed.pip_invoke:PipInvoke
- app-data = virtualenv.seed.embed.via_app_data.via_app_data:FromAppData
-
-[options.extras_require]
-docs =
- proselint>=0.13
- sphinx>=5.3
- sphinx-argparse>=0.3.2
- sphinx-rtd-theme>=1
- towncrier>=22.8
-testing =
- coverage>=6.2
- coverage-enable-subprocess>=1
- flaky>=3.7
- packaging>=21.3
- pytest>=7.0.1
- pytest-env>=0.6.2
- pytest-freezegun>=0.4.2
- pytest-mock>=3.6.1
- pytest-randomly>=3.10.3
- pytest-timeout>=2.1
-
-[options.package_data]
-virtualenv.activation.bash = *.sh
-virtualenv.activation.batch = *.bat
-virtualenv.activation.cshell = *.csh
-virtualenv.activation.fish = *.fish
-virtualenv.activation.nushell = *.nu
-virtualenv.activation.powershell = *.ps1
-virtualenv.seed.wheels.embed = *.whl
-
-[sdist]
-formats = gztar
-
-[tool:pytest]
-markers =
- slow
-junit_family = xunit2
-addopts = --tb=auto -ra --showlocals --no-success-flaky-report
-env =
- PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command
- PYTHONIOENCODING=utf-8
diff --git a/setup.py b/setup.py
deleted file mode 100644
index cddd1d3..0000000
--- a/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from setuptools import __version__, setup
-
-if int(__version__.split(".")[0]) < 41:
- raise RuntimeError("setuptools >= 41 required to build")
-
-setup(
- use_scm_version={
- "write_to": "src/virtualenv/version.py",
- "write_to_template": 'from __future__ import unicode_literals\n\n__version__ = "{version}"\n',
- },
- setup_requires=["setuptools_scm >= 2"],
-)
diff --git a/src/virtualenv/activation/activator.py b/src/virtualenv/activation/activator.py
index 99f2803..10b1cf7 100644
--- a/src/virtualenv/activation/activator.py
+++ b/src/virtualenv/activation/activator.py
@@ -31,7 +31,7 @@ class Activator(metaclass=ABCMeta):
"""
@abstractmethod
- def generate(self, creator): # noqa: U100
+ def generate(self, creator):
"""Generate activate script for the given creator.
:param creator: the creator (based of :class:`virtualenv.create.creator.Creator`) we used to create this \
diff --git a/src/virtualenv/activation/via_template.py b/src/virtualenv/activation/via_template.py
index f1eef53..069d52e 100644
--- a/src/virtualenv/activation/via_template.py
+++ b/src/virtualenv/activation/via_template.py
@@ -4,11 +4,8 @@ from abc import ABCMeta, abstractmethod
from .activator import Activator
-if sys.version_info >= (3, 10) or sys.version_info <= (3, 7):
- if sys.version_info >= (3, 10):
- from importlib.resources import files
- else:
- from importlib_resources import files
+if sys.version_info >= (3, 10):
+ from importlib.resources import files
def read_binary(module_name: str, filename: str) -> bytes:
return (files(module_name) / filename).read_bytes()
diff --git a/src/virtualenv/app_data/base.py b/src/virtualenv/app_data/base.py
index ecaee78..bc28b23 100644
--- a/src/virtualenv/app_data/base.py
+++ b/src/virtualenv/app_data/base.py
@@ -20,7 +20,7 @@ class AppData(metaclass=ABCMeta):
"""called when the user passes in the reset app data"""
@abstractmethod
- def py_info(self, path): # noqa: U100
+ def py_info(self, path):
raise NotImplementedError
@abstractmethod
@@ -32,7 +32,7 @@ class AppData(metaclass=ABCMeta):
raise NotImplementedError
@abstractmethod
- def embed_update_log(self, distribution, for_py_version): # noqa: U100
+ def embed_update_log(self, distribution, for_py_version):
raise NotImplementedError
@property
@@ -44,7 +44,7 @@ class AppData(metaclass=ABCMeta):
raise NotImplementedError
@abstractmethod
- def wheel_image(self, for_py_version, name): # noqa: U100
+ def wheel_image(self, for_py_version, name):
raise NotImplementedError
@contextmanager
@@ -58,12 +58,12 @@ class AppData(metaclass=ABCMeta):
@abstractmethod
@contextmanager
- def extract(self, path, to_folder): # noqa: U100
+ def extract(self, path, to_folder):
raise NotImplementedError
@abstractmethod
@contextmanager
- def locked(self, path): # noqa: U100
+ def locked(self, path):
raise NotImplementedError
@@ -77,7 +77,7 @@ class ContentStore(metaclass=ABCMeta):
raise NotImplementedError
@abstractmethod
- def write(self, content): # noqa: U100
+ def write(self, content):
raise NotImplementedError
@abstractmethod
diff --git a/src/virtualenv/create/creator.py b/src/virtualenv/create/creator.py
index 5ea6abe..a973264 100644
--- a/src/virtualenv/create/creator.py
+++ b/src/virtualenv/create/creator.py
@@ -128,11 +128,7 @@ class Creator(metaclass=ABCMeta):
value = Path(raw_value)
if value.exists() and value.is_file():
raise ArgumentTypeError(f"the destination {value} already exists and is a file")
- if sys.version_info <= (3, 6):
- # pre 3.6 resolve is always strict, aka must exists, sidestep by using os.path operation
- dest = Path(os.path.realpath(raw_value))
- else:
- dest = Path(os.path.abspath(str(value))).resolve() # on Windows absolute does not imply resolve so use both
+ dest = Path(os.path.abspath(str(value))).resolve() # on Windows absolute does not imply resolve so use both
value = dest
while dest:
if dest.exists():
diff --git a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py
index 9fc2550..d23f53b 100644
--- a/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py
+++ b/src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py
@@ -7,7 +7,11 @@ from abc import ABCMeta, abstractmethod
from pathlib import Path
from textwrap import dedent
-from virtualenv.create.via_global_ref.builtin.ref import ExePathRefToDest, PathRefToDest, RefMust
+from virtualenv.create.via_global_ref.builtin.ref import (
+ ExePathRefToDest,
+ PathRefToDest,
+ RefMust,
+)
from virtualenv.info import IS_MAC_ARM64
from .common import CPython, CPythonPosix, is_mac_os_framework
diff --git a/src/virtualenv/create/via_global_ref/builtin/ref.py b/src/virtualenv/create/via_global_ref/builtin/ref.py
index 60d97b3..fb1cf2e 100644
--- a/src/virtualenv/create/via_global_ref/builtin/ref.py
+++ b/src/virtualenv/create/via_global_ref/builtin/ref.py
@@ -78,7 +78,7 @@ class PathRef(metaclass=ABCMeta):
return self._can_symlink
@abstractmethod
- def run(self, creator, symlinks): # noqa: U100
+ def run(self, creator, symlinks):
raise NotImplementedError
def method(self, symlinks):
diff --git a/src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py b/src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py
index d00ee45..d57235c 100644
--- a/src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py
+++ b/src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py
@@ -1,6 +1,10 @@
from abc import ABCMeta
-from virtualenv.create.via_global_ref.builtin.ref import ExePathRefToDest, RefMust, RefWhen
+from virtualenv.create.via_global_ref.builtin.ref import (
+ ExePathRefToDest,
+ RefMust,
+ RefWhen,
+)
from virtualenv.util.path import ensure_dir
from ..api import ViaGlobalRefApi, ViaGlobalRefMeta
diff --git a/src/virtualenv/discovery/windows/__init__.py b/src/virtualenv/discovery/windows/__init__.py
index 4663a3a..71d82ce 100644
--- a/src/virtualenv/discovery/windows/__init__.py
+++ b/src/virtualenv/discovery/windows/__init__.py
@@ -14,7 +14,8 @@ def propose_interpreters(spec, cache_dir, env):
# and prefer PythonCore over conda pythons (as virtualenv is mostly used by non conda tools)
existing = list(discover_pythons())
existing.sort(
- key=lambda i: tuple(-1 if j is None else j for j in i[1:4]) + (1 if i[0] == "PythonCore" else 0,), reverse=True
+ key=lambda i: tuple(-1 if j is None else j for j in i[1:4]) + (1 if i[0] == "PythonCore" else 0,),
+ reverse=True,
)
for name, major, minor, arch, exe, _ in existing:
diff --git a/src/virtualenv/seed/embed/via_app_data/pip_install/base.py b/src/virtualenv/seed/embed/via_app_data/pip_install/base.py
index 0640929..3c44b77 100644
--- a/src/virtualenv/seed/embed/via_app_data/pip_install/base.py
+++ b/src/virtualenv/seed/embed/via_app_data/pip_install/base.py
@@ -23,7 +23,7 @@ class PipInstall(metaclass=ABCMeta):
self._console_entry_points = None
@abstractmethod
- def _sync(self, src, dst): # noqa: U100
+ def _sync(self, src, dst):
raise NotImplementedError
def install(self, version_info):
@@ -108,7 +108,7 @@ class PipInstall(metaclass=ABCMeta):
return self.__dist_info
@abstractmethod
- def _fix_records(self, extra_record_data): # noqa: U100
+ def _fix_records(self, extra_record_data):
raise NotImplementedError
@property
diff --git a/src/virtualenv/seed/seeder.py b/src/virtualenv/seed/seeder.py
index 0d26bd0..d06d1a0 100644
--- a/src/virtualenv/seed/seeder.py
+++ b/src/virtualenv/seed/seeder.py
@@ -25,7 +25,7 @@ class Seeder(metaclass=ABCMeta):
raise NotImplementedError
@abstractmethod
- def run(self, creator): # noqa: U100
+ def run(self, creator):
"""Perform the seed operation.
:param creator: the creator (based of :class:`virtualenv.create.creator.Creator`) we used to create this \
diff --git a/src/virtualenv/seed/wheels/embed/__init__.py b/src/virtualenv/seed/wheels/embed/__init__.py
index 4d3108e..5e87f75 100644
--- a/src/virtualenv/seed/wheels/embed/__init__.py
+++ b/src/virtualenv/seed/wheels/embed/__init__.py
@@ -4,6 +4,11 @@ from virtualenv.seed.wheels.util import Wheel
BUNDLE_FOLDER = Path(__file__).absolute().parent
BUNDLE_SUPPORT = {
+ "3.12": {
+ "pip": "pip-22.3.1-py3-none-any.whl",
+ "setuptools": "setuptools-65.6.3-py3-none-any.whl",
+ "wheel": "wheel-0.38.4-py3-none-any.whl",
+ },
"3.11": {
"pip": "pip-22.3.1-py3-none-any.whl",
"setuptools": "setuptools-65.6.3-py3-none-any.whl",
@@ -45,7 +50,7 @@ BUNDLE_SUPPORT = {
"wheel": "wheel-0.37.1-py2.py3-none-any.whl",
},
}
-MAX = "3.11"
+MAX = "3.12"
def get_embed_wheel(distribution, for_py_version):
diff --git a/src/virtualenv/util/lock.py b/src/virtualenv/util/lock.py
index 512d1c9..8d7215e 100644
--- a/src/virtualenv/util/lock.py
+++ b/src/virtualenv/util/lock.py
@@ -58,17 +58,17 @@ class PathLockBase(metaclass=ABCMeta):
raise NotImplementedError
@abstractmethod
- def __exit__(self, exc_type, exc_val, exc_tb): # noqa: U100
+ def __exit__(self, exc_type, exc_val, exc_tb):
raise NotImplementedError
@abstractmethod
@contextmanager
- def lock_for_key(self, name, no_block=False): # noqa: U100
+ def lock_for_key(self, name, no_block=False):
raise NotImplementedError
@abstractmethod
@contextmanager
- def non_reentrant_lock_for_key(self, name): # noqa: U100
+ def non_reentrant_lock_for_key(self, name):
raise NotImplementedError
diff --git a/tasks/upgrade_wheels.py b/tasks/upgrade_wheels.py
index 6068180..555f7d2 100644
--- a/tasks/upgrade_wheels.py
+++ b/tasks/upgrade_wheels.py
@@ -15,7 +15,7 @@ from threading import Thread
STRICT = "UPGRADE_ADVISORY" not in os.environ
BUNDLED = ["pip", "setuptools", "wheel"]
-SUPPORT = list(reversed([(2, 7)] + [(3, i) for i in range(5, 12)]))
+SUPPORT = list(reversed([(2, 7)] + [(3, i) for i in range(5, 13)]))
DEST = Path(__file__).resolve().parents[1] / "src" / "virtualenv" / "seed" / "wheels" / "embed"
diff --git a/tests/integration/test_run_int.py b/tests/integration/test_run_int.py
index d41dc1e..8ca310e 100644
--- a/tests/integration/test_run_int.py
+++ b/tests/integration/test_run_int.py
@@ -11,9 +11,8 @@ from virtualenv.util.subprocess import run_cmd
def test_app_data_pinning(tmp_path):
version = "19.1.1" if sys.version_info[0:2] == (3, 4) else "19.3.1"
result = cli_run([str(tmp_path), "--pip", version, "--activators", "", "--seeder", "app-data"])
- code, out, err = run_cmd([str(result.creator.script("pip")), "list", "--disable-pip-version-check"])
+ code, out, _ = run_cmd([str(result.creator.script("pip")), "list", "--disable-pip-version-check"])
assert not code
- assert not err
for line in out.splitlines():
parts = line.split()
if parts and parts[0] == "pip":
diff --git a/tests/unit/config/test___main__.py b/tests/unit/config/test___main__.py
index 5496f2d..f1172a1 100644
--- a/tests/unit/config/test___main__.py
+++ b/tests/unit/config/test___main__.py
@@ -91,7 +91,7 @@ def test_session_report_subprocess(tmp_path):
# when called via a subprocess the logging framework should flush and POSIX line normalization happen
out = check_output(
[sys.executable, "-m", "virtualenv", str(tmp_path), "--activators", "powershell", "--without-pip"],
- universal_newlines=True,
+ text=True,
)
lines = out.split("\n")
regexes = [
diff --git a/tests/unit/create/test_creator.py b/tests/unit/create/test_creator.py
index db323cd..33c8ee1 100644
--- a/tests/unit/create/test_creator.py
+++ b/tests/unit/create/test_creator.py
@@ -222,7 +222,7 @@ def test_create_no_seed(python, creator, isolated, system, coverage_env, special
if CPython3Posix.pyvenv_launch_patch_active(PythonInfo.from_exe(python)) and creator_key != "venv":
result = subprocess.check_output(
[str(creator.exe), "-c", 'import os; print(os.environ.get("__PYVENV_LAUNCHER__"))'],
- universal_newlines=True,
+ text=True,
).strip()
assert result == "None"
@@ -498,7 +498,7 @@ def test_no_preimport_threading(tmp_path):
session = cli_run([str(tmp_path)])
out = subprocess.check_output(
[str(session.creator.exe), "-c", r"import sys; print('\n'.join(sorted(sys.modules)))"],
- universal_newlines=True,
+ text=True,
)
imported = set(out.splitlines())
assert "threading" not in imported
@@ -514,7 +514,7 @@ def test_pth_in_site_vs_python_path(tmp_path):
# verify that test.pth is activated when interpreter is run
out = subprocess.check_output(
[str(session.creator.exe), "-c", r"import sys; print(sys.testpth)"],
- universal_newlines=True,
+ text=True,
)
assert out == "ok\n"
# same with $PYTHONPATH pointing to site_packages
@@ -525,7 +525,7 @@ def test_pth_in_site_vs_python_path(tmp_path):
env["PYTHONPATH"] = os.pathsep.join(path)
out = subprocess.check_output(
[str(session.creator.exe), "-c", r"import sys; print(sys.testpth)"],
- universal_newlines=True,
+ text=True,
env=env,
)
assert out == "ok\n"
@@ -539,7 +539,7 @@ def test_getsitepackages_system_site(tmp_path):
out = subprocess.check_output(
[str(session.creator.exe), "-c", r"import site; print(site.getsitepackages())"],
- universal_newlines=True,
+ text=True,
)
site_packages = ast.literal_eval(out)
@@ -553,7 +553,7 @@ def test_getsitepackages_system_site(tmp_path):
out = subprocess.check_output(
[str(session.creator.exe), "-c", r"import site; print(site.getsitepackages())"],
- universal_newlines=True,
+ text=True,
)
site_packages = [str(Path(i).resolve()) for i in ast.literal_eval(out)]
@@ -578,7 +578,7 @@ def test_get_site_packages(tmp_path):
env_site_packages = [str(session.creator.purelib), str(session.creator.platlib)]
out = subprocess.check_output(
[str(session.creator.exe), "-c", r"import site; print(site.getsitepackages())"],
- universal_newlines=True,
+ text=True,
)
site_packages = ast.literal_eval(out)
diff --git a/tests/unit/discovery/test_discovery.py b/tests/unit/discovery/test_discovery.py
index 458bee6..c4a2cc7 100644
--- a/tests/unit/discovery/test_discovery.py
+++ b/tests/unit/discovery/test_discovery.py
@@ -56,7 +56,7 @@ def test_relative_path(session_app_data, monkeypatch):
def test_discovery_fallback_fail(session_app_data, caplog):
caplog.set_level(logging.DEBUG)
builtin = Builtin(
- Namespace(app_data=session_app_data, try_first_with=[], python=["magic-one", "magic-two"], env=os.environ)
+ Namespace(app_data=session_app_data, try_first_with=[], python=["magic-one", "magic-two"], env=os.environ),
)
result = builtin.run()
@@ -68,7 +68,7 @@ def test_discovery_fallback_fail(session_app_data, caplog):
def test_discovery_fallback_ok(session_app_data, caplog):
caplog.set_level(logging.DEBUG)
builtin = Builtin(
- Namespace(app_data=session_app_data, try_first_with=[], python=["magic-one", sys.executable], env=os.environ)
+ Namespace(app_data=session_app_data, try_first_with=[], python=["magic-one", sys.executable], env=os.environ),
)
result = builtin.run()
diff --git a/tests/unit/seed/wheels/test_acquire.py b/tests/unit/seed/wheels/test_acquire.py
index 141d91d..d028239 100644
--- a/tests/unit/seed/wheels/test_acquire.py
+++ b/tests/unit/seed/wheels/test_acquire.py
@@ -38,7 +38,13 @@ def test_download_wheel_bad_output(mocker, for_py_version, session_app_data):
as_path.iterdir.return_value = [i.path for i in available]
result = download_wheel(
- distribution, f"=={embed.version}", for_py_version, [], session_app_data, as_path, os.environ
+ distribution,
+ f"=={embed.version}",
+ for_py_version,
+ [],
+ session_app_data,
+ as_path,
+ os.environ,
)
assert result.path == embed.path
diff --git a/tests/unit/seed/wheels/test_bundle.py b/tests/unit/seed/wheels/test_bundle.py
index 81fa54b..38be96c 100644
--- a/tests/unit/seed/wheels/test_bundle.py
+++ b/tests/unit/seed/wheels/test_bundle.py
@@ -36,9 +36,9 @@ def app_data(tmp_path_factory, for_py_version, next_pip_wheel):
"found_date": "2000-01-01T00:00:00.000000Z",
"release_date": "2000-01-01T00:00:00.000000Z",
"source": "periodic",
- }
+ },
],
- }
+ },
)
return app_data_
diff --git a/tests/unit/seed/wheels/test_periodic_update.py b/tests/unit/seed/wheels/test_periodic_update.py
index bc9635f..e7794f5 100644
--- a/tests/unit/seed/wheels/test_periodic_update.py
+++ b/tests/unit/seed/wheels/test_periodic_update.py
@@ -257,7 +257,13 @@ def test_trigger_update_no_debug(for_py_version, session_app_data, tmp_path, moc
Popen = mocker.patch("virtualenv.seed.wheels.periodic_update.Popen", return_value=process) # noqa: N806
trigger_update(
- "setuptools", for_py_version, current, [tmp_path / "a", tmp_path / "b"], session_app_data, os.environ, True
+ "setuptools",
+ for_py_version,
+ current,
+ [tmp_path / "a", tmp_path / "b"],
+ session_app_data,
+ os.environ,
+ True,
)
assert Popen.call_count == 1
@@ -299,7 +305,13 @@ def test_trigger_update_debug(for_py_version, session_app_data, tmp_path, mocker
Popen = mocker.patch("virtualenv.seed.wheels.periodic_update.Popen", return_value=process) # noqa: N806
trigger_update(
- "pip", for_py_version, current, [tmp_path / "a", tmp_path / "b"], session_app_data, os.environ, False
+ "pip",
+ for_py_version,
+ current,
+ [tmp_path / "a", tmp_path / "b"],
+ session_app_data,
+ os.environ,
+ False,
)
assert Popen.call_count == 1
@@ -346,7 +358,13 @@ def test_do_update_first(tmp_path, mocker, freezer):
download_wheels = (Wheel(Path(i[0])) for i in pip_version_remote)
def _download_wheel(
- distribution, version_spec, for_py_version, search_dirs, app_data, to_folder, env # noqa: U100
+ distribution,
+ version_spec, # noqa: U100
+ for_py_version,
+ search_dirs,
+ app_data,
+ to_folder,
+ env, # noqa: U100
):
assert distribution == "pip"
assert for_py_version == "3.9"
@@ -409,7 +427,13 @@ def test_do_update_skip_already_done(tmp_path, mocker, freezer):
extra.mkdir()
def _download_wheel(
- distribution, version_spec, for_py_version, search_dirs, app_data, to_folder, env # noqa: U100
+ distribution, # noqa: U100
+ version_spec, # noqa: U100
+ for_py_version, # noqa: U100
+ search_dirs, # noqa: U100
+ app_data, # noqa: U100
+ to_folder, # noqa: U100
+ env, # noqa: U100
):
return wheel.path
@@ -457,7 +481,10 @@ def test_new_version_eq():
def test_new_version_ne():
assert NewVersion("a", datetime.now(), datetime.now(), "periodic") != NewVersion(
- "a", datetime.now(), datetime.now() + timedelta(hours=1), "manual"
+ "a",
+ datetime.now(),
+ datetime.now() + timedelta(hours=1),
+ "manual",
)
@@ -501,7 +528,8 @@ def mock_download(mocker, pip_version_remote):
do = download()
return mocker.patch(
- "virtualenv.seed.wheels.acquire.download_wheel", side_effect=lambda *a, **k: next(do) # noqa: U100
+ "virtualenv.seed.wheels.acquire.download_wheel",
+ side_effect=lambda *a, **k: next(do), # noqa: U100
)
diff --git a/tox.ini b/tox.ini
index 53fc515..ddaf8ec 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,90 +1,77 @@
[tox]
envlist =
- fix_lint
+ fix
py311
py310
py39
py38
py37
- py36
pypy3
coverage
readme
docs
isolated_build = true
skip_missing_interpreters = true
-minversion = 3.14
+requires = tox>=4
[testenv]
description = run tests with {basepython}
-passenv =
+extras =
+ test
+commands =
+ coverage erase
+ coverage run -m pytest {posargs:--junitxml {toxworkdir}/junit.{envname}.xml tests --int}
+ coverage combine
+ coverage report --skip-covered --show-missing
+ coverage xml -o {toxworkdir}/coverage.{envname}.xml
+ coverage html -d {envtmpdir}/htmlcov --show-contexts --title virtualenv-{envname}-coverage
+package = wheel
+pass_env =
CI_RUN
- HOME
- PIP_*
PYTEST_*
TERM
-setenv =
- COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
- COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
- PYTHONIOENCODING = utf-8
+set_env =
_COVERAGE_SRC = {envsitepackagesdir}/virtualenv
+ COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
+ COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml
{upgrade}: PYTHONWARNINGS = ignore:DEPRECATION::pip._internal.cli.base_command
-extras =
- testing
-commands =
- python -m coverage erase
- python -m coverage run -m pytest {tty:--color=yes} \
- --junitxml {toxworkdir}/junit.{envname}.xml \
- {posargs:tests --int --timeout 600}
- python -m coverage combine
- python -m coverage report --skip-covered --show-missing
- python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
- python -m coverage html -d {envtmpdir}/htmlcov --show-contexts \
- --title virtualenv-{envname}-coverage
-install_command = python -m pip install {opts} {packages} --disable-pip-version-check
-package = wheel
wheel_build_env = .pkg
-[testenv:fix_lint]
+[testenv:fix]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
-passenv =
- *
-basepython = python3.10
skip_install = true
deps =
- pre-commit>=2.20
+ pre-commit>=2.21
commands =
pre-commit run --all-files --show-diff-on-failure
- python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'
[testenv:coverage]
description = [run locally after tests]: combine coverage data and create report;
generates a diff coverage against origin/main (can be changed by setting DIFF_AGAINST env var)
-passenv =
- DIFF_AGAINST
-setenv =
- COVERAGE_FILE = {toxworkdir}/.coverage
skip_install = true
deps =
- coverage>=6.5
- diff_cover>=7.2
+ covdefaults>=2.2.2
+ coverage[toml]>=7.0.1
+ diff_cover>=7.3
extras =
parallel_show_output = true
commands =
- python -m coverage combine
- python -m coverage report --skip-covered --show-missing
- python -m coverage xml -o {toxworkdir}/coverage.xml
- python -m coverage html -d {toxworkdir}/htmlcov
- python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
+ coverage combine
+ coverage report --skip-covered --show-missing
+ coverage xml -o {toxworkdir}/coverage.xml
+ coverage html -d {toxworkdir}/htmlcov
+ diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
depends =
py311
py310
py39
py38
py37
- py36
- pypy
pypy3
+pass_env =
+ DIFF_AGAINST
+set_env =
+ COVERAGE_FILE = {toxworkdir}/.coverage
[testenv:readme]
description = check that the long description is valid (need for PyPI)
@@ -99,7 +86,6 @@ commands =
[testenv:docs]
description = build documentation
-basepython = python3.10
extras =
docs
commands =
@@ -109,60 +95,39 @@ commands =
[testenv:upgrade]
description = upgrade pip/wheels/setuptools to latest
-passenv =
- UPGRADE_ADVISORY
skip_install = true
deps =
- black>=22.10
-changedir = {toxinidir}/tasks
+ black>=22.12
commands =
python upgrade_wheels.py
+change_dir = {toxinidir}/tasks
+pass_env =
+ UPGRADE_ADVISORY
[testenv:release]
description = do a release, required posarg of the version number
-passenv =
- *
-basepython = python3.10
deps =
- gitpython>=3.1.29
- packaging>=21.3
- towncrier>=22.8
-changedir = {toxinidir}/tasks
+ gitpython>=3.1.30
+ packaging>=22
+ towncrier>=22.12
commands =
python release.py --version {posargs}
+change_dir = {toxinidir}/tasks
[testenv:dev]
description = generate a DEV environment
-usedevelop = true
-deps =
- {[testenv:release]deps}
- setuptools_scm[toml]>=7.0.5
extras =
docs
- testing
+ test
commands =
python -m pip list --format=columns
python -c 'import sys; print(sys.executable)'
+package = editable
[testenv:zipapp]
description = generate a zipapp
skip_install = true
deps =
- packaging>=21.3
+ packaging>=22
commands =
python tasks/make_zipapp.py
-
-[isort]
-profile = black
-line_length = 120
-known_first_party = virtualenv
-
-[flake8]
-max-complexity = 22
-max-line-length = 120
-noqa-require-code = true
-dictionaries = en_US,python,technical,django
-ignore = E203, W503, C901, E402
-
-[pep8]
-max-line-length = 120
diff --git a/whitelist.txt b/whitelist.txt
index 477692e..6991425 100644
--- a/whitelist.txt
+++ b/whitelist.txt
@@ -182,7 +182,6 @@ rmdir
rpartition
rst
rtd
-scm
scr
sdist
setenv