Skip to content

feat: make build output paths cwd-relative#132

Merged
aboydnw merged 3 commits into
mainfrom
feat/decouple-build-from-root
May 7, 2026
Merged

feat: make build output paths cwd-relative#132
aboydnw merged 3 commits into
mainfrom
feat/decouple-build-from-root

Conversation

@aboydnw
Copy link
Copy Markdown
Member

@aboydnw aboydnw commented May 6, 2026

Summary

Removes the __file__-derived ROOT constant from the build command so output paths are no longer pinned to where the package is installed.

  • --directory now defaults to public/data (cwd-relative)
  • New --html-output flag, defaults to index.html (cwd-relative)

Upstream behavior is unchanged when run from the repo root.

Why

When upstream is installed as a Python package by a downstream fork (e.g. `nasa-odsi-contributor-network`), `file` resolves inside the consumer's `.venv/`, so `ROOT / "index.html"` lands in a useless venv-internal path. With cwd-relative defaults, downstream forks can install the CLI and run `contributor-network build` from any directory — the rendered `index.html` lands where the consumer's `cwd` is, alongside their overlaid `config.toml` and `public/`.

This unblocks the nasa-odsi-contributor-network upstream-reuse cutover, which uses `degit` to copy upstream's frontend into a cache directory and runs `build` from there.

Test plan

  • Existing tests pass (`uv run pytest` — 3/3)
  • Running `uv run contributor-network build` from the upstream repo root still writes `index.html` to repo root (verified manually; output unchanged)
  • Running the build from a different cwd writes `index.html` and `public/data/` relative to that cwd (verified manually with `/tmp/build-from-elsewhere`)

Removes the `__file__`-derived `ROOT` constant from the build command so
the rendered `index.html` and the data directory are no longer pinned to
the location of the installed package. Defaults are now relative to the
current working directory:

- `--directory` defaults to `public/data` (was `ROOT / "public" / "data"`)
- new `--html-output` flag, defaults to `index.html` (was `ROOT / "index.html"`)

Upstream behavior is unchanged when run from the repo root. Downstream
consumers can now install the CLI as a package and run `build` from
anywhere — useful for site forks that overlay their own config and let
upstream render `index.html` into their working tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aboydnw aboydnw requested a review from gadomski as a code owner May 6, 2026 18:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

aboydnw and others added 2 commits May 6, 2026 18:52
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The cwd-relative default already lets downstream consumers control the
output location by chdir'ing before calling build. The extra flag added
API surface for a case nobody had.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aboydnw
Copy link
Copy Markdown
Member Author

aboydnw commented May 6, 2026

@gadomski ready for your review. another follow up to #131 and #127 found when trying to implement this in nasa-odsi-contributor-network

@aboydnw aboydnw merged commit 8abfd93 into main May 7, 2026
3 checks passed
@aboydnw aboydnw deleted the feat/decouple-build-from-root branch May 7, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants