Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
py:
- "3.11.0-beta.4"
- "3.11.0-beta.5"
- "3.10"
- "3.9"
- "3.8"
Expand Down
17 changes: 12 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.2
rev: v2.37.3
hooks:
- id: pyupgrade
args: ["--py36-plus"]
Expand All @@ -32,7 +32,7 @@ repos:
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.6.0]
additional_dependencies: [black==22.6]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
Expand All @@ -43,12 +43,19 @@ repos:
- id: tox-ini-fmt
args: ["-p", "fix_lint"]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.2
rev: v2.0.0
hooks:
- id: setup-cfg-fmt
args: [--min-py3-version, "3.6 ", "--max-py-version", "3.10"]
- repo: https://github.com/PyCQA/flake8
rev: "4.0.1"
rev: "5.0.4"
hooks:
- id: flake8
additional_dependencies: ["flake8-bugbear == 22.6.22"]
additional_dependencies:
- flake8-bugbear==22.7.1
- flake8-comprehensions==3.10
- flake8-pytest-style==1.6
- flake8-spellcheck==0.28
- flake8-unused-arguments==0.0.11
- flake8-noqa==1.2.8
- pep8-naming==0.13.1
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def setup(app):
if cli_interface_doctree.exists():
cli_interface_doctree.unlink()

HERE = Path(__file__).parent
if str(HERE) not in sys.path:
sys.path.append(str(HERE))
here = Path(__file__).parent
if str(here) not in sys.path:
sys.path.append(str(here))

# noinspection PyUnresolvedReferences
from render_cli import CliTable, literal_data
Expand Down
6 changes: 3 additions & 3 deletions docs/render_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class CliTable(SphinxDirective):
name = "table_cli"
option_spec = dict(module=unchanged_required, func=unchanged_required)
option_spec = {"module": unchanged_required, "func": unchanged_required}

def run(self):
module_name, attr_name = self.options["module"], self.options["func"]
Expand All @@ -48,7 +48,7 @@ def run(self):
parser_result = parse_parser(parser_creator(cmd))
opt_group = next(i["options"] for i in parser_result["action_groups"] if i["title"] == key)
results[name] = opt_group
core_names = set.intersection(*list({tuple(i["name"]) for i in v} for v in results.values()))
core_names = set.intersection(*[{tuple(i["name"]) for i in v} for v in results.values()])
if core_names:
rows = [i for i in next(iter(results.values())) if tuple(i["name"]) in core_names]
content.append(
Expand Down Expand Up @@ -223,7 +223,7 @@ def register_target_option(self, target) -> None:
domain.add_program_option(None, key, self.env.docname, key)


def literal_data(rawtext, app, type, slug, options):
def literal_data(rawtext, app, type, slug, options): # noqa: U100
"""Create a link to a BitBucket resource."""
of_class = type.split(".")
data = getattr(__import__(".".join(of_class[:-1]), fromlist=[of_class[-1]]), of_class[-1])
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[build-system]
requires = [
"setuptools >= 41.0.0",
"wheel >= 0.30.0",
"setuptools_scm >= 2",
"setuptools>=59.6",
"setuptools-scm>=6.4.2",
]
build-backend = 'setuptools.build_meta'

Expand Down
41 changes: 18 additions & 23 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ classifiers =
Operating System :: POSIX
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries
Expand All @@ -38,11 +33,11 @@ project_urls =
[options]
packages = find:
install_requires =
distlib>=0.3.1,<1
filelock>=3.2,<4
platformdirs>=2,<3
importlib-metadata>=0.12;python_version<"3.8"
importlib-resources>=1.0;python_version<"3.7"
distlib>=0.3.5,<1
filelock>=3.4.1,<4
platformdirs>=2.4,<3
importlib-metadata>=4.8.3;python_version < "3.8"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had issues when requiring tox and flake8 because of this pin.
Shortened error from pip-compile-multi:

Could not find a version that matches importlib-metadata<4.3,>=0.12,>=0.22,>=1.1.0,>=4.8.3 (from tox==3.25.1->-r requirements/local.in (line 3))
Tried: ............
There are incompatible versions in the resolved dependencies:
  .......
  importlib-metadata<4.3,>=1.1.0 (from flake8==5.0.4->-r requirements/test.in (line 6))
  importlib-metadata>=4.8.3 (from virtualenv==20.16.3->tox==3.25.1->-r requirements/local.in (line 3))

In my case, pinning virtualenv==20.16.2 ; python_version < '3.7' avoids the problem, but my project will be locked on virtualenv version 20.16.2 until this can be resolved.

Is there a reason for importlib-metadata to be pinned as >=4.8.3? I'm not super familiar with the library, and the problems around it, but unfortunately looks this isn't the only issue out there when projects pin it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for importlib-metadata to be pinned as >=4.8.3?

That's the only version we actually test with in our CI and is the only version I'm comfortable saying it's supported. I recommend reaching out to other projects that upper pin to remove.

importlib-resources>=5.4;python_version < "3.7"
python_requires = >=3.6
package_dir =
=src
Expand Down Expand Up @@ -83,22 +78,22 @@ virtualenv.seed =

[options.extras_require]
docs =
proselint>=0.10.2
sphinx>=3
sphinx-argparse>=0.2.5
sphinx-rtd-theme>=0.4.3
towncrier>=21.3
proselint>=0.13
sphinx>=5.1.1
sphinx-argparse>=0.3.1
sphinx-rtd-theme>=1
towncrier>=21.9
testing =
coverage>=4
coverage>=6.2
coverage-enable-subprocess>=1
flaky>=3
packaging>=20.0
pytest>=4
flaky>=3.7
packaging>=21.3
pytest>=7.0.1
pytest-env>=0.6.2
pytest-freezegun>=0.4.1
pytest-mock>=2
pytest-randomly>=1
pytest-timeout>=1
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
Expand Down
6 changes: 3 additions & 3 deletions src/virtualenv/activation/activator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, options):
self.flag_prompt = os.path.basename(os.getcwd()) if options.prompt == "." else options.prompt

