Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a518ada
extend Taskfile to cover WebUI tasks and eliminate duplication
edvardm Apr 11, 2026
a47cdb3
add CONTRIBUTING.md and link it from README
edvardm Apr 11, 2026
62e3204
migrate webui from npm to pnpm
edvardm Apr 11, 2026
6e5a199
fix: specify pnpm version in CI workflow
edvardm Apr 11, 2026
253f1af
rename WebUI -> Frontend in CI workflow name and job id
edvardm Apr 11, 2026
156c936
fix: install dependencies before Playwright browser install in CI
edvardm Apr 11, 2026
775d308
add idiomatic pytest examples for utils functions
edvardm Apr 11, 2026
6817aa8
refine test_utils: apply feedback and use parametrize
edvardm Apr 11, 2026
e2fa42e
split normalize_color_hex tests by input type and assertion shape
edvardm Apr 11, 2026
c7b84df
parametrize ensure_list scalar wrapping cases
edvardm Apr 11, 2026
4388e96
collapse ensure_list into single parametrized test
edvardm Apr 11, 2026
123c24a
add clean task to remove Python cache files and build artefacts
edvardm Apr 11, 2026
11786af
split test task: test runs pytest only, test-all includes WebUI
edvardm Apr 11, 2026
4fb9ad1
add test-cov task with terminal and HTML coverage reports
edvardm Apr 11, 2026
b67c8e4
skip fully-covered files in test-cov terminal report
edvardm Apr 11, 2026
ed0b327
sort test-cov terminal report by coverage ascending
edvardm Apr 11, 2026
b5baa79
tasks: add fmt alias for format
edvardm Apr 11, 2026
65b0004
format code
edvardm Apr 11, 2026
cfd1791
add pre-commit config with ruff hooks; document opt-in setup in CONTR…
edvardm Apr 11, 2026
973743a
switch pre-commit hooks from pre-commit to prek
edvardm Apr 11, 2026
35580b8
migrate dev deps from optional-dependencies to dependency-groups (PEP…
edvardm Apr 11, 2026
738f38f
add pr-notifs task to list open upstream PRs involving me
edvardm Apr 11, 2026
282d025
support optional local/Taskfile.yml for personal tasks not under vers…
edvardm Apr 11, 2026
dad0ce3
add pytest CI workflow
edvardm Apr 11, 2026
78eeff4
remove pre-commit from deps and config (handled in separate PR)
edvardm Apr 11, 2026
f0a0b1c
revert frontend tooling to npm, aligning with upstream main
edvardm Apr 11, 2026
26f379a
align webui workflow with main (rename frontend-tests.yml)
edvardm Apr 11, 2026
f4c3831
revert to main version
edvardm Apr 11, 2026
bc1d02a
chore: rm local rule
edvardm Apr 11, 2026
ff556b6
add task check to pre-PR checklist in CONTRIBUTING
edvardm Apr 11, 2026
47f1b45
refactor: test-all depends on test instead of duplicating pytest cmd
edvardm Apr 11, 2026
c4bfd6d
Update CONTRIBUTING.md
edvardm Apr 13, 2026
c062309
CR: pin python version
edvardm Apr 13, 2026
bb9ce2f
make note about invalid type
edvardm Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Python Tests
env:
PYTHON: "3.11"

on:
push:
branches: [main]
paths:
- "ofd/**"
- "tests/**"
- "pyproject.toml"
- "uv.lock"
pull_request:
paths:
- "ofd/**"
- "tests/**"
- "pyproject.toml"
- "uv.lock"

jobs:
pytest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: go-task/setup-task@v2
with:
version: 3.x

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ env.PYTHON }}

- name: Run tests
run: task test
Comment thread
edvardm marked this conversation as resolved.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ dist/
.cache/
.env
.task/
htmlcov/
.coverage
local/
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing (Developer Setup)

This guide is for developers working on the OFD codebase. For adding filament data, see the [main README](README.md).

## Prerequisites

