8000
Skip to content

Add local dev setup with lightweight Docker infrastructure#3910

Open
Simrayz wants to merge 1 commit intomasterfrom
feature/local-dev-setup-v2
Open

Add local dev setup with lightweight Docker infrastructure#3910
Simrayz wants to merge 1 commit intomasterfrom
feature/local-dev-setup-v2

Conversation

@Simrayz
Copy link
Copy Markdown
Contributor
@Simrayz Simrayz commented Mar 24, 2026

Scope and purpose

Split from #3864.

Adds a lightweight alternative to devcontainers for local NAV development. Uses a minimal docker-compose.local.yml (PostgreSQL + Graphite only) with a setup script that configures the virtualenv, installs dependencies, and syncs the database.

Usage

make local-setup    # one-time setup
make local-up       # start infrastructure
make local-down     # stop infrastructure
uv run django-admin runserver  # run web server

The Python version defaults to 3.11 but can be overridden with NAV_PYTHON=3.12 make local-setup.

Why sitecustomize.py

The setup installs a sitecustomize.py into the site-packages of the virtualenv. This enables us to set DJANGO_SETTINGS_MODULE, PGHOST and other required env variables automatically on every Python invocation. That means uv run django-admin runserver, uv run pytest etc. all work without having to source an .env. file or using shell helper scripts. It is also a good place to put the macOS patch in #3911.

This pull request

  • adds a dependency on Docker (PostgreSQL + Graphite containers)

Contributor Checklist

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • Wrote the commit message so that the first line continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • Based this pull request on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If it's not obvious from a linked issue, described how to interact with NAV in order for a reviewer to observe the effects of this change first-hand (commands, URLs, UI interactions)
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

@Simrayz Simrayz self-assigned this Mar 24, 2026
@Simrayz Simrayz added nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) DevEx labels Mar 24, 2026
@github-actions
Copy link
Copy Markdown
github-actions bot commented Mar 24, 2026

Test results

    13 files      13 suites   25m 1s ⏱️
 2 915 tests  2 915 ✅ 0 💤 0 ❌
17 046 runs  17 046 ✅ 0 💤 0 ❌

Results for commit 096cc80.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown
codecov bot commented Mar 24, 2026
8000

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.91%. Comparing base (0e5ec3c) to head (096cc80).
⚠️ Report is 26 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3910      +/-   ##
==========================================
+ Coverage   63.89%   63.91%   +0.02%     
==========================================
  Files         625      625              
  Lines       46260    46283      +23     
  Branches       43       43              
==========================================
+ Hits        29557    29584      +27     
+ Misses      16693    16689       -4     
  Partials       10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Simrayz Simrayz requested a review from a team March 24, 2026 08:51
@Simrayz Simrayz force-pushed the feature/local-dev-setup-v2 branch from 39372fc to 3c8869a Compare March 24, 2026 09:13
@Simrayz Simrayz force-pushed the feature/local-dev-setup-v2 branch from 3c8869a to 096cc80 Compare March 24, 2026 09:24
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DevEx nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0