Skip to content

Commit

Permalink
Move to 3.12
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Dec 2, 2023
1 parent f130306 commit 4078f62
Show file tree
Hide file tree
Showing 57 changed files with 463 additions and 946 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/create_tests_package_lists.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Create tests package lists for offline tests
on:
workflow_dispatch:

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true
jobs:
create_package_lists:
name: Create package lists
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/exhaustive_package_test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Exhaustive Package Test (slow)
on:
workflow_dispatch:

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true
jobs:
test_all_packages:
name: Exhaustive Package Test
Expand All @@ -10,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

env:
default-python: "3.11"
default-python: "3.12"

jobs:
testpypi-publish:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
name: tests

on:
pull_request:
push:
tags-ignore: ["**"]
pull_request:
schedule:
- cron: "0 8 * * *"
concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

# If changing default-python be sure to change job "tests" matrix: include: also
env:
default-python: "3.11"
default-python: "3.12"

jobs:
lint:
Expand Down Expand Up @@ -55,12 +61,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]
include:
- os: windows-latest
python-version: "3.11"
python-version: "3.12"
- os: macos-latest
python-version: "3.11"
python-version: "3.12"

steps:
- uses: actions/checkout@v4
Expand Down
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ repos:
- id: check-added-large-files
- id: trailing-whitespace
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.5.2"
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.10.1
- id: pyproject-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: black
- id: ruff-format
- id: ruff
args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
# mypy args:
# must include --ignore-missing-imports for mypy. It is included by default
# if no arguments are supplied, but we must supply it ourselves since we
# specify args
# cannot use --warn-unused-ignores because it conflicts with
# --ignore-missing-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.7.1
hooks:
- id: mypy
args: ['--warn-unused-ignores', '--strict-equality','--no-implicit-optional']
args: ['--warn-unused-ignores', '--strict-equality','--no-implicit-optional', '--check-untyped-defs']
exclude: 'testdata/test_package_specifier/local_extras/setup.py'
5 changes: 1 addition & 4 deletions .readthedocs.yaml → .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
commands:
- pip install nox
- nox --session build_docs -- "${READTHEDOCS_OUTPUT}"/html
48 changes: 27 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,45 +52,51 @@ nox -l

At the time of this writing, the output looks like this
```
- refresh_packages_cache-3.6 -> Populate .pipx_tests/package_cache
- refresh_packages_cache-3.7 -> Populate .pipx_tests/package_cache
- refresh_packages_cache-3.8 -> Populate .pipx_tests/package_cache
- refresh_packages_cache-3.12 -> Populate .pipx_tests/package_cache
- refresh_packages_cache-3.11 -> Populate .pipx_tests/package_cache
- refresh_packages_cache-3.10 -> Populate .pipx_tests/package_cache
- refresh_packages_cache-3.9 -> Populate .pipx_tests/package_cache
- tests_internet-3.6 -> Tests using internet pypi only
- tests_internet-3.7 -> Tests using internet pypi only
- tests_internet-3.8 -> Tests using internet pypi only
- refresh_packages_cache-3.8 -> Populate .pipx_tests/package_cache
- tests_internet-3.12 -> Tests using internet pypi only
- tests_internet-3.11 -> Tests using internet pypi only
- tests_internet-3.10 -> Tests using internet pypi only
- tests_internet-3.9 -> Tests using internet pypi only
* tests-3.6 -> Tests using local pypiserver only
* tests-3.7 -> Tests using local pypiserver only
* tests-3.8 -> Tests using local pypiserver only
- tests_internet-3.8 -> Tests using internet pypi only
* tests-3.12 -> Tests using local pypiserver only
* tests-3.11 -> Tests using local pypiserver only
* tests-3.10 -> Tests using local pypiserver only
* tests-3.9 -> Tests using local pypiserver only
- test_all_packages-3.6
- test_all_packages-3.7
- test_all_packages-3.8
* tests-3.8 -> Tests using local pypiserver only
- test_all_packages-3.12
- test_all_packages-3.11
- test_all_packages-3.10
- test_all_packages-3.9
- test_all_packages-3.8
- cover -> Coverage analysis
* lint
- develop-3.6
- develop-3.7
- develop-3.8
- develop-3.12
- develop-3.11
- develop-3.10
- develop-3.9
- develop-3.8
- build
- publish
* build_docs
- publish_docs
- watch_docs
* build_man
- pre_release
- post_release
- create_test_package_list-3.6
- create_test_package_list-3.7
- create_test_package_list-3.8
- create_test_package_list-3.12
- create_test_package_list-3.11
- create_test_package_list-3.10
- create_test_package_list-3.9
- create_test_package_list-3.8
```

### Unit Tests
To run unit tests in Python3.9, you can run
To run unit tests in Python3.12, you can run
```
nox -s tests-3.9
nox -s tests-3.12
```

!!! tip
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
pipx install pycowsay
pipx install --python python3.10 pycowsay
pipx install --python 3.11 pycowsay
pipx install --python 3.12 pycowsay
pipx install git+https://github.com/psf/black
pipx install git+https://github.com/psf/black.git@branch-name
pipx install git+https://github.com/psf/black.git@git-hash
Expand Down
40 changes: 13 additions & 27 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

import nox # type: ignore

PYTHON_ALL_VERSIONS = ["3.8", "3.9", "3.10", "3.11"]
PYTHON_DEFAULT_VERSION = "3.11"
PYTHON_ALL_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]
PYTHON_DEFAULT_VERSION = "3.12"
DOC_DEPENDENCIES = [".", "jinja2", "mkdocs", "mkdocs-material"]
MAN_DEPENDENCIES = [".", "argparse-manpage[setuptools]"]
LINT_DEPENDENCIES = [
"black==23.10.1",
"mypy==1.6.1",
"mypy==1.7.1",
"packaging>=20.0",
"ruff==0.1.3",
"ruff==0.1.6",
"types-jinja2",
]
# Packages whose dependencies need an intact system PATH to compile
Expand Down Expand Up @@ -51,11 +50,7 @@ def prebuild_wheels(session, prebuild_dict):

