Skip to content

Commit

Permalink
Merge branch 'main' into revert-129
Browse files Browse the repository at this point in the history
  • Loading branch information
ezio-melotti authored Oct 6, 2024
2 parents 0c2113b + 7543a08 commit 624d06d
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
Expand Down
74 changes: 33 additions & 41 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,42 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: pyupgrade
args: [--py38-plus]
- id: ruff
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.8.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--add-import=from __future__ import annotations]

- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
args: ["--skip=B101,B404,B603"]

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
[
flake8-2020,
flake8-bugbear,
flake8-comprehensions,
flake8-implicit-str-concat,
flake8-logging,
]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-submodules
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.1
hooks:
- id: mypy
args:
Expand All @@ -69,20 +51,30 @@ repos:
pass_filenames: false

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.6.0
rev: 2.2.4
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
rev: v0.19
hooks:
- id: validate-pyproject

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.4.1
hooks:
- id: tox-ini-fmt

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: [--ignore-words-list=commitish]

- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

ci:
autoupdate_schedule: quarterly
4 changes: 2 additions & 2 deletions cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def sorted_branches(self):
@property
def username(self):
cmd = ["git", "config", "--get", f"remote.{self.pr_remote}.url"]
result = self.run_cmd(cmd, required_real_result=True)
result = self.run_cmd(cmd, required_real_result=True).strip()
# implicit ssh URIs use : to separate host from user, others just use /
username = result.replace(":", "/").rstrip("/").split("/")[-2]
return username
Expand Down Expand Up @@ -702,7 +702,7 @@ def is_mirror(self) -> bool:
return out.startswith("true")


CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}


@click.command(context_settings=CONTEXT_SETTINGS)
Expand Down
4 changes: 4 additions & 0 deletions cherry_picker/test_cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ def test_get_pr_url(config):
b"https://github.com/mock_user/cpython.git",
b"https://github.com/mock_user/cpython",
b"https://github.com/mock_user/cpython/",
# test trailing whitespace
b"https://github.com/mock_user/cpython.git\n",
b"https://github.com/mock_user/cpython\n",
b"https://github.com/mock_user/cpython/\n",
],
)
def test_username(url, config):
Expand Down
48 changes: 36 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ requires = [
[project]
name = "cherry-picker"
readme = "README.md"
maintainers = [{ name = "Python Core Developers", email = "core-workflow@python.org" }]
authors = [{ name = "Mariatta Wijaya", email = "mariatta@python.org" }]
maintainers = [ { name = "Python Core Developers", email = "core-workflow@python.org" } ]
authors = [ { name = "Mariatta Wijaya", email = "mariatta@python.org" } ]
requires-python = ">=3.8"
classifiers = [
"Intended Audience :: Developers",
Expand All @@ -20,27 +20,24 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = [
"description",
"version",
]
dependencies = [
"cffi>=v1.17.0rc1", # remove once v1.17.0 is out; add 3.13 classifier above (see #127)
"click>=6",
"gidgethub",
"requests",
'tomli>=1.1; python_version < "3.11"',
"tomli>=1.1; python_version<'3.11'",
]
[project.optional-dependencies]
dev = [
optional-dependencies.dev = [
"pytest",
"pytest-cov",
]
[project.urls]
"Homepage" = "https://github.com/python/cherry-picker"
[project.scripts]
cherry_picker = "cherry_picker.cherry_picker:cherry_pick_cli"
urls.Homepage = "https://github.com/python/cherry-picker"
scripts.cherry_picker = "cherry_picker.cherry_picker:cherry_pick_cli"

[tool.hatch.version]
source = "vcs"
Expand All @@ -50,5 +47,32 @@ tag-pattern = '^cherry-picker-(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

[tool.isort]
profile = "black"
[tool.ruff]
fix = true

lint.select = [
"C4", # flake8-comprehensions
"E", # pycodestyle errors
"F", # pyflakes errors
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PGH", # pygrep-hooks
"PYI", # flake8-pyi
"RUF022", # unsorted-dunder-all
"RUF100", # unused noqa (yesqa)
"S", # flake8-bandit
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
]
lint.ignore = [
"S101", # Use of assert detected
"S404", # subprocess module is possibly insecure
"S603", # subprocess call: check for execution of untrusted input
]
lint.isort.required-imports = [ "from __future__ import annotations" ]

[tool.pyproject-fmt]
max_supported_python = "3.13"
18 changes: 12 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
[tox]
envlist =
py{312, 311, 310, 39, 38}
isolated_build = true
requires =
tox>=4.2
env_list =
py{313, 312, 311, 310, 39}

[testenv]
passenv =
FORCE_COLOR
extras =
dev
pass_env =
FORCE_COLOR
commands =
{envpython} -m pytest --cov cherry_picker --cov-report html --cov-report term --cov-report xml {posargs}
{envpython} -m pytest \
--cov cherry_picker \
--cov-report html \
--cov-report term \
--cov-report xml \
{posargs}

0 comments on commit 624d06d

Please sign in to comment.