Skip to content

Commit

Permalink
Merge branch 'main' into add-3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg authored Mar 10, 2024
2 parents 6efed5e + cb8fd38 commit c261b7a
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

27 changes: 5 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,9 @@ repos:
args: []
additional_dependencies: [pyparsing, nox]

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 22.12.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
hooks:
- id: flake8
additional_dependencies: ["pep8-naming"]
# Ignore all format-related checks as Black takes care of those.
args: ["--ignore", "E2,W5", "--select", "E,W,F,N"]
- id: ruff
args: [ --fix ]
- id: ruff-format
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
*unreleased*
~~~~~~~~~~~~

No unreleased changes.

24.0 - 2024-03-10
~~~~~~~~~~~~~~~~~

* Do specifier matching correctly when the specifier contains an epoch number
and has more components than the version (:issue:`683`)
* Support the experimental ``--disable-gil`` builds in packaging.tags
Expand Down
42 changes: 39 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,42 @@ module = ["_manylinux"]
ignore_missing_imports = true


[tool.isort]
profile = "black"
combine_as_imports = true
[tool.ruff]
src = ["src"]

[tool.ruff.lint]
extend-select = [
"B",
"E",
"F",
"I",
"N",
"UP",
"W"
]
ignore = [
"B009",
"B015",
"B018",
"B027",
"B028",
"B904",
"N818",
"UP032",
"UP030",
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]
2 changes: 1 addition & 1 deletion src/packaging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"

__version__ = "23.3.dev0"
__version__ = "24.1.dev0"

__author__ = "Donald Stufft and individual contributors"
__email__ = "donald@stufft.io"
Expand Down
3 changes: 2 additions & 1 deletion src/packaging/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
Op,
Value,
Variable,
)
from ._parser import (
parse_marker as _parse_marker,
)
from ._tokenizer import ParserSyntaxError
Expand Down Expand Up @@ -69,7 +71,6 @@ def _normalize_extra_values(results: Any) -> Any:
def _format_marker(
marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True
) -> str:

assert isinstance(marker, (list, tuple, str))

# Sometimes we have a structure like [[...]] which is a single item list
Expand Down
5 changes: 3 additions & 2 deletions src/packaging/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
cast,
)

from . import requirements, specifiers, utils, version as version_module
from . import requirements, specifiers, utils
from . import version as version_module

T = typing.TypeVar("T")

Expand All @@ -28,7 +29,7 @@
ExceptionGroup
except NameError: # pragma: no cover

class ExceptionGroup(Exception): # noqa: N818
class ExceptionGroup(Exception):
"""A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11.
If :external:exc:`ExceptionGroup` is already defined by Python itself,
Expand Down
6 changes: 0 additions & 6 deletions src/packaging/specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ def _get_operator(self, op: str) -> CallableOperator:
return operator_callable

def _compare_compatible(self, prospective: Version, spec: str) -> bool:

# Compatible releases have an equivalent combination of >= and ==. That
# is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
# implement this in terms of the other specifiers instead of
Expand All @@ -385,7 +384,6 @@ def _compare_compatible(self, prospective: Version, spec: str) -> bool:
)

def _compare_equal(self, prospective: Version, spec: str) -> bool:

# We need special logic to handle prefix matching
if spec.endswith(".*"):
# In the case of prefix matching we want to ignore local segment.
Expand Down Expand Up @@ -429,21 +427,18 @@ def _compare_not_equal(self, prospective: Version, spec: str) -> bool:
return not self._compare_equal(prospective, spec)

def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool:

# NB: Local version identifiers are NOT permitted in the version
# specifier, so local version labels can be universally removed from
# the prospective version.
return Version(prospective.public) <= Version(spec)

def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool:

# NB: Local version identifiers are NOT permitted in the version
# specifier, so local version labels can be universally removed from
# the prospective version.
return Version(prospective.public) >= Version(spec)

def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:

# Convert our spec to a Version instance, since we'll want to work with
# it as a version.
spec = Version(spec_str)
Expand All @@ -468,7 +463,6 @@ def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
return True

def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:

# Convert our spec to a Version instance, since we'll want to work with
# it as a version.
spec = Version(spec_str)
Expand Down
2 changes: 0 additions & 2 deletions src/packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ def micro(self) -> int:
def _parse_letter_version(
letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
) -> Optional[Tuple[str, int]]:

if letter:
# We consider there to be an implicit 0 in a pre-release if there is
# not a numeral associated with it.
Expand Down Expand Up @@ -508,7 +507,6 @@ def _cmpkey(
dev: Optional[Tuple[str, int]],
local: Optional[LocalType],
) -> CmpKey:

# When we compare a release version, we want to compare it with all of the
# trailing zeros removed. So we'll use a reverse the list, drop all the now
# leading zeros until we come to something non zero, then take the rest
Expand Down

0 comments on commit c261b7a

Please sign in to comment.