Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settings: remove old mypy workarounds #1029

Merged
merged 5 commits into from
Nov 24, 2023
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
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ concurrency:
env:
FORCE_COLOR: "1"
TOX_TESTENV_PASSENV: "FORCE_COLOR"
MIN_PYTHON_VERSION: "3.7"
DEFAULT_PYTHON_VERSION: "3.9"
MIN_PYTHON_VERSION: "3.8"
DEFAULT_PYTHON_VERSION: "3.10"

permissions:
contents: read
Expand All @@ -38,10 +38,11 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
platform:
- ubuntu-latest
- macos-latest
Expand Down
4 changes: 3 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
doc8>=0.8.0
furo>=2021.10.09
readme-renderer>=17.4
Sphinx>=4.3.1
# Remove this upper bound when twine's minimum Python is 3.9+.
# See: https://github.com/sphinx-doc/sphinx/issues/11767
Sphinx>=6,<7.1
Comment on lines +4 to +6
Copy link
Member Author

Choose a reason for hiding this comment

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

NB: This is my temporary hack for working around sphinx-doc/sphinx#11767.

Another option here would be to do the docs build in CI on Python 3.9 or newer, since those don't seem to be affected. But I wasn't sure if tox -e docs was expected to work on all supported Python versions or not 🙂

sphinxcontrib-programoutput>=0.17
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython

[options]
packages =
twine
twine.commands
python_requires = >=3.7
python_requires = >=3.8
install_requires=
pkginfo >= 1.8.1
readme-renderer >= 35.0
Expand Down
8 changes: 6 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 3.3
envlist = lint,types,py{37,38,39,310},integration,docs
minversion = 3.8
envlist = lint,types,py{38,39,310,311,312},integration,docs
isolated_build = True

[testenv]
Expand All @@ -10,6 +10,10 @@ deps =
pytest-socket
build
coverage
# Needed on 3.12 and newer due to setuptools not being pre-installed
# in fresh venvs.
# See: https://github.com/python/cpython/issues/95299
setuptools
passenv =
PYTEST_ADDOPTS
commands =
Expand Down
6 changes: 2 additions & 4 deletions twine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,12 @@ def __init__(

@property
def username(self) -> Optional[str]:
# Workaround for https://github.com/python/mypy/issues/5858
return cast(Optional[str], self.auth.username)
return self.auth.username

@property
def password(self) -> Optional[str]:
with self._allow_noninteractive():
# Workaround for https://github.com/python/mypy/issues/5858
return cast(Optional[str], self.auth.password)
return self.auth.password

def _allow_noninteractive(self) -> "contextlib.AbstractContextManager[None]":
"""Bypass NonInteractive error when client cert is present."""
Expand Down