Skip to content

Commit 3c2664b

Browse files
authored
Merge pull request #304 from asfadmin/rew/python-maintenance
Python maintenance
2 parents 9637b7d + f13330c commit 3c2664b

28 files changed

Lines changed: 1317 additions & 1049 deletions

.github/workflows/lint.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,29 @@ name: lint
22
on:
33
pull_request:
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
flake8:
710
runs-on: ubuntu-latest
811
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-python@v2
12+
- uses: actions/checkout@v6
13+
- uses: actions/setup-python@v6
1114
with:
12-
python-version: 3.9
15+
python-version: "3.10"
1316

1417
- uses: TrueBrain/actions-flake8@v2
1518
with:
1619
flake8_version: 6.0.0
1720
plugins: flake8-isort==6.0.0
21+
22+
ruff-format:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: astral-sh/ruff-action@v3
28+
with:
29+
version: "~=0.13.3"
30+
args: format --check --diff --output-format=github

.github/workflows/test.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,29 @@ on:
66
branches:
77
- main
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
1215
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v1
15-
with:
16-
python-version: 3.9
16+
- uses: actions/checkout@v6
17+
- uses: actions/setup-python@v6
18+
with:
19+
python-version: "3.10"
1720

18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install -r requirements.txt -r requirements-dev.txt
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install uv
24+
uv sync
2225
23-
- run: pip install pytest-github-actions-annotate-failures
26+
- run: uv pip install pytest-github-actions-annotate-failures
2427

25-
- run: py.test --cov=rain_api_core --cov-report=term-missing --cov-report=xml --cov-branch --doctest-modules rain_api_core tests
28+
- run: uv run pytest --cov=src/rain_api_core --cov-report=term-missing --cov-report=xml --cov-branch --doctest-modules src/rain_api_core tests
2629

27-
- name: Report coverage
28-
uses: codecov/codecov-action@v4
29-
with:
30-
token: ${{ secrets.CODECOV_TOKEN }}
31-
fail_ci_if_error: true
30+
- name: Report coverage
31+
uses: codecov/codecov-action@v6
32+
with:
33+
token: ${{ secrets.CODECOV_TOKEN }}
34+
fail_ci_if_error: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Python
22
*.pyc
33
.venv
4+
uv.lock
45

56
# IDE
67
.idea
@@ -11,3 +12,6 @@
1112
# Tests
1213
.hypothesis
1314
.coverage
15+
16+
# Other
17+
build

extra/policy_gen_sandbox.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ def handle_text():
4646
tk.Label(frm_content, text="Bucket map YAML").grid(row=0, column=0)
4747

4848
txt_bucketmap = tk.Text(frm_content)
49-
txt_bucketmap.bind(
50-
"<Key>",
51-
lambda _: window.after(1, handle_text)
52-
)
49+
txt_bucketmap.bind("<Key>", lambda _: window.after(1, handle_text))
5350
txt_bucketmap.grid(row=1, column=0, sticky="nsew")
5451

5552
# Policy panel
@@ -65,10 +62,7 @@ def handle_text():
6562
tk.Label(frm_groups, text="User Groups: ").grid(row=0, column=0)
6663
var_group = tk.StringVar(value="null")
6764
entry_groups = tk.Entry(frm_groups, textvariable=var_group)
68-
entry_groups.bind(
69-
"<Key>",
70-
lambda _: window.after(1, handle_text)
71-
)
65+
entry_groups.bind("<Key>", lambda _: window.after(1, handle_text))
7266
entry_groups.grid(row=0, column=1)
7367

7468
# Minified size indicator

pyproject.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[build-system]
2+
requires = ["uv_build>=0.10.2,<0.11.0"]
3+
build-backend = "uv_build"
4+
5+
[project]
6+
name = "rain-api-core"
7+
version = "0.1.0"
8+
description = "RAIN API Core"
9+
readme = "README.md"
10+
authors = [
11+
{ name = "Rohan Weeden", email = "reweeden@alaska.edu" }
12+
]
13+
requires-python = "~=3.10"
14+
dependencies = [
15+
"cachetools~=5.0",
16+
"jinja2~=3.0",
17+
"netaddr~=1.0",
18+
"pyjwt[crypto]~=2.0",
19+
"pyyaml~=6.0",
20+
]
21+
22+
[dependency-groups]
23+
dev = [
24+
"boto3~=1.35",
25+
"hypothesis~=6.112",
26+
"moto~=5.0",
27+
"pytest~=8.3",
28+
"pytest-cov~=5.0",
29+
"pytest-mock~=3.14",
30+
]

0 commit comments

Comments
 (0)