- **uv** — `curl -LsSf https://astral.sh/uv/install.sh | sh` or see [docs.astral.sh/uv](https://docs.astral.sh/uv/getting-started/installation/)
- **Node.js 22+**
- **Task** — `brew install go-task` or see [taskfile.dev/installation](https://taskfile.dev/installation/)

## Bootstrap

```sh
task setup # installs Python deps (uv) + WebUI deps (npm)
```

## Common tasks

```sh
task test # pytest
task test-all # pytest + Playwright E2E
task lint # ruff + svelte-check
task serve # start OFD API server
```

Run `task --list` for the full list.

## Making a PR

Run `task check` before opening a pull request — it covers lint, data validation, and all tests in one go.

Keep each PR focused on a single logical change. Smaller, focused PRs are easier to review and less likely to conflict with concurrent work.
Comment thread
edvardm marked this conversation as resolved.

## Frontend development

No need to install Task just to work on the frontend — npm scripts work directly:

```sh
cd webui
npm run dev # dev server
npm test # Playwright E2E tests
npm run check # svelte-check type checking
npm run build # production build
```

> **Note:** The frontend currently uses npm directly. If we ever switch to a different package manager (bun, pnpm, etc.), adding a `Taskfile.yml` inside `webui/` would let all tooling and CI use `task` commands, making the package manager an implementation detail that only Taskfile needs to know about.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Click the **Fork** button in the top right of this page, a guide is [available h
### 3. Install our requirements
If you don't have Git installed, [follow this guide](docs/installing-software.md#git). The OFD wrapper script will help you install Python and Node.js automatically (see step 5).

Developers working on the codebase itself should also read [CONTRIBUTING.md](CONTRIBUTING.md).

### 4. Download the database
Download the database using either [this guide](docs/cloning.md) or by just using the command below, with `YOUR_USERNAME` replaced ofc!
```bash
Expand Down
91 changes: 78 additions & 13 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
version: "3"

includes:
local:
taskfile: local/Taskfile.yml
optional: true # not checked in; create local/Taskfile.yml for personal tasks

vars:
WEBUI_DIR: webui

# NOTE: taskfile can be easily written to support different operating systems, but for simplicity we'll assume
# mostly *nix-like operating systems are used, esp. MacOS and Linux, meaning most rules would work without
# need for OS-specific variants

tasks:
# ── Setup ────────────────────────────────────────────────────────────────

setup:
desc: Install Python dependencies
desc: Install all dependencies (Python + WebUI)
# keep this task idempotent and without rules, it should instead depend on other smaller tasks to
# make things ready for development. Ideally `task test` should just work after running this
deps: [.setup-python]
deps: [.setup-python, .install-playwright]

.setup-python:
internal: true
cmds:
- uv sync --frozen --extra dev
- uv sync --frozen
sources:
- pyproject.toml
- uv.lock
generates:
- .venv/pyvenv.cfg

.setup-webui:
cmds:
- npm --prefix {{.WEBUI_DIR}} ci
- touch {{.WEBUI_DIR}}/node_modules/.webui-installed
sources:
- "{{.WEBUI_DIR}}/package.json"
- "{{.WEBUI_DIR}}/package-lock.json"
generates:
- "{{.WEBUI_DIR}}/node_modules/.webui-installed"

.install-playwright:
deps: [.setup-webui]
dir: "{{.WEBUI_DIR}}"
status:
- test -f node_modules/.playwright-installed
cmd: npm run test:install && touch node_modules/.playwright-installed

# ── Python CLI ───────────────────────────────────────────────────────────

validate:
Expand Down Expand Up @@ -51,13 +79,31 @@ tasks:
cmds:
- uv run -m ofd script {{.CLI_ARGS}}

# ── WebUI ────────────────────────────────────────────────────────────────

webui:
desc: Start the WebUI dev server (http://localhost:5173)
deps: [.setup-webui]
dir: "{{.WEBUI_DIR}}"
cmds:
- npm run dev

webui-build:
desc: Build the WebUI for production
deps: [.setup-webui]
dir: "{{.WEBUI_DIR}}"
cmds:
- npm run build

# ── Code quality ─────────────────────────────────────────────────────────

lint:
desc: Lint Python code with ruff
deps: [.setup-python]
desc: Lint all code (Python + WebUI)
deps: [.setup-python, .setup-webui]
cmds:
- uv run ruff check .
- uv run ruff format --check .
- npm --prefix {{.WEBUI_DIR}} run check

lint-fix:
desc: Lint and auto-fix Python code with ruff
Expand All @@ -67,28 +113,47 @@ tasks:

format:
desc: Format Python code with ruff
aliases: ["fmt"]
deps: [.setup-python]
cmds:
- uv run ruff format .

test:
desc: Run Python test suite with pytest
desc: Run Python tests (pytest)
deps: [.setup-python]
cmds:
- uv run pytest --durations 3 --ff {{.CLI_ARGS}}

test-cov:
desc: Run Python tests with coverage (terminal + HTML report in htmlcov/)
deps: [.setup-python]
cmds:
- uv run pytest --cov=ofd --cov-report= --cov-report=html {{.CLI_ARGS}}
- uv run coverage report --skip-covered --show-missing --sort=cover

test-all:
desc: Run all tests (Python + WebUI)
deps: [test, .install-playwright]
cmds:
- npm --prefix {{.WEBUI_DIR}} run test

requirements:
desc: Regenerate requirements.txt from uv.lock (for pip users)
deps: [.setup-python]
cmds:
- uv export --no-hashes -o requirements.txt

# ── Maintenance ──────────────────────────────────────────────────────────

clean:
desc: Remove Python cache files and build artefacts
cmds: # note: trailing plus makes command not to fail if there are no matches
- find ofd -type d -name __pycache__ -exec rm -rf {} +
- find ofd -type f -name "*.py[cod]" -delete
- find . -type d -name "*.egg-info" -exec rm -rf {} +

# ── Compound ─────────────────────────────────────────────────────────────

check:
desc: Lint, format-check, and test (CI equivalent)
deps: [.setup-python]
cmds:
- uv run ruff check .
- uv run ruff format --check .
- uv run pytest
desc: Lint, format-check, validate, and test — Python + WebUI (CI equivalent)
deps: [lint, validate, test-all]
62 changes: 29 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,37 @@ name = "ofd"
version = "1.0.0"
description = "Open Filament Database CLI - Unified tooling for the OFD project"
readme = "README.md"
requires-python = ">=3.10"
requires-python = ">=3.10" # NOTE: several other places assume 3.11 => require at least 3.11?
license = { text = "MIT" }
authors = [
{ name = "Open Filament Collective" }
]
authors = [{ name = "Open Filament Collective" }]
keywords = ["filament", "3d-printing", "database", "cli"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Database",
"Topic :: Utilities",
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Database",
"Topic :: Utilities",
]

dependencies = [
"argcomplete>=3.1.0",
"jsonschema>=4.23.0",
"markdown>=3.0",
"ofd-validator>=0.5.1",
"iniconfig>=2.0.0",
"referencing>=0.30.0",
"PyYAML>=6.0",
"requests>=2.28.0",
"argcomplete>=3.1.0",
"jsonschema>=4.23.0",
"markdown>=3.0",
"ofd-validator>=0.5.1",
"iniconfig>=2.0.0",
"referencing>=0.30.0",
"PyYAML>=6.0",
"requests>=2.28.0",
]

[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"mypy>=1.0.0",
"ruff>=0.1.0",
]

[project.scripts]
ofd = "ofd.__main__:main"
Expand All @@ -66,7 +57,7 @@ line-length = 100

[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "B", "C4"]
ignore = ["E501"] # Line too long - handled by formatter
ignore = ["E501"] # Line too long - handled by formatter

[tool.mypy]
python_version = "3.10"
Expand All @@ -78,3 +69,8 @@ ignore_missing_imports = true
testpaths = ["tests"]
python_files = ["test_*.py"]
python_functions = ["test_*"]

# PEP 735 dependency groups — preferred over [project.optional-dependencies] for dev tooling.
# uv includes these by default (no --extra flag needed).
[dependency-groups]
dev = ["mypy>=1.0.0", "pytest>=7.0.0", "pytest-cov>=4.0.0", "ruff>=0.1.0"]
3 changes: 0 additions & 3 deletions tests/test_dummy.py

This file was deleted.

Loading
Loading