def has_changes():
status = (
subprocess.run(
"git status --porcelain", shell=True, check=True, stdout=subprocess.PIPE
)
.stdout.decode()
.strip()
subprocess.run("git status --porcelain", shell=True, check=True, stdout=subprocess.PIPE).stdout.decode().strip()
)
return len(status) > 0

Expand Down Expand Up @@ -103,7 +98,7 @@ def tests_with_options(session, net_pypiserver):
if net_pypiserver:
pypiserver_option = ["--net-pypiserver"]
else:
session.install("pypiserver[passlib]")
session.install("pypiserver[passlib]", 'setuptools; python_version>="3.12"')
refresh_packages_cache(session)
pypiserver_option = []

Expand Down Expand Up @@ -152,16 +147,14 @@ def cover(session):
def lint(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*LINT_DEPENDENCIES)
files = [str(Path("src") / "pipx"), "tests", "scripts"] + [
str(p) for p in Path(".").glob("*.py")
]
files = [str(Path("src") / "pipx"), "tests", "scripts"] + [str(p) for p in Path(".").glob("*.py")]
session.run("ruff", *files)
session.run("black", "--check", *files)
session.run(
"mypy",
"--strict-equality",
"--no-implicit-optional",
"--warn-unused-ignores",
"--check-untyped-defs",
*files,
)

Expand All @@ -170,7 +163,7 @@ def lint(session):
def develop(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*DOC_DEPENDENCIES, *LINT_DEPENDENCIES)
session.install("-e", ".")
session.install("-e", ".", "pytest", "pypiserver[passlib]", 'setuptools; python_version>="3.12"')


@nox.session(python=PYTHON_DEFAULT_VERSION)
Expand All @@ -196,9 +189,7 @@ def build_docs(session):
site_dir = session.posargs or ["site/"]
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*DOC_DEPENDENCIES)
session.env[
"PIPX__DOC_DEFAULT_PYTHON"
] = "typically the python used to execute pipx"
session.env["PIPX__DOC_DEFAULT_PYTHON"] = "typically the python used to execute pipx"
session.run("python", "scripts/generate_docs.py")
session.run("mkdocs", "build", "--strict", "--site-dir", *site_dir)

Expand All @@ -214,9 +205,7 @@ def watch_docs(session):
def build_man(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*MAN_DEPENDENCIES)
session.env[
"PIPX__DOC_DEFAULT_PYTHON"
] = "typically the python used to execute pipx"
session.env["PIPX__DOC_DEFAULT_PYTHON"] = "typically the python used to execute pipx"
session.run("python", "scripts/generate_man.py")


Expand Down Expand Up @@ -247,17 +236,14 @@ def post_release(session):
session.run("git", "--no-pager", "diff", external=True)
print("")
session.log(
"If `git diff` above looks ok, execute the following command:\n\n"
" git commit -a -m 'Post-release.'\n"
"If `git diff` above looks ok, execute the following command:\n\n" " git commit -a -m 'Post-release.'\n"
)


@nox.session(python=PYTHON_ALL_VERSIONS)
def create_test_package_list(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
output_dir = (
session.posargs[0] if session.posargs else str(PIPX_TESTS_PACKAGE_LIST_DIR)
)
output_dir = session.posargs[0] if session.posargs else str(PIPX_TESTS_PACKAGE_LIST_DIR)
session.run(
"python",
"scripts/list_test_packages.py",
Expand Down
33 changes: 21 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
[build-system]
requires = ["hatchling>=0.15.0"]
build-backend = "hatchling.build"
requires = [
"hatchling>=0.15",
]

[project]
name = "pipx"
description = "Install and Run Python Applications in Isolated Environments"
readme = "README.md"
keywords = [
"cli",
"install",
"pip",
"Virtual Environment",
"workflow",
]
license = "MIT"
requires-python = ">=3.8"
keywords = ["pip", "install", "cli", "workflow", "Virtual Environment"]
authors = [{ name = "Chad Smith", email = "chadsmith.software@gmail.com" }]
requires-python = ">=3.8"
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
Expand All @@ -19,22 +27,23 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = [
"version",
]
dependencies = [
"argcomplete>=1.9.4",
"colorama>=0.4.4; sys_platform == 'win32'",
"packaging>=20.0",
"platformdirs>=2.1.0",
"tomli; python_version < '3.11'",
"userpath>=1.6.0,!=1.9.0",
'colorama>=0.4.4; sys_platform == "win32"',
"packaging>=20",
"platformdirs>=2.1",
'tomli; python_version < "3.11"',
"userpath!=1.9.0,>=1.6",
]
dynamic = ["version"]

[project.urls]
"Bug Tracker" = "https://github.com/pypa/pipx/issues"
Documentation = "https://pypa.github.io/pipx/"
"Source Code" = "https://github.com/pypa/pipx"
"Bug Tracker" = "https://github.com/pypa/pipx/issues"

[project.scripts]
pipx = "pipx.main:cli"

Expand Down
4 changes: 1 addition & 3 deletions scripts/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def get_help(pipxcmd: Optional[str]) -> str:
cmd = ["pipx", "--help"]

helptext = (
subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
.stdout.decode()
.replace(os.path.expanduser("~"), "~")
subprocess.run(cmd, stdout=subprocess.PIPE, check=True).stdout.decode().replace(os.path.expanduser("~"), "~")
)
return f"""
```
Expand Down
Loading

0 comments on commit 4078f62

Please sign in to comment.