Skip to content

Commit 83244d3

Browse files
committed
Split
1 parent 311e351 commit 83244d3

File tree

19 files changed

+255
-195
lines changed

19 files changed

+255
-195
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,27 @@ jobs:
1414
- name: Lint
1515
run: |
1616
make fmt
17+
typecheck:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Typecheck
22+
run: |
23+
make typecheck
1724
archive:
1825
runs-on: ubuntu-latest
1926
steps:
2027
- uses: actions/checkout@v4
2128
- name: Build
2229
run: |
2330
make build
24-
- name: Archive
31+
- name: Archive Flight Software
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: proveskit-flight-software
35+
path: artifacts/proves/flight-software
36+
- name: Archive Ground Station
2537
uses: actions/upload-artifact@v4
2638
with:
27-
name: proves
28-
path: artifacts/proves.zip
39+
name: proveskit-ground-station
40+
path: artifacts/proves/ground-station

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ venv
1111
**/*.mpy
1212

1313
# libs
14-
/lib/*
15-
!/lib/requirements.txt
16-
!/lib/proveskit_rp2350_v5a/
14+
src/*/lib/*
15+
!src/*/lib/requirements.txt
16+
!src/flight-software/lib/proveskit_rp2350_v5a/

Makefile

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ help: ## Display this help.
1414
@echo "Creating virtual environment..."
1515
@$(MAKE) uv
1616
@$(UV) venv
17-
@$(UV) pip install --requirement pyproject.toml
17+
@$(UV) sync
1818

1919
.PHONY: download-libraries
20-
download-libraries: uv .venv ## Download the required libraries
21-
@echo "Downloading libraries..."
22-
@$(UV) pip install --requirement lib/requirements.txt --target lib --no-deps --upgrade --quiet
23-
@$(UV) pip --no-cache install $(PYSQUARED) --target lib --no-deps --upgrade --quiet
20+
download-libraries: download-libraries-flight-software download-libraries-ground-station
2421

25-
@rm -rf lib/*.dist-info
26-
@rm -rf lib/.lock
22+
.PHONY: download-libraries-%
23+
download-libraries-%: uv .venv ## Download the required libraries
24+
@echo "Downloading libraries for $*..."
25+
@$(UV) pip install --requirement src/$*/lib/requirements.txt --target src/$*/lib --no-deps --upgrade --quiet
26+
@$(UV) pip --no-cache install $(PYSQUARED) --target src/$*/lib --no-deps --upgrade --quiet
27+
28+
@rm -rf src/$*/lib/*.dist-info
29+
@rm -rf src/$*/lib/.lock
2730

2831
.PHONY: pre-commit-install
2932
pre-commit-install: uv
@@ -38,17 +41,20 @@ sync-time: uv ## Syncs the time from your computer to the PROVES Kit board
3841
fmt: pre-commit-install ## Lint and format files
3942
$(UVX) pre-commit run --all-files
4043

44+
typecheck: .venv download-libraries ## Run type check
45+
@$(UV) run -m pyright .
46+
4147
BOARD_MOUNT_POINT ?= ""
4248
VERSION ?= $(shell git tag --points-at HEAD --sort=-creatordate < /dev/null | head -n 1)
4349

4450
.PHONY: install
45-
install: build ## Install the project onto a connected PROVES Kit use `make install BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
51+
install-%: build-% ## Install the project onto a connected PROVES Kit use `make install-flight-software BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
4652
ifeq ($(OS),Windows_NT)
4753
rm -rf $(BOARD_MOUNT_POINT)
48-
cp -r artifacts/proves/* $(BOARD_MOUNT_POINT)
54+
cp -r artifacts/proves/$*/* $(BOARD_MOUNT_POINT)
4955
else
5056
@rm $(BOARD_MOUNT_POINT)/code.py > /dev/null 2>&1 || true
51-
$(call rsync_to_dest,artifacts/proves,$(BOARD_MOUNT_POINT))
57+
$(call rsync_to_dest,artifacts/proves/$*,$(BOARD_MOUNT_POINT))
5258
endif
5359

5460
# install-firmware
@@ -63,15 +69,18 @@ clean: ## Remove all gitignored files such as downloaded libraries and artifacts
6369
##@ Build
6470

