Skip to content

Commit

Permalink
Merge branch 'main' into fix-prerelease-detection-for->-and-<
Browse files Browse the repository at this point in the history
  • Loading branch information
notatallshaw authored Jul 12, 2024
2 parents e099c94 + 793ee28 commit d70d341
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -47,9 +47,9 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- name: Autobuild
uses: github/codeql-action/autobuild@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
name: Install Python
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
name: Install Python
Expand All @@ -46,13 +46,13 @@ jobs:
needs: lint

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Build
run: pipx run build

- name: Archive files
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: dist
path: dist
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.8", "pypy3.9", "pypy3.10"]

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
name: Install Python ${{ matrix.python_version }}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Changelog

No unreleased changes.

24.1 - 2024-06-10
~~~~~~~~~~~~~~~~~

No unreleased changes.

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

Expand Down
6 changes: 3 additions & 3 deletions docs/development/submitting-patches.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ follow the directions on the :doc:`security page </security>`.
Code
----

This project's source is auto-formatted with |black|. You can check if your
This project's source is auto-formatted with |ruff|. You can check if your
code meets our requirements by running our linters against it with ``nox -s
lint`` or ``pre-commit run --all-files``.

Expand Down Expand Up @@ -67,8 +67,8 @@ So, specifically:
* Use Sphinx parameter/attribute documentation `syntax`_.


.. |black| replace:: ``black``
.. _black: https://pypi.org/project/black/
.. |ruff| replace:: ``ruff``
.. _ruff: https://astral.sh/ruff
.. _`Write comments as complete sentences.`: https://nedbatchelder.com/blog/201401/comments_should_be_sentences.html
.. _`syntax`: https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html
.. _`Studies have shown`: https://www.microsoft.com/en-us/research/publication/characteristics-of-useful-code-reviews-an-empirical-study-at-microsoft/
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__ = "24.1.dev0"
__version__ = "24.2.dev0"

__author__ = "Donald Stufft and individual contributors"
__email__ = "[email protected]"
Expand Down
6 changes: 6 additions & 0 deletions src/packaging/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ def evaluate(self, environment: dict[str, str] | None = None) -> bool:
"""
current_environment = cast("dict[str, str]", default_environment())
current_environment["extra"] = ""
# Work around platform.python_version() returning something that is not PEP 440
# compliant for non-tagged Python builds. We preserve default_environment()'s
# behavior of returning platform.python_version() verbatim, and leave it to the
# caller to provide a syntactically valid version if they want to override it.
if current_environment["python_full_version"].endswith("+"):
current_environment["python_full_version"] += "local"
if environment is not None:
current_environment.update(environment)
# The API used to allow setting extra to None. We need to handle this
Expand Down
13 changes: 13 additions & 0 deletions tests/test_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import platform
import sys
from typing import cast
from unittest import mock

import pytest

Expand All @@ -19,6 +20,7 @@
default_environment,
format_full_version,
)
from packaging.version import InvalidVersion

VARIABLES = [
"extra",
Expand Down Expand Up @@ -384,3 +386,14 @@ def test_extra_str_normalization(self):

assert str(Marker(lhs)) == f'"{normalized_name}" == extra'
assert str(Marker(rhs)) == f'extra == "{normalized_name}"'

def test_python_full_version_untagged_user_provided(self):
"""A user-provided python_full_version ending with a + fails to parse."""
with pytest.raises(InvalidVersion):
Marker("python_full_version < '3.12'").evaluate(
{"python_full_version": "3.11.1+"}
)

def test_python_full_version_untagged(self):
with mock.patch("platform.python_version", return_value="3.11.1+"):
assert Marker("python_full_version < '3.12'").evaluate()

0 comments on commit d70d341

Please sign in to comment.