@classmethod
def supports(cls, interpreter):
def supports(cls, interpreter): # noqa: U100
"""Check if the activation script is supported in the given interpreter.

:param interpreter: the interpreter we need to support
Expand All @@ -22,7 +22,7 @@ def supports(cls, interpreter):
return True

@classmethod
def add_parser_arguments(cls, parser, interpreter):
def add_parser_arguments(cls, parser, interpreter): # noqa: U100
"""
Add CLI arguments for this activation script.

Expand All @@ -31,7 +31,7 @@ def add_parser_arguments(cls, parser, interpreter):
"""

@abstractmethod
def generate(self, creator):
def generate(self, creator): # noqa: U100
"""Generate activate script for the given creator.

:param creator: the creator (based of :class:`virtualenv.create.creator.Creator`) we used to create this \
Expand Down
6 changes: 3 additions & 3 deletions src/virtualenv/activation/via_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def generate(self, creator):
creator.pyenv_cfg["prompt"] = self.flag_prompt
return generated

def replacements(self, creator, dest_folder):
def replacements(self, creator, dest_folder): # noqa: U100
return {
"__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt,
"__VIRTUAL_ENV__": str(creator.dest),
Expand Down Expand Up @@ -55,8 +55,8 @@ def instantiate_template(self, replacements, template, creator):
return text

@staticmethod
def _repr_unicode(creator, value):
return value # by default we just let it be unicode
def _repr_unicode(creator, value): # noqa: U100
return value # by default, we just let it be unicode


__all__ = [
Expand Down
12 changes: 6 additions & 6 deletions src/virtualenv/app_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def reset(self):
"""called when the user passes in the reset app data"""

@abstractmethod
def py_info(self, path):
def py_info(self, path): # noqa: U100
raise NotImplementedError

@abstractmethod
Expand All @@ -32,7 +32,7 @@ def can_update(self):
raise NotImplementedError

@abstractmethod
def embed_update_log(self, distribution, for_py_version):
def embed_update_log(self, distribution, for_py_version): # noqa: U100
raise NotImplementedError

@property
Expand All @@ -44,7 +44,7 @@ def transient(self):
raise NotImplementedError

@abstractmethod
def wheel_image(self, for_py_version, name):
def wheel_image(self, for_py_version, name): # noqa: U100
raise NotImplementedError

@contextmanager
Expand All @@ -58,12 +58,12 @@ def ensure_extracted(self, path, to_folder=None):

@abstractmethod
@contextmanager
def extract(self, path, to_folder):
def extract(self, path, to_folder): # noqa: U100
raise NotImplementedError

@abstractmethod
@contextmanager
def locked(self, path):
def locked(self, path): # noqa: U100
raise NotImplementedError


Expand All @@ -77,7 +77,7 @@ def read(self):
raise NotImplementedError

@abstractmethod
def write(self, content):
def write(self, content): # noqa: U100
raise NotImplementedError

@abstractmethod
Expand Down
12 changes: 6 additions & 6 deletions src/virtualenv/app_data/na.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ def close(self):
def reset(self):
"""do nothing"""

def py_info(self, path):
def py_info(self, path): # noqa: U100
return ContentStoreNA()

def embed_update_log(self, distribution, for_py_version):
def embed_update_log(self, distribution, for_py_version): # noqa: U100
return ContentStoreNA()

def extract(self, path, to_folder):
def extract(self, path, to_folder): # noqa: U100
raise self.error

@contextmanager
def locked(self, path):
def locked(self, path): # noqa: U100
"""do nothing"""
yield

@property
def house(self):
raise self.error

def wheel_image(self, for_py_version, name):
def wheel_image(self, for_py_version, name): # noqa: U100
raise self.error

def py_info_clear(self):
Expand All @@ -53,7 +53,7 @@ def read(self):
"""nothing to read"""
return None

def write(self, content):
def write(self, content): # noqa: U100
"""nothing to write"""

def remove(self):
Expand Down
4 changes: 2 additions & 2 deletions src/virtualenv/app_data/read_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def py_info_clear(self) -> None:
def py_info(self, path):
return _PyInfoStoreDiskReadOnly(self.py_info_at, path)

def embed_update_log(self, distribution, for_py_version):
def embed_update_log(self, distribution, for_py_version): # noqa: U100
raise NotImplementedError


class _PyInfoStoreDiskReadOnly(PyInfoStoreDisk):
def write(self, content):
def write(self, content): # noqa: U100
raise RuntimeError("read-only app data python info cannot be updated")


Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/app_data/via_disk_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def read(self):
return data
except ValueError:
bad_format = True
except Exception: # noqa
except Exception:
pass
if bad_format:
try:
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/app_data/via_tempdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def close(self):
logging.debug("remove temporary app data folder %s", self.lock.path)
safe_delete(self.lock.path)

def embed_update_log(self, distribution, for_py_version):
def embed_update_log(self, distribution, for_py_version): # noqa: U100
raise NotImplementedError


Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/config/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ListType(TypeData):
def _validate(self):
""" """

def convert(self, value, flatten=True):
def convert(self, value, flatten=True): # noqa: U100
values = self.split_values(value)
result = []
for value in values:
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 @@ -53,7 +53,7 @@ def _args(self):
]

@classmethod
def can_create(cls, interpreter):
def can_create(cls, interpreter): # noqa: U100
"""Determine if we can create a virtual environment.

:param interpreter: the interpreter in question
Expand All @@ -63,7 +63,7 @@ def can_create(cls, interpreter):
return True

@classmethod
def add_parser_arguments(cls, parser, interpreter, meta, app_data):
def add_parser_arguments(cls, parser, interpreter, meta, app_data): # noqa: U100
"""Add CLI arguments for the creator.

:param parser: the CLI parser
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/create/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run():
except ImportError: # pragma: no cover
# this is possible if the standard library cannot be accessed
# noinspection PyPep8Naming
OrderedDict = dict # pragma: no cover
OrderedDict = dict # pragma: no cover # noqa: N806
result = OrderedDict([("sys", OrderedDict())])
path_keys = (
"executable",
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/create/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _calc_config_vars(self, to):
return {k: (to if v.startswith(self.interpreter.prefix) else v) for k, v in sys_vars.items()}

@classmethod
def can_describe(cls, interpreter):
def can_describe(cls, interpreter): # noqa: U100
"""Knows means it knows how the output will look"""
return True

Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/create/via_global_ref/_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class _Finder:
# See https://github.com/pypa/virtualenv/issues/1895 for details.
lock = []

def find_spec(self, fullname, path, target=None):
def find_spec(self, fullname, path, target=None): # noqa: U100
if fullname in _DISTUTILS_PATCH and self.fullname is None:
# initialize lock[0] lazily
if len(self.lock) == 0:
Expand Down
Loading