Skip to content

Commit 51e8de7

Browse files
authored
Merge pull request #325 from Czarified/actions
Actions Update
2 parents f87ca55 + 9e6b65d commit 51e8de7

11 files changed

+52
-24
lines changed

.flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[flake8]
22
select = B,B9,C,D,DAR,E,F,N,RST,S,W
33
ignore = E203,E501,RST201,RST203,RST301,W503,B907,B905,D101,D102
4-
max-line-length = 80
4+
max-line-length = 120
55
max-complexity = 10
66
docstring-convention = google
77
per-file-ignores = tests/*:S101

.github/dependabot.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ updates:
33
- package-ecosystem: github-actions
44
directory: "/"
55
schedule:
6-
interval: daily
6+
interval: weekly
77
- package-ecosystem: pip
88
directory: "/.github/workflows"
99
schedule:
10-
interval: daily
10+
interval: weekly
1111
- package-ecosystem: pip
1212
directory: "/docs"
1313
schedule:
14-
interval: daily
14+
interval: weekly
1515
- package-ecosystem: pip
1616
directory: "/"
1717
schedule:
18-
interval: daily
18+
interval: weekly
1919
versioning-strategy: lockfile-only
2020
allow:
2121
- dependency-type: "all"

.github/workflows/constraints.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pip==24.0
22
nox==2024.4.15
33
nox-poetry==1.0.3
4-
poetry==1.8.2
5-
virtualenv==20.22.0
4+
poetry==1.8.3
5+
virtualenv==20.26.1

.github/workflows/labeler.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ on:
44
push:
55
branches:
66
- main
7-
- master
87

98
jobs:
109
labeler:
1110
runs-on: ubuntu-latest
11+
permissions:
12+
actions: read
13+
contents: read
14+
issues: write # <--- permission granted explicitely
15+
security-events: write
1216
steps:
1317
- name: Check out the repository
1418
uses: actions/checkout@v4
1519

1620
- name: Run Labeler
1721
uses: crazy-max/[email protected]
1822
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
1924
skip-delete: true

.github/workflows/release.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
release:
1111
name: Release
12+
permissions:
13+
contents: write
1214
runs-on: ubuntu-latest
1315
steps:
1416
- name: Check out the repository
@@ -19,7 +21,7 @@ jobs:
1921
- name: Set up Python
2022
uses: actions/setup-python@v5
2123
with:
22-
python-version: "3.10"
24+
python-version: "3.11"
2325

2426
- name: Upgrade pip
2527
run: |
@@ -71,7 +73,7 @@ jobs:
7173
repository_url: https://test.pypi.org/legacy/
7274

7375
- name: Publish the release notes
74-
uses: release-drafter/release-drafter@v5.25.0
76+
uses: release-drafter/release-drafter@v6.0.0
7577
with:
7678
publish: ${{ steps.check-version.outputs.tag != '' }}
7779
tag: ${{ steps.check-version.outputs.tag }}

.github/workflows/tests.yml

+14-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ jobs:
1414
include:
1515
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
1616
- { python: "3.11", os: "ubuntu-latest", session: "safety" }
17+
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
18+
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
19+
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
1720
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
1821
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
1922
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
2023
- { python: "3.11", os: "windows-latest", session: "tests" }
21-
- { python: "3.10", os: "windows-latest", session: "tests" }
2224
- { python: "3.11", os: "macos-latest", session: "tests" }
2325
- { python: "3.11", os: "ubuntu-latest", session: "typeguard" }
2426
- { python: "3.11", os: "ubuntu-latest", session: "xdoctest" }
@@ -40,7 +42,7 @@ jobs:
4042

4143
- name: Upgrade pip
4244
run: |
43-
pip install --constraint=.github/workflows/constraints.txt pip
45+
pip install --constraint=.github/workflows/constraints.txt pip "pipx==1.4.3"
4446
pip --version
4547
4648
- name: Upgrade pip in virtual environments
@@ -53,11 +55,14 @@ jobs:
5355
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
5456
5557
- name: Install Poetry
58+
shell: bash
5659
run: |
60+
pipx --version
5761
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
5862
poetry --version
5963
6064
- name: Install Nox
65+
shell: bash
6166
run: |
6267
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
6368
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
@@ -95,7 +100,7 @@ jobs:
95100
if: always() && matrix.session == 'tests'
96101
uses: "actions/upload-artifact@v4"
97102
with:
98-
name: coverage-data
103+
name: coverage-data-${{ matrix.python}}-${{ matrix.os }}
99104
path: ".coverage.*"
100105

101106
- name: Upload documentation
@@ -119,7 +124,7 @@ jobs:
119124

120125
- name: Upgrade pip
121126
run: |
122-
pip install --constraint=.github/workflows/constraints.txt pip
127+
pip install --constraint=.github/workflows/constraints.txt pip "pipx==1.4.3"
123128
pip --version
124129
125130
- name: Install Poetry
@@ -136,7 +141,8 @@ jobs:
136141
- name: Download coverage data
137142
uses: actions/download-artifact@v4
138143
with:
139-
name: coverage-data
144+
pattern: coverage-data-*
145+
merge-multiple: true
140146

141147
- name: Combine coverage data and display human readable report
142148
run: |
@@ -147,4 +153,6 @@ jobs:
147153
nox --session=coverage -- xml
148154
149155
- name: Upload coverage report
150-
uses: codecov/[email protected]
156+
uses: codecov/[email protected]
157+
with:
158+
token: ${{ secrets.CODECOV_TOKEN }}

noxfile.py

+12
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"pre-commit",
3030
"safety",
3131
"tests",
32+
"mypy",
3233
"typeguard",
3334
"xdoctest",
3435
"docs-build",
@@ -156,6 +157,17 @@ def tests(session: Session) -> None:
156157
session.notify("coverage", posargs=[])
157158

158159

160+
@session(python=python_versions)
161+
def mypy(session: Session) -> None:
162+
"""Type-check using mypy."""
163+
args = session.posargs or ["src", "tests", "docs/conf.py"]
164+
session.install(".")
165+
session.install("mypy", "pytest")
166+
session.run("mypy", *args)
167+
if not session.posargs:
168+
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
169+
170+
159171
@session(python=python_versions[0])
160172
def coverage(session: Session) -> None:
161173
"""Produce the coverage report."""

src/thymed/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def __post_init__(self) -> None:
122122
raise e
123123

124124
@property
125-
def is_active(self) -> [bool, Any]:
125+
def is_active(self) -> Any:
126126
"""The charge code is active if it has been activated, but not closed."""
127127
# If the last item in the times list has only 1 entry,
128128
# we assume the code is still active.

src/thymed/thymer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from textual.containers import Container
1414
from textual.containers import ScrollableContainer
1515
from textual.reactive import reactive
16-
from textual.reactive import var
16+
17+
# from textual.reactive import var
1718
from textual.widget import Widget
1819
from textual.widgets import Button
1920
from textual.widgets import DataTable

src/thymed/tui.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
SIDEBAR_INFO = """
5252
There are multiple tools available in Thymed. To use one, select it or hit the keybinding. The main area will be updated with the 'applet' along with some more information. :smiley:
53-
"""
53+
""" # noqa: B950
5454

5555
LINKS = """
5656
Here are some links, you can click these!

tests/test_chargecode.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ def fake_times(
135135
# # # T E S T S # # #
136136

137137

138-
def test_create():
138+
def test_create() -> None:
139139
"""If a ChargeCode can be created."""
140140
the_code = ChargeCode("test_code", "description", 0)
141141
assert not the_code.is_active
142142

143143

144-
def test_punch(blank_code):
144+
def test_punch(blank_code) -> None:
145145
"""Punches a charge code, sees active. Punches again, sees inactive."""
146146
blank_code.punch()
147147
assert blank_code.is_active
@@ -150,7 +150,7 @@ def test_punch(blank_code):
150150
assert not blank_code.is_active
151151

152152

153-
def test_data(blank_code):
153+
def test_data(blank_code) -> None:
154154
"""Write some data, and instantiate a code that recognizes the times."""
155155
blank_code.punch()
156156
time.sleep(0.1)
@@ -164,7 +164,7 @@ def test_data(blank_code):
164164
remove_test_data("99999998")
165165

166166

167-
def test_multiple():
167+
def test_multiple() -> None:
168168
"""Make multiple for post_init checks."""
169169
one = ChargeCode("One", "Tester 1, Tester One.", 1)
170170
one.write_class()
@@ -178,7 +178,7 @@ def test_multiple():
178178
remove_test_charge("2")
179179

180180

181-
def test_fake_time(fake_times, blank_code):
181+
def test_fake_time(fake_times, blank_code) -> None:
182182
"""Build some real data to work with."""
183183
blank_code.punch()
184184
time.sleep(0.1)

0 commit comments

Comments
 (0)