Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco authored Nov 30, 2024
2 parents 88a1e5c + 067412e commit dcb3b91
Show file tree
Hide file tree
Showing 26 changed files with 359 additions and 191 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ exclude_lines =
# Don't complain if non-runnable code isn't run
if __name__ == .__main__.:

# exclude typing.TYPE_CHECKING
if TYPE_CHECKING:

[html]
show_contexts = True
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.6
uses: actions/checkout@v4.2.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v5.1.0
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- name: Install dependencies
Expand All @@ -43,14 +43,15 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v5.1.0
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -67,8 +68,8 @@ jobs:
# Only run on Ubuntu because most of the tests are skipped on Windows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v5.1.0
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install dependencies
Expand All @@ -79,8 +80,8 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v5.1.0
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install dependencies
Expand Down Expand Up @@ -113,8 +114,8 @@ jobs:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v5.1.0
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install dependencies
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

steps:
- name: "Checkout repository"
uses: "actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29"
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"

- name: "Setup Python"
uses: "actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d"
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b"
with:
python-version: "3.x"

Expand All @@ -40,7 +40,7 @@ jobs:
cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
- name: "Upload dists"
uses: "actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808"
uses: "actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882"
with:
name: "dist"
path: "dist/"
Expand Down Expand Up @@ -70,10 +70,10 @@ jobs:

steps:
- name: "Download dists"
uses: "actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e"
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16"
with:
name: "dist"
path: "dist/"

- name: "Publish dists to PyPI"
uses: "pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450"
uses: "pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa"
1 change: 1 addition & 0 deletions changelog/1184.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python 3.13 is now explicitly supported.
5 changes: 0 additions & 5 deletions changelog/fix-repo-urls-with-auth-and-port.bugfix

This file was deleted.

42 changes: 41 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,42 @@ schemes recommended by the Python Packaging Authority.
.. towncrier release notes start
Twine 6.0.0 (2024-11-29)
------------------------

Bugfixes
^^^^^^^^

- Restore support for pkginfo 1.11 (`#1116 <https://github.com/pypa/twine/issues/1116>`_)


Deprecations and Removals
^^^^^^^^^^^^^^^^^^^^^^^^^

- Username for PyPI and Test PyPI now defaults to __token__ but no longer overrides a username configured in the environment or supplied on the command line. Workflows still supplying anything other than __token__ for the username when uploading to PyPI or Test PyPI will now fail. Either supply __token__ or do not supply a username at all. (`#1121 <https://github.com/pypa/twine/issues/1121>`_)


Misc
^^^^

- `#1024 <https://github.com/pypa/twine/issues/1024>`_


Twine 5.1.1 (2024-06-26)
------------------------

Bugfixes
^^^^^^^^

- Resolve DeprecationWarnings when extracting ``twine`` metadata. (`#1115 <https://github.com/pypa/twine/issues/1115>`_)

- Fix bug for Repository URLs with auth where the port was lost. When attempting
to prevent printing authentication credentials in URLs provided with username
and password, we did not properly handle the case where the URL also contains
a port (when reconstructing the URL). This is now handled and tested to
ensure no regressions. (`#fix-repo-urls-with-auth-and-port <https://github.com/pypa/twine/issues/fix-repo-urls-with-auth-and-port>`_)


Twine 5.1.0 (2024-05-15)
------------------------

Expand All @@ -38,11 +74,15 @@ Bugfixes

- Use ``email.message`` instead of ``cgi`` as ``cgi`` has been deprecated (`#969 <https://github.com/pypa/twine/issues/969>`_)

Features
^^^^^^^^

- Remove support for usernames other than ``__token__`` when uploading to PyPI and TestPyPI (`#1040 <https://github.com/pypa/twine/issues/1040>`_)

Misc
^^^^

- `#931 <https://github.com/pypa/twine/issues/931>`_, `#991 <https://github.com/pypa/twine/issues/991>`_, `#1028 <https://github.com/pypa/twine/issues/1028>`_, `#1040 <https://github.com/pypa/twine/issues/1040>`_
- `#931 <https://github.com/pypa/twine/issues/931>`_, `#991 <https://github.com/pypa/twine/issues/991>`_, `#1028 <https://github.com/pypa/twine/issues/1028>`_


Twine 4.0.2 (2022-11-30)
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
# TODO: Try to add these to intersphinx_mapping
nitpick_ignore_regex = [
(r"py:.*", r"pkginfo.*"),
("py:class", r"warnings\.WarningMessage"),
]

# -- Options for apidoc output ------------------------------------------------
Expand Down
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyproject.toml
[build-system]
requires = ["setuptools>=61.2", "wheel", "setuptools_scm[toml]>=6.0"]
requires = ["setuptools>=61.2", "setuptools_scm[toml]>=6.0"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -26,6 +26,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
]
requires-python = ">=3.8"
Expand All @@ -35,10 +36,12 @@ dependencies = [
"requests >= 2.20",
"requests-toolbelt >= 0.8.0, != 0.9.0",
"urllib3 >= 1.26.0",
"importlib-metadata >= 3.6",
"keyring >= 15.1",
"importlib-metadata >= 3.6; python_version < '3.10'",
# workaround for missing binaries on these platforms, see #1158
"keyring >= 15.1; platform_machine != 'ppc64le' and platform_machine != 's390x'",
"rfc3986 >= 1.4.0",
"rich >= 12.0.0",
"packaging",
]
dynamic = ["version"]