6571
.PHONY: build
66-
build: download-libraries mpy-cross ## Build the project, store the result in the artifacts directory
67-
@echo "Creating artifacts/proves"
68-
@mkdir -p artifacts/proves
69-
@echo "__version__ = '$(VERSION)'" > artifacts/proves/version.py
70-
$(call compile_mpy)
71-
$(call rsync_to_dest,.,artifacts/proves/)
72-
@$(UV) run python -c "import os; [os.remove(os.path.join(root, file)) for root, _, files in os.walk('artifacts/proves/lib') for file in files if file.endswith('.py')]"
73-
@echo "Creating artifacts/proves.zip"
74-
@zip -r artifacts/proves.zip artifacts/proves > /dev/null
72+
build: build-flight-software build-ground-station ## Build all projects
73+
74+
.PHONY: build-*
75+
build-%: download-libraries-% mpy-cross ## Build the project, store the result in the artifacts directory
76+
@echo "Creating artifacts/proves/$*"
77+
@mkdir -p artifacts/proves/$*
78+
@echo "__version__ = '$(VERSION)'" > artifacts/proves/$*/version.py
79+
$(call compile_mpy,$*)
80+
$(call rsync_to_dest,src/$*,artifacts/proves/$*/)
81+
@$(UV) run python -c "import os; [os.remove(os.path.join(root, file)) for root, _, files in os.walk('artifacts/proves/$*/lib') for file in files if file.endswith('.py')]"
82+
@echo "Creating artifacts/proves/$*.zip"
83+
@zip -r artifacts/proves/$*.zip artifacts/proves/$* > /dev/null
7584

7685
define rsync_to_dest
7786
@if [ -z "$(1)" ]; then \
@@ -84,7 +93,7 @@ define rsync_to_dest
8493
exit 1; \
8594
fi
8695

87-
@rsync -avh $(1)/config.json artifacts/proves/version.py $(1)/*.py $(1)/lib --exclude=".*" --exclude='requirements.txt' --exclude='__pycache__' $(2) --delete --times --checksum
96+
@rsync -avh ./config.json $(2)/version.py $(1)/*.py $(1)/lib --exclude=".*" --exclude='requirements.txt' --exclude='__pycache__' $(2) --delete --times --checksum
8897
endef
8998

9099
##@ Build Tools
@@ -93,7 +102,7 @@ $(TOOLS_DIR):
93102
mkdir -p $(TOOLS_DIR)
94103

95104
### Tool Versions
96-
UV_VERSION ?= 0.5.24
105+
UV_VERSION ?= 0.7.13
97106
MPY_CROSS_VERSION ?= 9.0.5
98107

99108
UV_DIR ?= $(TOOLS_DIR)/uv-$(UV_VERSION)
@@ -133,5 +142,5 @@ endif
133142
endif
134143

135144
define compile_mpy
136-
@$(UV) run python -c "import os, subprocess; [subprocess.run(['$(MPY_CROSS)', os.path.join(root, file)]) for root, _, files in os.walk('lib') for file in files if file.endswith('.py')]" || exit 1
145+
@$(UV) run python -c "import os, subprocess; [subprocess.run(['$(MPY_CROSS)', os.path.join(root, file)]) for root, _, files in os.walk('src/$(1)/lib') for file in files if file.endswith('.py')]" || exit 1
137146
endef

pyproject.toml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,38 @@ version = "1.0.0"
44
description = "Flight Software for the PROVES Kit RP2350 v5A"
55
readme = "README.md"
66
requires-python = ">=3.13"
7-
dependencies = [
8-
"adafruit-circuitpython-typing==1.11.2",
9-
"circuitpython-stubs==9.2.5",
10-
"coverage==7.6.10",
11-
"pre-commit==4.0.1",
12-
"pyright[nodejs]==1.1.399",
13-
"pytest==8.3.2",
7+
dependencies = []
8+
9+
[dependency-groups]
10+
dev = [
11+
"adafruit-circuitpython-typing==1.12.1",
12+
"circuitpython-stubs==9.2.8",
13+
"pre-commit==4.2.0",
14+
"pyright[nodejs]==1.1.402",
1415
]
1516

1617
[tool.ruff.format]
1718
# Use `\n` line endings for all files
1819
line-ending = "lf"
1920

2021
[tool.pyright]
21-
include = ["main.py", "boot.py", "repl.py", "safemode.py"]
22+
include = [
23+
"src/flight-software/boot.py",
24+
"src/flight-software/main.py",
25+
"src/flight-software/repl.py",
26+
"src/flight-software/safemode.py",
27+
"src/flight-software/lib/proveskit_rp2040_v4/*",
28+
"src/ground_station/boot.py",
29+
"src/ground_station/main.py",
30+
"src/ground_station/repl.py",
31+
"src/ground_station/safemode.py",
32+
]
2233
exclude = [
2334
"**/__pycache__",
2435
".venv",
2536
".git",
2637
"artifacts",
27-
"lib",
38+
"src/*/lib",
2839
"typings",
2940
]
3041
stubPath = "./typings"
File renamed without changes.
File renamed without changes.

main.py renamed to src/flight-software/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import board
1616
import digitalio
1717
import microcontroller
18-
1918
from lib.proveskit_rp2350_v5a.register import Register
2019
from lib.pysquared.beacon import Beacon
2120
from lib.pysquared.cdh import CommandDataHandler
@@ -44,7 +43,6 @@
4443
logger: Logger = Logger(
4544
error_counter=Counter(index=Register.error_count),
4645
colorized=False,
47-
# log_level=LogLevel.INFO,
4846
)
4947

5048
logger.info(
File renamed without changes.

0 commit comments

Comments
 (0)