Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/1116-pkginfo-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco authored Sep 6, 2024
2 parents e23ffaa + ae71822 commit c577765
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.2.0
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- name: Install dependencies
Expand All @@ -50,7 +50,7 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.2.0
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install dependencies
Expand All @@ -80,7 +80,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.2.0
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install dependencies
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.2.0
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: "actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29"

- name: "Setup Python"
uses: "actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d"
uses: "actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3"
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@50769540e7f4bd5e21e526ee35c689e35e0d6874"
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@8a08d616893759ef8e1aa1f2785787c0b97e20d6"
1 change: 1 addition & 0 deletions changelog/1024.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only require ``importlib_metadata`` on older Pythons.
6 changes: 5 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,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
2 changes: 1 addition & 1 deletion 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 Down
2 changes: 2 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def sampleproject_dist(tmp_path_factory: pytest.TempPathFactory):
)


@pytest.mark.xfail(reason="service is unreliable (#684)")
def test_pypi_upload(sampleproject_dist):
command = [
"upload",
Expand All @@ -84,6 +85,7 @@ def test_pypi_upload(sampleproject_dist):
cli.dispatch(command)


@pytest.mark.xfail(reason="service is unreliable (#684)")
def test_pypi_error(sampleproject_dist, monkeypatch, capsys):
command = [
"twine",
Expand Down
8 changes: 6 additions & 2 deletions twine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@

__copyright__ = "Copyright 2019 Donald Stufft and individual contributors"

import email
import email.utils
import sys

import importlib_metadata
if sys.version_info >= (3, 10):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata

metadata = importlib_metadata.metadata("twine")

Expand Down
14 changes: 10 additions & 4 deletions twine/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
# limitations under the License.
import argparse
import logging.config
import sys
from typing import Any, List, Tuple

import importlib_metadata
if sys.version_info >= (3, 10):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata

import rich
import rich.highlighter
import rich.logging
Expand Down Expand Up @@ -70,14 +75,15 @@ def configure_output() -> None:


def list_dependencies_and_versions() -> List[Tuple[str, str]]:
deps = (
"importlib-metadata",
deps = [
"keyring",
"pkginfo",
"requests",
"requests-toolbelt",
"urllib3",
)
]
if sys.version_info < (3, 10):
deps.append("importlib-metadata")
return [(dep, importlib_metadata.version(dep)) for dep in deps]


Expand Down
7 changes: 6 additions & 1 deletion twine/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import re
import subprocess
import sys
import warnings
from typing import (
Any,
Expand All @@ -32,7 +33,11 @@
cast,
)

import importlib_metadata
if sys.version_info >= (3, 10):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata

import packaging.version
import pkginfo
from rich import print
Expand Down
4 changes: 2 additions & 2 deletions twine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def register_argparse_arguments(parser: argparse.ArgumentParser) -> None:
env="TWINE_USERNAME",
required=False,
help="The username to authenticate to the repository "
"(package index) as. (Can also be set via "
"%(env)s environment variable.)",
"(package index) as. Has no effect on PyPI or TestPyPI. "
"(Can also be set via %(env)s environment variable.)",
)
parser.add_argument(
"-p",
Expand Down

0 comments on commit c577765

Please sign in to comment.