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
hugovk authored Jan 15, 2025
2 parents 624d06d + 962ba5c commit 42f829e
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
extend-ignore = C408,E203,F841,W503
max-complexity = 10
max-complexity = 12
max-line-length = 88
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
authors:
- dependabot
- pre-commit-ci
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
permissions:
contents: read

env:
FORCE_COLOR: 1

jobs:
# Always build & lint package.
build-package:
Expand All @@ -21,6 +24,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: hynek/build-and-inspect-python-package@v2

Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: pip
cache-dependency-path: .github/workflows/lint.yml
- uses: pre-commit/[email protected]
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade safety
python -m pip install --editable .
- run: safety check
- uses: tox-dev/action-pre-commit-uv@v1
- run: uvx safety check
22 changes: 14 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: tests

on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

env:
FORCE_COLOR: 1

Expand All @@ -11,28 +14,31 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
- uses: actions/checkout@v4
with:
# fetch all branches and tags
# ref actions/checkout#448
fetch-depth: 0
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
cache-dependency-path: pyproject.toml
- name: Install tox
run: |
python -m pip install tox

- name: Install uv
uses: hynek/setup-cached-uv@v2

- name: Run tests
run: tox -e py
run: uvx --with tox-uv tox -e py

- name: Upload coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
flags: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,9 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.gitignore.io/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs

# hatch-vcs
cherry_picker/_version.py

# Ignore uv.lock
uv.lock
19 changes: 9 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
rev: v0.8.6
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

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

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -25,38 +25,37 @@ repos:
- id: trailing-whitespace

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

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

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.14.1
hooks:
- id: mypy
args:
[
--ignore-missing-imports,
--install-types,
--non-interactive,
--pretty,
--show-error-codes,
.,
]
pass_filenames: false
additional_dependencies: ["types-requests"]

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

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

Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 2.4.0

- Add support for Python 3.14 ([PR 145](https://github.com/python/cherry-picker/pull/145)
- Allow passing a base branch that doesn't have version info
([PR 70](https://github.com/python/cherry-picker/pull/70)
- This makes cherry-picker useful for projects other than CPython that don't
have versioned branch names.

## 2.3.0

- Add support for Python 3.13
([PR 127](https://github.com/python/cherry-picker/pull/127),
[PR 134](https://github.com/python/cherry-picker/pull/134))
- Drop support for EOL Python 3.8
([PR 133](https://github.com/python/cherry-picker/pull/133),
[PR 137](https://github.com/python/cherry-picker/pull/137))
- Resolve usernames when the remote ends with a trailing slash ([PR 110](https://github.com/python/cherry-picker/pull/110))
- Optimize `validate_sha()` with `--max-count=1` ([PR 111](https://github.com/python/cherry-picker/pull/111))
- Make # replacing more strict ([PR 115](https://github.com/python/cherry-picker/pull/115))
- Remove multiple commit prefixes ([PR 118](https://github.com/python/cherry-picker/pull/118))
- Handle whitespace when calculating usernames ([PR 132](https://github.com/python/cherry-picker/pull/132))
- Publish to PyPI using Trusted Publishers ([PR 94](https://github.com/python/cherry-picker/pull/94))
- Generate digital attestations for PyPI ([PEP 740](https://peps.python.org/pep-0740/))
([PR 135](https://github.com/python/cherry-picker/pull/135))

## 2.2.0

- Add log messages
Expand Down
57 changes: 32 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ Write tests using [pytest](https://docs.pytest.org/).

## Setup info

Requires Python 3.8+.

```console
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install cherry_picker
```

The cherry picking script assumes that if an `upstream` remote is defined, then
The cherry-picking script assumes that if an `upstream` remote is defined, then
it should be used as the source of upstream changes and as the base for
cherry-pick branches. Otherwise, `origin` is used for that purpose.
You can override this behavior with the `--upstream-remote` option
Expand Down Expand Up @@ -139,33 +137,42 @@ repo = "aiohttp"
check_sha = "f382b5ffc445e45a110734f5396728da7914aeb6"
fix_commit_msg = false
default_branch = "devel"
require_version_in_branch_name = false
draft_pr = false
```

Available config options:

```
team github organization or individual nick,
e.g "aio-libs" for https://github.com/aio-libs/aiohttp
("python" by default)
repo github project name,
e.g "aiohttp" for https://github.com/aio-libs/aiohttp
("cpython" by default)
check_sha A long hash for any commit from the repo,
e.g. a sha1 hash from the very first initial commit
("7f777ed95a19224294949e1b4ce56bbffcb1fe9f" by default)
fix_commit_msg Replace # with GH- in cherry-picked commit message.
It is the default behavior for CPython because of external
Roundup bug tracker (https://bugs.python.org) behavior:
#xxxx should point on issue xxxx but GH-xxxx points
on pull-request xxxx.
For projects using GitHub Issues, this option can be disabled.
default_branch Project's default branch name,
e.g "devel" for https://github.com/ansible/ansible
("main" by default)
team github organization or individual nick,
e.g "aio-libs" for https://github.com/aio-libs/aiohttp
("python" by default)
repo github project name,
e.g "aiohttp" for https://github.com/aio-libs/aiohttp
("cpython" by default)
check_sha A long hash for any commit from the repo,
e.g. a sha1 hash from the very first initial commit
("7f777ed95a19224294949e1b4ce56bbffcb1fe9f" by default)
fix_commit_msg Replace # with GH- in cherry-picked commit message.
It is the default behavior for CPython because of external
Roundup bug tracker (https://bugs.python.org) behavior:
#xxxx should point on issue xxxx but GH-xxxx points
on pull-request xxxx.
For projects using GitHub Issues, this option can be disabled.
default_branch Project's default branch name,
e.g "devel" for https://github.com/ansible/ansible
("main" by default)
require_version_in_branch_name Allow backporting to branches whose names don't contain
something that resembles a version number
(i.e. at least two dot-separated numbers).
draft_pr Create PR as draft
(false by default)
```

To customize the tool for used by other project:
Expand Down
4 changes: 2 additions & 2 deletions cherry_picker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

from __future__ import annotations

import importlib.metadata
from ._version import __version__

__version__ = importlib.metadata.version(__name__)
__all__ = ["__version__"]
Loading

0 comments on commit 42f829e

Please sign in to comment.