Skip to content

Commit eb30fea

Browse files
committed
Switch to use uv.lock
1 parent 209ca19 commit eb30fea

File tree

12 files changed

+1418
-402
lines changed

12 files changed

+1418
-402
lines changed

.github/workflows/autodeps.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020

2121
steps:
2222
- name: Checkout
23+
with:
24+
persist-credentials: false
2325
uses: actions/checkout@v4
2426
- name: Setup python
2527
uses: actions/setup-python@v5
@@ -28,21 +30,17 @@ jobs:
2830

2931
- name: Bump dependencies
3032
run: |
31-
python -m pip install -U pip pre-commit
32-
python -m pip install -r test-requirements.txt
33-
uv pip compile --universal --python-version=3.10 --upgrade test-requirements.in -o test-requirements.txt
34-
pre-commit autoupdate --jobs 0
33+
python -m pip install -U uv
34+
uv lock --upgrade
35+
uv tool install pre-commit
36+
uv run pre-commit autoupdate --jobs 0
3537
3638
- name: Install new requirements
37-
run: python -m pip install -r test-requirements.txt
39+
run: uv sync
3840

3941
# apply newer versions' formatting
40-
- name: Black
41-
run: black src/statusbot
42-
43-
- name: uv
44-
run: |
45-
uv pip compile --universal --python-version=3.10 test-requirements.in -o test-requirements.txt
42+
- name: Pre-commit updates
43+
run: uv run pre-commit run -a || true
4644

4745
- name: Commit changes and create automerge PR
4846
env:

.github/workflows/ci.yml

Lines changed: 93 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: CI
22

3+
permissions: {}
4+
35
on:
46
push:
57
branches-ignore:
@@ -11,56 +13,56 @@ concurrency:
1113
cancel-in-progress: true
1214

1315
jobs:
14-
## Windows:
15-
## name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
16-
## timeout-minutes: 20
17-
## runs-on: 'windows-latest'
18-
## strategy:
19-
## fail-fast: false
20-
## matrix:
21-
## python: ['3.10', '3.11', '3.12']
22-
## arch: ['x86', 'x64']
23-
## continue-on-error: >-
24-
## ${{
25-
## (
26-
## endsWith(matrix.python, '-dev')
27-
## || endsWith(matrix.python, '-nightly')
28-
## )
29-
## && true
30-
## || false
31-
## }}
32-
## steps:
33-
## - name: Checkout
34-
## uses: actions/checkout@v4
35-
## - name: Setup python
36-
## uses: actions/setup-python@v5
37-
## with:
38-
## # This allows the matrix to specify just the major.minor version while still
39-
## # expanding it to get the latest patch version including alpha releases.
40-
## # This avoids the need to update for each new alpha, beta, release candidate,
41-
## # and then finally an actual release version. actions/setup-python doesn't
42-
## # support this for PyPy presently so we get no help there.
43-
## #
44-
## # 'CPython' -> '3.9.0-alpha - 3.9.X'
45-
## # 'PyPy' -> 'pypy-3.9'
46-
## python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
47-
## architecture: '${{ matrix.arch }}'
48-
## cache: pip
49-
## cache-dependency-path: test-requirements.txt
50-
## - name: Run tests
51-
## run: ./ci.sh
52-
## shell: bash
16+
Windows:
17+
name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
18+
timeout-minutes: 20
19+
runs-on: 'windows-latest'
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
24+
arch: ['x86', 'x64']
25+
continue-on-error: >-
26+
${{
27+
(
28+
endsWith(matrix.python, '-dev')
29+
|| endsWith(matrix.python, '-nightly')
30+
)
31+
&& true
32+
|| false
33+
}}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
persist-credentials: false
39+
- name: Setup python
40+
uses: actions/setup-python@v5
41+
with:
42+
# This allows the matrix to specify just the major.minor version while still
43+
# expanding it to get the latest patch version including alpha releases.
44+
# This avoids the need to update for each new alpha, beta, release candidate,
45+
# and then finally an actual release version. actions/setup-python doesn't
46+
# support this for PyPy presently so we get no help there.
47+
#
48+
# 'CPython' -> '3.9.0-alpha - 3.9.X'
49+
# 'PyPy' -> 'pypy-3.9'
50+
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
51+
architecture: '${{ matrix.arch }}'
52+
cache: pip
53+
cache-dependency-path: test-requirements.txt
54+
- name: Run tests
55+
run: ./ci.sh
56+
shell: bash
5357