Expand All @@ -57,14 +60,14 @@ check = "twine.commands.check:main"
upload = "twine.commands.upload:main"
register = "twine.commands.register:main"

[project.optional-dependencies]
keyring = ["keyring >= 15.1"]

[project.scripts]
twine = "twine.__main__:main"

[tool.setuptools]
packages = [
"twine",
"twine.commands",
]
packages = ["twine", "twine.commands"]
include-package-data = true
license-files = ["LICENSE"]

Expand Down
27 changes: 27 additions & 0 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import getpass
import logging
import platform
import re

import pytest
Expand All @@ -26,6 +27,15 @@ def get_credential(system, user):
assert username == "entered user"


def test_get_username_keyring_not_installed_defers_to_prompt(
monkeypatch, entered_username, config
):
monkeypatch.setattr(auth, "keyring", None)

username = auth.Resolver(config, auth.CredentialInput()).username
assert username == "entered user"


def test_get_password_keyring_defers_to_prompt(monkeypatch, entered_password, config):
class MockKeyring:
@staticmethod
Expand All @@ -38,6 +48,15 @@ def get_password(system, user):
assert pw == "entered pw"


def test_get_password_keyring_not_installed_defers_to_prompt(
monkeypatch, entered_password, config
):
monkeypatch.setattr(auth, "keyring", None)

pw = auth.Resolver(config, auth.CredentialInput("user")).password
assert pw == "entered pw"


def test_no_password_defers_to_prompt(monkeypatch, entered_password, config):
config.update(password=None)
pw = auth.Resolver(config, auth.CredentialInput("user")).password
Expand Down Expand Up @@ -272,3 +291,11 @@ def test_warns_for_empty_password(
assert auth.Resolver(config, auth.CredentialInput()).password == password

assert caplog.messages[0].startswith(warning)


@pytest.mark.skipif(
platform.machine() in {"ppc64le", "s390x"},
reason="keyring module is optional on ppc64le and s390x",
)
def test_keyring_module():
assert auth.keyring is not None
20 changes: 11 additions & 9 deletions tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_fails_no_distributions(caplog):
]


def build_sdist(src_path, project_files):
def build_package(src_path, project_files, distribution="sdist"):
"""
Build a source distribution similar to `python3 -m build --sdist`.
Expand All @@ -70,12 +70,13 @@ def build_sdist(src_path, project_files):
(src_path / filename).write_text(textwrap.dedent(content))

builder = build.ProjectBuilder(src_path)
return builder.build("sdist", str(src_path / "dist"))
return builder.build(distribution, str(src_path / "dist"))


@pytest.mark.parametrize("distribution", ["sdist", "wheel"])
@pytest.mark.parametrize("strict", [False, True])
def test_warns_missing_description(strict, tmp_path, capsys, caplog):
sdist = build_sdist(
def test_warns_missing_description(distribution, strict, tmp_path, capsys, caplog):
sdist = build_package(
tmp_path,
{
"setup.cfg": (
Expand All @@ -86,6 +87,7 @@ def test_warns_missing_description(strict, tmp_path, capsys, caplog):
"""
),
},
distribution=distribution,
)

assert check.check([sdist], strict=strict) is strict
Expand All @@ -109,7 +111,7 @@ def test_warns_missing_description(strict, tmp_path, capsys, caplog):


def test_warns_missing_file(tmp_path, capsys, caplog):
sdist = build_sdist(
sdist = build_package(
tmp_path,
{
"setup.cfg": (
Expand Down Expand Up @@ -138,7 +140,7 @@ def test_warns_missing_file(tmp_path, capsys, caplog):


def test_fails_rst_syntax_error(tmp_path, capsys, caplog):
sdist = build_sdist(
sdist = build_package(
tmp_path,
{
"setup.cfg": (
Expand Down Expand Up @@ -174,7 +176,7 @@ def test_fails_rst_syntax_error(tmp_path, capsys, caplog):


def test_fails_rst_no_content(tmp_path, capsys, caplog):
sdist = build_sdist(
sdist = build_package(
tmp_path,
{
"setup.cfg": (
Expand Down Expand Up @@ -211,7 +213,7 @@ def test_fails_rst_no_content(tmp_path, capsys, caplog):


def test_passes_rst_description(tmp_path, capsys, caplog):
sdist = build_sdist(
sdist = build_package(
tmp_path,
{
"setup.cfg": (
Expand Down Expand Up @@ -243,7 +245,7 @@ def test_passes_rst_description(tmp_path, capsys, caplog):

@pytest.mark.parametrize("content_type", ["text/markdown", "text/plain"])
def test_passes_markdown_description(content_type, tmp_path, capsys, caplog):
sdist = build_sdist(
sdist = build_package(
tmp_path,
{
"setup.cfg": (
Expand Down
Loading

0 comments on commit dcb3b91

Please sign in to comment.