Skip to content

Commit 6e5c54c

Browse files
authored
Update using PyScaffold 4.6 (#8)
2 parents 0e7f107 + e24f751 commit 6e5c54c

File tree

7 files changed

+84
-85
lines changed

7 files changed

+84
-85
lines changed

.cirrus.yml

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
# ---- Default values to be merged into tasks ----
99

1010
env:
11-
LC_ALL: C.UTF-8
12-
LANG: C.UTF-8
11+
LC_ALL: C
12+
LC_CTYPE: UTF-8
13+
LANG: C
1314
PIP_CACHE_DIR: ${CIRRUS_WORKING_DIR}/.cache/pip
1415
PRE_COMMIT_HOME: ${CIRRUS_WORKING_DIR}/.cache/pre-commit
16+
CIRRUS_ARTIFACT_URL: https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}
1517
# Coveralls configuration
1618
CI_NAME: cirrus-ci
1719
CI_BRANCH: ${CIRRUS_BRANCH}
@@ -49,12 +51,16 @@ env:
4951
alias: test
5052
depends_on: [build]
5153
<<: *task-template
52-
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
54+
download_artifact_script: &download-artifact
55+
- curl -L -O ${CIRRUS_ARTIFACT_URL}/build/upload/dist.tar.gz
56+
- tar xzf dist.tar.gz
57+
- rm dist.tar.gz
5358
test_script:
5459
- tox --installpkg dist/*.whl -- -rfEx --durations 10 --color yes
5560
submit_coverage_script:
5661
- pipx run coverage xml -o coverage.xml
57-
- pipx run coveralls --submit coverage.xml
62+
- pipx run 'coveralls<4' --submit coverage.xml
63+
# ^-- https://github.com/TheKevJames/coveralls-python/issues/434
5864

5965
# Deep clone script for POSIX environments (required for setuptools-scm)
6066
.clone_script: &clone |
@@ -70,113 +76,108 @@ env:
7076
# ---- CI Pipeline ----
7177

7278
build_task:
73-
name: build (Linux - 3.10)
79+
name: build and check (Linux - 3.11)
7480
alias: build
75-
container: {image: "python:3.10-bullseye"}
81+
container: {image: "python:3.11-bullseye"}
7682
clone_script: *clone
77-
dist_cache: # build once and upload to be used by other tasks
78-
folder: dist
79-
fingerprint_script: echo $CIRRUS_BUILD_ID
80-
reupload_on_changes: true
81-
<<: *task-template
82-
install_script: pip install tox
83-
build_script: tox -e clean,build
84-
85-
check_task:
86-
name: check (Linux - 3.11)
87-
alias: check
88-
depends_on: [build]
89-
container: {image: "python:3.11-bullseye"} # most recent => better types
90-
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
9183
<<: *task-template
92-
install_script: pip install tox
84+
install_script: pip install tox pre-commit
85+
build_script:
86+
- tox -e clean,build
87+
- tar czf dist.tar.gz dist
9388
check_script: tox --installpkg dist/*.whl -e lint,typecheck
89+
upload_artifacts:
90+
path: dist.tar.gz
9491

9592
linux_task:
9693
matrix:
97-
- name: test (Linux - 3.7)
98-
container: {image: "python:3.7-bullseye"}
9994
- name: test (Linux - 3.8)
100-
container: {image: "python:3.8-bullseye"}
101-
- name: test (Linux - 3.9)
102-
container: {image: "python:3.9-bullseye"}
95+
container: {image: "python:3.8-bookworm"}
10396
- name: test (Linux - 3.10)
104-
container: {image: "python:3.10-bullseye"}
105-
- name: test (Linux - 3.11)
106-
container: {image: "python:3.11-bullseye"}
97+
container: {image: "python:3.10-bookworm"}
98+
skip: $BRANCH !=~ "^(main|master)$"
10799
- name: test (Linux - 3.12)
108-
container: {image: "python:3.12-rc-bullseye"}
109-
allow_failures: true # Experimental
100+
container: {image: "python:3.12-bookworm"}
101+
# - name: test (Linux - 3.13)
102+
# container: {image: "python:3.13-rc-bookworm"}
103+
# allow_failures: true # Experimental
110104
install_script:
111105
- python -m pip install --upgrade pip tox pipx
112106
<<: *test-template
107+
alias: base-test
113108

114109
mamba_task:
115110
name: test (Linux - mambaforge)
116111
container: {image: "condaforge/mambaforge"}
117112
install_script: # Overwrite template
118-
- mamba install -y pip pipx tox
113+
- mamba install -y pip pipx tox curl
119114
<<: *test-template
115+
depends_on: [base-test]
120116

121117
macos_task:
122118
name: test (macOS - brew)
123119
macos_instance:
124-
image: ghcr.io/cirruslabs/macos-monterey-xcode
125-
brew_cache: {folder: "$HOME/Library/Caches/Homebrew"}
126-
install_script: brew install python tox pipx
120+
image: ghcr.io/cirruslabs/macos-runner:sonoma
127121
env:
128122
PATH: "/opt/homebrew/opt/python/libexec/bin:${PATH}"
123+
brew_cache: {folder: "$HOME/Library/Caches/Homebrew"}
124+
install_script: brew install python tox pipx
129125
<<: *test-template
126+
depends_on: [build, base-test]
130127

131128
freebsd_task:
132-
name: test (freebsd - 3.9)
133-
freebsd_instance: {image_family: freebsd-13-1}
129+
name: test (freebsd - 3.11)
130+
freebsd_instance: {image_family: freebsd-14-0}
134131
install_script:
135132
- pkg remove -y python lang/python
136-
- pkg install -y git python39 py39-pip py39-gdbm py39-sqlite3 py39-tox py39-pipx py39-tomli
137-
- ln -s /usr/local/bin/python3.9 /usr/local/bin/python
133+
- pkg install -y git python311 py311-pip py311-gdbm py311-sqlite3 py311-tox py311-tomli py311-pipx
134+
- ln -s /usr/local/bin/python3.11 /usr/local/bin/python
138135
<<: *test-template
136+
depends_on: [build, base-test]
139137

140138
windows_task:
141-
name: test (Windows - 3.9.10)
139+
name: test (Windows - 3.12.5)
142140
windows_container:
143141
image: "cirrusci/windowsservercore:2019"
144142
os_version: 2019
145143
env:
146144
CIRRUS_SHELL: bash
147-
PATH: /c/Python39:/c/Python39/Scripts:/c/tools:${PATH}
145+
PATH: /c/Python312:/c/Python312/Scripts:/c/tools:${PATH}
148146
install_script:
149147
# Activate long file paths to avoid some errors
150148
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
151-
- choco install -y --no-progress python3 --version=3.9.10 --params "/NoLockdown"
149+
- choco install -y --no-progress python3 --version=3.12.5 --params "/NoLockdown"
150+
- choco install -y --no-progress curl
152151
- pip install --upgrade certifi
153152
- python -m pip install -U pip tox pipx
154153
<<: *test-template
154+
depends_on: [build, base-test]
155155

156156
finalize_task:
157157
container: {image: "python:3.10-bullseye"}
158158
depends_on: [test]
159159
<<: *task-template
160-
install_script: pip install coveralls
160+
install_script: pip install 'coveralls<4'
161+
# ^-- https://github.com/TheKevJames/coveralls-python/issues/434
161162
finalize_coverage_script: coveralls --finish
162163

163164
linkcheck_task:
164165
name: linkcheck (Linux - 3.10)
166+
only_if: $BRANCH =~ "^(main|master)$"
165167
container: {image: "python:3.10-bullseye"}
166168
depends_on: [finalize]
167169
allow_failures: true
168-
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
169170
<<: *task-template
170171
install_script: pip install tox
172+
download_artifact_script: *download-artifact
171173
linkcheck_script: tox --installpkg dist/*.whl -e linkcheck -- -q
172174

173175
publish_task:
174176
name: publish (Linux - 3.10)
175-
container: {image: "python:3.10-bullseye"}
176-
depends_on: [check, build, test]
177+
container: {image: "python:3.10-bookworm"}
178+
depends_on: [build, base-test, test]
177179
only_if: $CIRRUS_TAG =~ 'v\d.*' && $CIRRUS_USER_PERMISSION == "admin"
178180
<<: *task-template
179-
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
180181
env:
181182
TWINE_REPOSITORY: pypi
182183
TWINE_USERNAME: __token__
@@ -187,6 +188,7 @@ publish_task:
187188
# - https://pypi.org/help/#apitoken
188189
# - https://cirrus-ci.org/guide/writing-tasks/#encrypted-variables
189190
install_script: pip install tox
191+
download_artifact_script: *download-artifact
190192
publish_script:
191193
- ls dist/*
192194
- tox -e publish

.github/workflows/ci.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
# (useful to check if updates on dependencies break the package)
1818
- cron: '0 0 1,16 * *'
1919

20+
permissions:
21+
contents: read
22+
2023
concurrency:
2124
group: >-
2225
${{ github.workflow }}-${{ github.ref_type }}-
@@ -29,13 +32,12 @@ jobs:
2932
outputs:
3033
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
3134
steps:
32-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3336
with: {fetch-depth: 0} # deep clone for setuptools-scm
34-
- uses: actions/setup-python@v4
37+
- uses: actions/setup-python@v5
3538
id: setup-python
36-
with: {python-version: "3.11"}
39+
with: {python-version: "3.12"}
3740
- name: Run static analysis and format checkers
38-
run: >-
3941
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
4042
tox -e lint,typecheck
4143
- name: Build package distribution files
@@ -48,7 +50,7 @@ jobs:
4850
- name: Store the distribution files for use in other stages
4951
# `tests` and `publish` will use the same pre-built distributions,
5052
# so we make sure to release the exact same package that was tested
51-
uses: actions/upload-artifact@v3
53+
uses: actions/upload-artifact@v4
5254
with:
5355
name: python-distribution-files
5456
path: dist/
@@ -59,21 +61,21 @@ jobs:
5961
strategy:
6062
matrix:
6163
python:
62-
- "3.7" # oldest Python supported by PSF
63-
- "3.11" # newest Python that is stable
64+
- "3.8" # oldest Python supported by PSF
65+
- "3.13" # newest Python that is stable
6466
platform:
6567
- ubuntu-latest
6668
- macos-latest
6769
- windows-latest
6870
runs-on: ${{ matrix.platform }}
6971
steps:
70-
- uses: actions/checkout@v3
71-
- uses: actions/setup-python@v4
72+
- uses: actions/checkout@v4
73+
- uses: actions/setup-python@v5
7274
id: setup-python
7375
with:
7476
python-version: ${{ matrix.python }}
7577
- name: Retrieve pre-built distribution files
76-
uses: actions/download-artifact@v3
78+
uses: actions/download-artifact@v4
7779
with: {name: python-distribution-files, path: dist/}
7880
- name: Run tests
7981
run: >-
@@ -86,7 +88,7 @@ jobs:
8688
uses: coverallsapp/github-action@master
8789
with:
8890
path-to-lcov: coverage.lcov
89-
github-token: ${{ secrets.github_token }}
91+
github-token: ${{ secrets.GITHUB_TOKEN }}
9092
flag-name: ${{ matrix.platform }} - py${{ matrix.python }}
9193
parallel: true
9294

@@ -105,12 +107,14 @@ jobs:
105107
# needs: finalize
106108
# if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
107109
# runs-on: ubuntu-latest
110+
# permissions:
111+
# contents: write
108112
# steps:
109-
# - uses: actions/checkout@v3
110-
# - uses: actions/setup-python@v4
111-
# with: {python-version: "3.11"}
113+
# - uses: actions/checkout@v4
114+
# - uses: actions/setup-python@v5
115+
# with: {python-version: "3.12"}
112116
# - name: Retrieve pre-built distribution files
113-
# uses: actions/download-artifact@v3
117+
# uses: actions/download-artifact@v4
114118
# with: {name: python-distribution-files, path: dist/}
115119
# - name: Publish Package
116120
# env:

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ __pycache__/*
1414
*/.ipynb_checkpoints/*
1515
.DS_Store
1616

17-
# Automatically generated by setuptools-scm
18-
_version.py
19-
2017
# Project files
2118
.ropeproject
2219
.project

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: '^docs/conf.py'
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
5+
rev: v5.0.0
66
hooks:
77
- id: trailing-whitespace
88
- id: check-added-large-files
@@ -18,13 +18,13 @@ repos:
1818
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
1919

2020
- repo: https://github.com/asottile/pyupgrade
21-
rev: v3.15.0
21+
rev: v3.18.0
2222
hooks:
2323
- id: pyupgrade
24-
args: ['--py37-plus']
24+
args: ['--py38-plus']
2525

2626
- repo: https://github.com/PyCQA/autoflake
27-
rev: v2.2.1
27+
rev: v2.3.1
2828
hooks:
2929
- id: autoflake
3030
args: [
@@ -34,29 +34,29 @@ repos:
3434
]
3535

3636
- repo: https://github.com/PyCQA/isort
37-
rev: 5.12.0
37+
rev: 5.13.2
3838
hooks:
3939
- id: isort
4040

4141
- repo: https://github.com/psf/black
42-
rev: 23.10.0
42+
rev: 24.10.0
4343
hooks:
4444
- id: black
4545
language_version: python3
4646

47-
- repo: https://github.com/asottile/blacken-docs
48-
rev: 1.16.0
47+
- repo: https://github.com/adamchainz/blacken-docs
48+
rev: 1.19.0
4949
hooks:
5050
- id: blacken-docs
51-
additional_dependencies: [black]
51+
additional_dependencies: [black==23.*]
5252

5353
- repo: https://github.com/PyCQA/flake8
54-
rev: 6.1.0
54+
rev: 7.1.1
5555
hooks:
5656
- id: flake8
5757
additional_dependencies: [flake8-bugbear]
5858

5959
- repo: https://github.com/codespell-project/codespell
60-
rev: v2.2.6
60+
rev: v2.3.0
6161
hooks:
6262
- id: codespell

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exclude =
1414
[pyscaffold]
1515
# PyScaffold's parameters when the project was created.
1616
# This will be used when updating. Do not change!
17-
version = 4.4
17+
version = 4.6
1818
package = texted
1919
extensions =
2020
cirrus

src/texted/_edit.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ def _splitlines(text: str):
6868

6969

7070
@overload
71-
def edit(text: str, edition: Edition) -> str:
72-
...
71+
def edit(text: str, edition: Edition) -> str: ...
7372

7473

7574
@overload
76-
def edit(text: str, select: Selection, edition: Edition) -> str:
77-
...
75+
def edit(text: str, select: Selection, edition: Edition) -> str: ...
7876

7977

8078
def edit(text, select, edition=None):

src/texted/_single_selection.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919

2020
class Selection(ABC):
2121
@abstractmethod
22-
def _select(self, lines: list[str]) -> Iterator[slice]:
23-
...
22+
def _select(self, lines: list[str]) -> Iterator[slice]: ...
2423

2524
@abstractmethod
26-
def __rshift__(self: T, op: _Select) -> T:
27-
...
25+
def __rshift__(self: T, op: _Select) -> T: ...
2826

2927
def enumerate(self, lines: list[str]) -> Iterator[tuple[int, str]]:
3028
"""Iterate over the selected lines"""

0 commit comments

Comments
 (0)