5458
Ubuntu:
5559
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
5660
timeout-minutes: 10
5761
runs-on: 'ubuntu-latest'
58-
# Only run for PRs or pushes to main
59-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
6062
strategy:
6163
fail-fast: false
6264
matrix:
63-
python: ['3.10', '3.11', '3.12', '3.13']
65+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
6466
check_formatting: ['0']
6567
extra_name: ['']
6668
include:
@@ -78,6 +80,8 @@ jobs:
7880
}}
7981
steps:
8082
- name: Checkout
83+
with:
84+
persist-credentials: false
8185
uses: actions/checkout@v4
8286
- name: Setup python
8387
uses: actions/setup-python@v5
@@ -96,49 +100,51 @@ jobs:
96100
env:
97101
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
98102

99-
## macOS:
100-
## name: 'macOS (${{ matrix.python }})'
101-
## timeout-minutes: 15
102-
## runs-on: 'macos-latest'
103-
## strategy:
104-
## fail-fast: false
105-
## matrix:
106-
## python: ['3.10', '3.11', '3.12']
107-
## continue-on-error: >-
108-
## ${{
109-
## (
110-
## endsWith(matrix.python, '-dev')
111-
## || endsWith(matrix.python, '-nightly')
112-
## )
113-
## && true
114-
## || false
115-
## }}
116-
## steps:
117-
## - name: Checkout
118-
## uses: actions/checkout@v4
119-
## - name: Setup python
120-
## uses: actions/setup-python@v5
121-
## with:
122-
## python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
123-
## cache: pip
124-
## cache-dependency-path: test-requirements.txt
125-
## - name: Run tests
126-
## run: ./ci.sh
103+
macOS:
104+
name: 'macOS (${{ matrix.python }})'
105+
timeout-minutes: 15
106+
runs-on: 'macos-latest'
107+
strategy:
108+
fail-fast: false
109+
matrix:
110+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
111+
continue-on-error: >-
112+
${{
113+
(
114+
endsWith(matrix.python, '-dev')
115+
|| endsWith(matrix.python, '-nightly')
116+
)
117+
&& true
118+
|| false
119+
}}
120+
steps:
121+
- name: Checkout
122+
uses: actions/checkout@v4
123+
with:
124+
persist-credentials: false
125+
- name: Setup python
126+
uses: actions/setup-python@v5
127+
with:
128+
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
129+
cache: pip
130+
cache-dependency-path: test-requirements.txt
131+
- name: Run tests
132+
run: ./ci.sh
133+
134+
# https://github.com/marketplace/actions/alls-green#why
135+
check: # This job does nothing and is only used for the branch protection
136+
137+
if: always()
138+
139+
needs:
140+
- Windows
141+
- Ubuntu
142+
- macOS
127143

128-
## # https://github.com/marketplace/actions/alls-green#why
129-
## check: # This job does nothing and is only used for the branch protection
130-
##
131-
## if: always()
132-
##
133-
## needs:
134-
## - Windows
135-
## - Ubuntu
136-
## - macOS
137-
##
138-
## runs-on: ubuntu-latest
139-
##
140-
## steps:
141-
## - name: Decide whether the needed jobs succeeded or failed
142-
## uses: re-actors/alls-green@release/v1
143-
## with:
144-
## jobs: ${{ toJSON(needs) }}
144+
runs-on: ubuntu-latest
145+
146+
steps:
147+
- name: Decide whether the needed jobs succeeded or failed
148+
uses: re-actors/alls-green@release/v1
149+
with:
150+
jobs: ${{ toJSON(needs) }}

