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

Drop support for Python 3.6 #869

Merged
merged 5 commits into from Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Expand Up @@ -9,7 +9,7 @@ on:
env:
FORCE_COLOR: "1"
TOX_TESTENV_PASSENV: "FORCE_COLOR"
MIN_PYTHON_VERSION: "3.6"
MIN_PYTHON_VERSION: "3.7"
DEFAULT_PYTHON_VERSION: "3.9"

jobs:
Expand All @@ -29,7 +29,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Expand Up @@ -15,7 +15,7 @@ formats:

python:
# Mininum supported Python version
version: "3.6"
version: "3.7"
# Install twine first, because RTD uses `--upgrade-strategy eager`,
# which installs the latest version of docutils via readme_renderer.
# However, Sphinx 4.2.0 requires docutils>=0.14,<0.18.
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -286,7 +286,7 @@

# TODO: Try to add these to intersphinx_mapping
nitpick_ignore_regex = [
(r"py:.*", r"(pkginfo|IO).*"),
(r"py:.*", r"pkginfo.*"),
]

# -- Options for apidoc output ------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Expand Up @@ -23,7 +23,6 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -34,7 +33,7 @@ classifiers =
packages =
twine
twine.commands
python_requires = >=3.6
python_requires = >=3.7
install_requires=
pkginfo >= 1.8.1
readme_renderer >= 21.0
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 3.3
envlist = lint,types,py{36,37,38,39,310},integration,docs
envlist = lint,types,py{37,38,39,310},integration,docs
isolated_build = True

[testenv]
Expand Down
6 changes: 4 additions & 2 deletions twine/settings.py
Expand Up @@ -11,11 +11,13 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
from __future__ import annotations

# limitations under the License.
import argparse
import contextlib
import logging
from typing import Any, ContextManager, Optional, cast
from typing import Any, Optional, cast

from twine import auth
from twine import exceptions
Expand Down Expand Up @@ -136,7 +138,7 @@ def password(self) -> Optional[str]:
# Workaround for https://github.com/python/mypy/issues/5858
return cast(Optional[str], self.auth.password)

def _allow_noninteractive(self) -> ContextManager[None]:
def _allow_noninteractive(self) -> contextlib.AbstractContextManager[None]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This avoids an error in the docs build:

WARNING: py:obj reference target not found: typing.AbstractContextManager

By taking advantage of PEP 585 via from __future__ import annotations (noting that typing.ContextManager is deprecated in Python 3.9). There's a lot more that could be done, e.g. replacing Dict with dict and Optional[str] with str | None, but I think that would be best handled in a separate PR.

"""Bypass NonInteractive error when client cert is present."""
suppressed = (exceptions.NonInteractive,) if self.client_cert else ()
return contextlib.suppress(*suppressed)
Expand Down