Skip to content

Commit f5ea010

Browse files
committed
feat: Add helper scripts scaffolding.
1 parent 57b7e82 commit f5ea010

17 files changed

Lines changed: 581 additions & 8 deletions

File tree

.github/workflows/.source.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,31 @@ jobs:
123123
path: |
124124
-
125125
multi-storage-client-docs/dist/
126+
multi-storage-client-scripts:
127+
name: multi-storage-client-scripts
128+
permissions:
129+
contents: read
130+
runs-on: ubuntu-latest
131+
steps:
132+
# Checkout.
133+
- uses: actions/checkout@v6
134+
# Install Nix + Magic Nix Cache.
135+
- uses: DeterminateSystems/nix-installer-action@main
136+
with:
137+
summarize: false
138+
- uses: DeterminateSystems/magic-nix-cache-action@main
139+
# Install uv + enable uv caching.
140+
#
141+
# The Nix shell provides uv so this is only for uv caching.
142+
- uses: astral-sh/setup-uv@v8.0.0
143+
env:
144+
UV_NO_MODIFY_PATH: true
145+
with:
146+
enable-cache: true
147+
# Main.
148+
- working-directory: multi-storage-client-scripts
149+
run: |
150+
just build
126151
multi-storage-file-system:
127152
name: multi-storage-file-system
128153
permissions:

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
statuses: write
2727
runs-on: ubuntu-latest
2828
steps:
29-
- uses: actions/github-script@v8
29+
- uses: actions/github-script@v9
3030
with:
3131
script: |
3232
github.rest.repos.createCommitStatus({

.gitlab/pipelines/.beta.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ workflow:
99
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
1010

1111
stages:
12-
- 💿
12+
- 💽
1313

1414
default:
1515
tags:
@@ -51,7 +51,7 @@ default:
5151

5252
# Properties we can't set with `default`.
5353
.default:
54-
stage: 💿
54+
stage: 💽
5555
environment:
5656
name: Beta
5757
action: access

.gitlab/pipelines/.production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ workflow:
99
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
1010

1111
stages:
12-
- 💿
12+
- 💽
1313

1414
default:
1515
tags:
@@ -51,7 +51,7 @@ default:
5151

5252
# Properties we can't set with `default`.
5353
.default:
54-
stage: 💿
54+
stage: 💽
5555
environment:
5656
name: Production
5757
action: access

.gitlab/pipelines/.source.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ workflow:
99
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
1010

1111
stages:
12-
- 💿
12+
- 💽
1313

1414
default:
1515
tags:
@@ -52,7 +52,7 @@ default:
5252

5353
# Properties we can't set with `default`.
5454
.default:
55-
stage: 💿
55+
stage: 💽
5656

5757
# TODO: Remove once on GitLab 18.2.
5858
✔️:
@@ -168,6 +168,29 @@ multi-storage-client-docs:
168168
reports:
169169
codequality: multi-storage-client-docs/.reports/ruff.json
170170

171+
multi-storage-client-scripts:
172+
extends:
173+
- .default
174+
rules:
175+
- changes:
176+
- flake.lock
177+
- flake.nix
178+
- nix/**/*
179+
- pyproject.toml
180+
- uv.lock
181+
- multi-storage-client-scripts/**/*
182+
- when: manual
183+
allow_failure: true
184+
script:
185+
- |
186+
nix develop --command bash -c "
187+
cd multi-storage-client-scripts &&
188+
just build
189+
"
190+
artifacts:
191+
reports:
192+
codequality: multi-storage-client-scripts/.reports/ruff.json
193+
171194
multi-storage-file-system:
172195
extends:
173196
- .default

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Key:
6767
├── multi-storage-client-docs
6868
│ └── ...
6969
70+
│ # Internal helper scripts.
71+
├── multi-storage-client-scripts
72+
│ └── ...
73+
7074
│ # Client web UI.
7175
├── multi-storage-explorer
7276
│ └── ...

justfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ multi-storage-client: multi-storage-explorer
2727
multi-storage-client-docs: multi-storage-client
2828
just python-binary={{python-binary}} multi-storage-client-docs/build
2929

30+
# Build multi-storage-client-scripts.
31+
multi-storage-client-scripts:
32+
just python-binary={{python-binary}} multi-storage-client-scripts/build
33+
3034
# Build multi-storage-file-system.
3135
multi-storage-file-system:
3236
just multi-storage-file-system/build
3337

3438
# Release build.
35-
build: nix multi-storage-explorer multi-storage-client multi-storage-client-docs multi-storage-file-system
39+
build: nix multi-storage-explorer multi-storage-client multi-storage-client-docs multi-storage-client-scripts multi-storage-file-system
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Multi-Storage Client Scripts
2+
3+
Internal helper scripts for things too painful to do with Bash.
4+
5+
## Layout
6+
7+
Important landmarks:
8+
9+
```text
10+
Key:
11+
🤖 = Generated
12+
13+
.
14+
│ # Source.
15+
├── src
16+
│ └── multistorageclient_scripts
17+
│ │ # Command.
18+
│ ├── cli
19+
│ │ │ # Subcommand.
20+
│ │ ├── {subcommand}
21+
│ │ │ │ # Subcommand source.
22+
│ │ │ ├── __init__.py
23+
│ │ │ │
24+
│ │ │ └── ...
25+
│ │ │
26+
│ │ │ # Command source.
27+
│ │ ├── __init__.py
28+
│ │ │
29+
│ │ │ # Entrypoint.
30+
│ │ └── __main__.py
31+
│ │
32+
│ │ # Utilities.
33+
│ └── utils
34+
│ │ # argparse extensions.
35+
│ └── argparse_extensions
36+
│ └── ...
37+
38+
│ # Build recipes.
39+
├── justfile
40+
41+
│ # Python package configuration.
42+
└── pyproject.toml
43+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Just configuration.
3+
#
4+
# https://just.systems/man/en
5+
#
6+
7+
# Default to the first Python binary on `PATH`.
8+
python-binary := "python"
9+
10+
# List recipes.
11+
help:
12+
just --list
13+
14+
# Prepare the toolchain.
15+
prepare-toolchain:
16+
# Prepare the virtual environment.
17+
if [[ -z "${CI:-}" ]]; then \
18+
uv sync --all-extras --python {{python-binary}}; \
19+
else \
20+
uv sync --all-extras --locked --python {{python-binary}}; \
21+
fi
22+
23+
# Start the Python REPL.
24+
start-repl: prepare-toolchain
25+
# Start the Python REPL.
26+
uv run python
27+
28+
# Run static analysis (format, lint, type check).
29+
analyze: prepare-toolchain
30+
# Remove analysis artifacts.
31+
rm -rf .reports/ruff.json
32+
# Format.
33+
if [[ -z "${CI:-}" ]]; then ruff format; else ruff format --check; fi
34+
# Lint.
35+
if [[ -z "${CI:-}" ]]; then ruff check --fix; else ruff check --output-file .reports/ruff.json --output-format gitlab; fi
36+
# Type check.
37+
uv run pyright
38+
39+
# Release build.
40+
build: analyze
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[build-system]
2+
requires = [
3+
"uv_build>=0.11.6,<0.12"
4+
]
5+
build-backend = "uv_build"
6+
7+
[project]
8+
name = "multi-storage-client-scripts"
9+
version = "0.0.0"
10+
requires-python = ">=3.10,<4"
11+
classifiers = [
12+
"Private :: Do Not Upload"
13+
]
14+
15+
[project.scripts]
16+
msc-scripts = "multistorageclient_scripts.cli.__main__:main"
17+
18+
[tool.ruff]
19+
extend = "../pyproject.toml"
20+
21+
[tool.uv.build-backend]
22+
module-name = "multistorageclient_scripts"

0 commit comments

Comments
 (0)