.pre-commit-config.yaml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ci:
22
autofix_prs: true
3-
autoupdate_schedule: weekly
3+
autoupdate_schedule: quarterly
44
submodules: false
55
skip: [badgie]
66

@@ -18,13 +18,6 @@ repos:
1818
- id: check-case-conflict
1919
- id: sort-simple-yaml
2020
files: .pre-commit-config.yaml
21-
- repo: https://github.com/hadialqattan/pycln
22-
rev: v2.5.0
23-
hooks:
24-
- id: pycln
25-
args: [--config=pyproject.toml, src]
26-
types: [file]
27-
types_or: [python, pyi]
2821
- repo: https://github.com/psf/black-pre-commit-mirror
2922
rev: 25.1.0
3023
hooks:
@@ -35,6 +28,7 @@ repos:
3528
- id: ruff
3629
types: [file]
3730
types_or: [python, pyi, toml]
31+
args: ["--show-fixes"]
3832
- repo: https://github.com/CoolCat467/badgie
3933
rev: v0.9.6
4034
hooks:
@@ -43,11 +37,13 @@ repos:
4337
rev: v2.4.1
4438
hooks:
4539
- id: codespell
46-
- repo: local
40+
additional_dependencies:
41+
- tomli
42+
- repo: https://github.com/crate-ci/typos
43+
rev: typos-dict-v0.12.5
44+
hooks:
45+
- id: typos
46+
- repo: https://github.com/woodruffw/zizmor-pre-commit
47+
rev: v1.3.1
4748
hooks:
48-
- id: project-requirements
49-
name: regenerate requirements.in
50-
language: system
51-
entry: python tools/project_requirements.py
52-
pass_filenames: false
53-
files: ^(test-requirements.in)|(pyproject.toml)$
49+
- id: zizmor

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# StatusBot
2-
StatusBot is a discord bot that will post information about a given Java Editon minecraft server in a given channel once configured.
2+
StatusBot is a discord bot that will post information about a given Java Edition minecraft server in a given channel once configured.
33

44
<!-- BADGIE TIME -->
55

@@ -76,7 +76,7 @@ As of version 0.5.0, the following describes StatusBot's commands.
7676
If you are StatusBot's owner, you are the guild owner, or you are in the
7777
`set-option-users` list, the following settings can be modified:
7878

79-
`address` - Address of the java editon minecraft server StatusBot should monitor
79+
`address` - Address of the java edition minecraft server StatusBot should monitor
8080

8181
`channel` - Name of the discord channel StatusBot should post player leave-join messages in.
8282

check.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ fi
7373

7474
# Check pip compile is consistent
7575
echo "::group::Pip Compile - Tests"
76-
uv pip compile --universal --python-version=3.10 test-requirements.in -o test-requirements.txt
76+
uv lock
7777
echo "::endgroup::"
7878

79-
if git status --porcelain | grep -q "requirements.txt"; then
80-
echo "::error::requirements.txt changed."
81-
echo "::group::requirements.txt changed"
82-
echo "* requirements.txt changed" >> "$GITHUB_STEP_SUMMARY"
79+
if git status --porcelain | grep -q "uv.lock"; then
80+
echo "::error::uv.lock changed."
81+
echo "::group::uv.lock changed"
82+
echo "* uv.lock changed" >> "$GITHUB_STEP_SUMMARY"
8383
git status --porcelain
84-
git --no-pager diff --color ./*requirements.txt
84+
git --no-pager diff --color ./*uv.lock
8585
EXIT_STATUS=1
8686
echo "::endgroup::"
8787
fi
@@ -97,9 +97,10 @@ if [ $EXIT_STATUS -ne 0 ]; then
9797
Problems were found by static analysis (listed above).
9898
To fix formatting and see remaining errors, run
9999
100-
uv pip install -r test-requirements.txt
100+
uv sync --extra tools
101101
black src/$PROJECT
102102
ruff check src/$PROJECT
103+
mypy
103104
./check.sh
104105
105106
in your local checkout.

0 commit comments

Comments
 (0)