Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#2685)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Feb 21, 2024
1 parent fa28347 commit cad5500
Show file tree
Hide file tree
Showing 57 changed files with 145 additions and 360 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Issue**

Describe what's the expected behaviour and what you're observing.
Describe what's the expected behavior and what you're observing.

**Environment**

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ""

**Issue**

Describe what's the expected behaviour and what you're observing.
Describe what's the expected behavior and what you're observing.

**Environment**

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: check
on:
workflow_dispatch:
push:
branches: "main"
branches: ["main"]
tags-ignore: ["**"]
pull_request:
schedule:
Expand All @@ -17,6 +17,7 @@ jobs:
name: test ${{ matrix.py }} - ${{ matrix.os }}
if: github.event_name != 'schedule' || github.repository_owner == 'pypa'
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -93,6 +94,7 @@ jobs:
run: tox -vv --notest --skip-missing-interpreters false
- name: Run test suite
run: tox --skip-pkg-install
timeout-minutes: 20
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: "yes"
Expand Down
16 changes: 13 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: check-github-workflows
args: [ "--verbose" ]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--write-changes"]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.1"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.6.0"
rev: "1.7.0"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.12"]
additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
rev: "v0.2.2"
hooks:
- id: ruff-format
- id: ruff
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
[![Downloads](https://static.pepy.tech/badge/virtualenv/month)](https://pepy.tech/project/virtualenv)
[![PyPI - License](https://img.shields.io/pypi/l/virtualenv?style=flat-square)](https://opensource.org/licenses/MIT)
[![Build Status](https://github.com/pypa/virtualenv/workflows/check/badge.svg?branch=main&event=push)](https://github.com/pypa/virtualenv/actions?query=workflow%3Acheck)
[![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)

A tool for creating isolated `virtual` python environments.

Expand Down
18 changes: 9 additions & 9 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ v20.23.0 (2023-04-27)

Features - 20.23.0
~~~~~~~~~~~~~~~~~~
- Do not install ``wheel`` and ``setuptools`` seed packages for Python 3.12+. To restore the old behaviour use:
- Do not install ``wheel`` and ``setuptools`` seed packages for Python 3.12+. To restore the old behavior use:

- for ``wheel`` use ``VIRTUALENV_WHEEL=bundle`` environment variable or ``--wheel=bundle`` CLI flag,
- for ``setuptools`` use ``VIRTUALENV_SETUPTOOLS=bundle`` environment variable or ``--setuptools=bundle`` CLI flag.
Expand Down Expand Up @@ -222,7 +222,7 @@ v20.17.1 (2022-12-05)
Bugfixes - 20.17.1
~~~~~~~~~~~~~~~~~~
- A ``py`` or ``python`` spec means any Python rather than ``CPython`` - by :user:`gaborbernat`. (`#2460 <https://github.com/pypa/virtualenv/issues/2460>`_)
- Make ``activate.nu`` respect ``VIRTUAL_ENV_DISABLE_PROMPT`` and not set the prompt if reqeusted - by :user:`m-lima`. (`#2461 <https://github.com/pypa/virtualenv/issues/2461>`_)
- Make ``activate.nu`` respect ``VIRTUAL_ENV_DISABLE_PROMPT`` and not set the prompt if requested - by :user:`m-lima`. (`#2461 <https://github.com/pypa/virtualenv/issues/2461>`_)


v20.17.0 (2022-11-27)
Expand Down Expand Up @@ -259,7 +259,7 @@ Features - 20.16.6

Bugfixes - 20.16.6
~~~~~~~~~~~~~~~~~~
- Fix selected scheme on debian derivatives for python 3.10 when ``python3-distutils`` is not installed or the ``venv`` scheme is not avaiable - by :user:`asottile`. (`#2350 <https://github.com/pypa/virtualenv/issues/2350>`_)
- Fix selected scheme on debian derivatives for python 3.10 when ``python3-distutils`` is not installed or the ``venv`` scheme is not available - by :user:`asottile`. (`#2350 <https://github.com/pypa/virtualenv/issues/2350>`_)
- Allow the test suite to pass even with the original C shell (rather than ``tcsh``) - by :user:`kulikjak`. (`#2418 <https://github.com/pypa/virtualenv/issues/2418>`_)
- Fix fallback handling of downloading wheels for bundled packages - by :user:`schaap`. (`#2429 <https://github.com/pypa/virtualenv/issues/2429>`_)
- Upgrade embedded setuptools to ``65.5.0`` from ``65.3.0`` and pip to ``22.3`` from ``22.2.2`` - by :user:`gaborbernat`. (`#2434 <https://github.com/pypa/virtualenv/issues/2434>`_)
Expand Down Expand Up @@ -295,7 +295,7 @@ v20.16.2 (2022-07-27)

Bugfixes - 20.16.2
~~~~~~~~~~~~~~~~~~
- Bump embeded pip from ``22.2`` to ``22.2.1`` - by :user:`gaborbernat`. (`#2391 <https://github.com/pypa/virtualenv/issues/2391>`_)
- Bump embedded pip from ``22.2`` to ``22.2.1`` - by :user:`gaborbernat`. (`#2391 <https://github.com/pypa/virtualenv/issues/2391>`_)


v20.16.1 (2022-07-26)
Expand Down Expand Up @@ -395,7 +395,7 @@ v20.13.1 (2022-02-05)
Bugfixes - 20.13.1
~~~~~~~~~~~~~~~~~~
- fix "execv() arg 2 must contain only strings" error on M1 MacOS (`#2282 <https://github.com/pypa/virtualenv/issues/2282>`_)
- Ugrade embedded setuptools to ``60.5.0`` from ``60.2.0`` - by :user:`asottile`. (`#2289 <https://github.com/pypa/virtualenv/issues/2289>`_)
- Upgrade embedded setuptools to ``60.5.0`` from ``60.2.0`` - by :user:`asottile`. (`#2289 <https://github.com/pypa/virtualenv/issues/2289>`_)
- Upgrade embedded pip to ``22.0.3`` and setuptools to ``60.6.0`` - by :user:`gaborbernat` and :user:`asottile`. (`#2294 <https://github.com/pypa/virtualenv/issues/2294>`_)


Expand Down Expand Up @@ -439,7 +439,7 @@ Features - 20.12.0
Bugfixes - 20.12.0
~~~~~~~~~~~~~~~~~~
- Fix ``--download`` option - by :user:`mayeut`. (`#2120 <https://github.com/pypa/virtualenv/issues/2120>`_)
- Ugrade embedded setuptools to ``60.2.0`` from ``60.1.1`` - by :user:`gaborbernat`. (`#2263 <https://github.com/pypa/virtualenv/issues/2263>`_)
- Upgrade embedded setuptools to ``60.2.0`` from ``60.1.1`` - by :user:`gaborbernat`. (`#2263 <https://github.com/pypa/virtualenv/issues/2263>`_)


v20.11.2 (2021-12-29)
Expand Down Expand Up @@ -480,7 +480,7 @@ Features - 20.10.0
A similar technique `was proposed to Python, for the venv module <https://bugs.python.org/issue45413>`_ - by ``hroncok`` (`#2208 <https://github.com/pypa/virtualenv/issues/2208>`_)
- The activated virtualenv prompt is now always wrapped in parentheses. This
affects venvs created with the ``--prompt`` attribute, and matches virtualenv's
behaviour on par with venv. (`#2224 <https://github.com/pypa/virtualenv/issues/2224>`_)
behavior on par with venv. (`#2224 <https://github.com/pypa/virtualenv/issues/2224>`_)

Bugfixes - 20.10.0
~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -832,7 +832,7 @@ Bugfixes - 20.0.26
- Improve periodic update handling:

- better logging output while running and enable logging on background process call (
``_VIRTUALENV_PERIODIC_UPDATE_INLINE`` may be used to debug behaviour inline)
``_VIRTUALENV_PERIODIC_UPDATE_INLINE`` may be used to debug behavior inline)
- fallback to unverified context when querying the PyPi for release date,
- stop downloading wheels once we reach the embedded version,

Expand Down Expand Up @@ -1192,7 +1192,7 @@ v20.0.2 (2020-02-11)
Features - 20.0.2
~~~~~~~~~~~~~~~~~
- Print out a one line message about the created virtual environment when no :option:`verbose` is set, this can now be
silenced to get back the original behaviour via the :option:`quiet` flag - by :user:`pradyunsg`. (`#1557 <https://github.com/pypa/virtualenv/issues/1557>`_)
silenced to get back the original behavior via the :option:`quiet` flag - by :user:`pradyunsg`. (`#1557 <https://github.com/pypa/virtualenv/issues/1557>`_)
- Allow virtualenv's app data cache to be overridden by ``VIRTUALENV_OVERRIDE_APP_DATA`` - by :user:`asottile`. (`#1559 <https://github.com/pypa/virtualenv/issues/1559>`_)
- Passing in the virtual environment name/path is now required (no longer defaults to ``venv``) - by :user:`gaborbernat`. (`#1568 <https://github.com/pypa/virtualenv/issues/1568>`_)
- Add a CLI flag :option:`with-traceback` that allows displaying the stacktrace of the virtualenv when a failure occurs
Expand Down
2 changes: 1 addition & 1 deletion docs/cli_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CLI flags

It modifies the environment variables in a shell to create an isolated Python environment, so you'll need to have a
shell to run it. You can type in ``virtualenv`` (name of the application) followed by flags that control its
behaviour. All options have sensible defaults, and there's one required argument: the name/path of the virtual
behavior. All options have sensible defaults, and there's one required argument: the name/path of the virtual
environment to create. The default values for the command line options can be overridden via the
:ref:`conf_file` or :ref:`env_vars`. Environment variables takes priority over the configuration file values
(``--help`` will show if a default comes from the environment variable as the help message will end in this case
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Virtualenv has one basic command:
virtualenv venv
This will create a python virtual environment of the same version as virtualenv, installed into the subdirectory
``venv``. The command line tool has quite a few of flags that modify the tool's behaviour, for a
``venv``. The command line tool has quite a few of flags that modify the tool's behavior, for a
full list make sure to check out :ref:`cli_flags`.

The tool works in two phases:
Expand Down Expand Up @@ -182,7 +182,7 @@ package. These wheels may be acquired from multiple locations as follows:
not start using a new embedded versions half way through.


The automatic behaviour might be disabled via the :option:`no-periodic-update` configuration flag/option. To acquire
The automatic behavior might be disabled via the :option:`no-periodic-update` configuration flag/option. To acquire
the release date of a package virtualenv will perform the following:

- lookup ``https://pypi.org/pypi/<distribution>/json`` (primary truth source),
Expand Down Expand Up @@ -243,7 +243,7 @@ executables, rather than relying on your shell to resolve them to your virtual e

Activator scripts also modify your shell prompt to indicate which environment is currently active, by prepending the
environment name (or the name specified by ``--prompt`` when initially creating the environment) in brackets, like
``(venv)``. You can disable this behaviour by setting the environment variable ``VIRTUAL_ENV_DISABLE_PROMPT`` to any
``(venv)``. You can disable this behavior by setting the environment variable ``VIRTUAL_ENV_DISABLE_PROMPT`` to any
value. You can also get the environment name via the environment variable ``VIRTUAL_ENV_PROMPT`` if you want to
customize your prompt, for example.

Expand Down
20 changes: 12 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,12 @@ build.hooks.vcs.version-file = "src/virtualenv/version.py"
build.targets.sdist.include = ["/src", "/tests", "/tasks", "/tox.ini"]
version.source = "vcs"

[tool.black]
line-length = 120

[tool.ruff]
select = ["ALL"]
line-length = 120
target-version = "py37"
isort = { known-first-party = ["virtualenv"], required-imports = ["from __future__ import annotations"] }
ignore = [
lint.isort = { known-first-party = ["virtualenv"], required-imports = ["from __future__ import annotations"] }
lint.select = ["ALL"]
lint.ignore = [
"CPY", # No copyright header
"ANN", # no type checking added yet
"D10", # no docstrings
Expand All @@ -127,18 +124,25 @@ ignore = [
"COM812", # conflict with formatter
"ISC001", # conflict with formatter
]
format.preview = true
lint.preview = true
[tool.ruff.per-file-ignores]
format.preview = true
format.docstring-code-format = true
format.docstring-code-line-length = 100
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"D", # don't care about documentation in tests
"S603", # `subprocess` call: check for execution of untrusted input
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"PLC2701", # Private import
]

[tool.codespell]
builtin = "clear,usage,en-GB_to_en-US"
count = true

[tool.pytest.ini_options]
markers = ["slow"]
timeout = 600
Expand Down
6 changes: 3 additions & 3 deletions src/virtualenv/activation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

__all__ = [
"BashActivator",
"PowerShellActivator",
"CShellActivator",
"PythonActivator",
"BatchActivator",
"CShellActivator",
"FishActivator",
"NushellActivator",
"PowerShellActivator",
"PythonActivator",
]
4 changes: 2 additions & 2 deletions src/virtualenv/activation/activator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

import os
from abc import ABCMeta, abstractmethod
from abc import ABC, abstractmethod


class Activator(metaclass=ABCMeta):
class Activator(ABC):
"""Generates activate script for the virtual environment."""

def __init__(self, options) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/virtualenv/activation/via_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
import sys
from abc import ABCMeta, abstractmethod
from abc import ABC, abstractmethod

from .activator import Activator

Expand All @@ -16,7 +16,7 @@ def read_binary(module_name: str, filename: str) -> bytes:
from importlib.resources import read_binary


class ViaTemplateActivator(Activator, metaclass=ABCMeta):
class ViaTemplateActivator(Activator, ABC):
@abstractmethod
def templates(self):
raise NotImplementedError
Expand Down
8 changes: 4 additions & 4 deletions src/virtualenv/app_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

from __future__ import annotations

from abc import ABCMeta, abstractmethod
from abc import ABC, abstractmethod
from contextlib import contextmanager

from virtualenv.info import IS_ZIPAPP


class AppData(metaclass=ABCMeta):
class AppData(ABC):
"""Abstract storage interface for the virtualenv application."""

@abstractmethod
Expand Down Expand Up @@ -67,7 +67,7 @@ def locked(self, path):
raise NotImplementedError


class ContentStore(metaclass=ABCMeta):
class ContentStore(ABC):
@abstractmethod
def exists(self):
raise NotImplementedError
Expand All @@ -91,6 +91,6 @@ def locked(self):


__all__ = [
"ContentStore",
"AppData",
"ContentStore",
]
4 changes: 2 additions & 2 deletions src/virtualenv/app_data/via_disk_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import json
import logging
from abc import ABCMeta
from abc import ABC
from contextlib import contextmanager, suppress
from hashlib import sha256

Expand Down Expand Up @@ -105,7 +105,7 @@ def wheel_image(self, for_py_version, name):
return self.lock.path / "wheel" / for_py_version / "image" / "1" / name


class JSONStoreDisk(ContentStore, metaclass=ABCMeta):
class JSONStoreDisk(ContentStore, ABC):
def __init__(self, in_folder, key, msg, msg_args) -> None:
self.in_folder = in_folder
self.key = key
Expand Down
4 changes: 2 additions & 2 deletions src/virtualenv/create/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import os
import sys
from abc import ABCMeta, abstractmethod
from abc import ABC, abstractmethod
from argparse import ArgumentTypeError
from ast import literal_eval
from collections import OrderedDict
Expand All @@ -26,7 +26,7 @@ def __init__(self) -> None:
self.error = None


class Creator(metaclass=ABCMeta):
class Creator(ABC):
"""A class that given a python Interpreter creates a virtual environment."""

def __init__(self, options, interpreter) -> None:
Expand Down

0 comments on commit cad5500

Please sign in to comment.