Skip to content

Introduce hatch-managed environments#1831

Open
candleindark wants to merge 2 commits intodandi:masterfrom
candleindark:introduce-hatch-envs
Open

Introduce hatch-managed environments#1831
candleindark wants to merge 2 commits intodandi:masterfrom
candleindark:introduce-hatch-envs

Conversation

@candleindark
Copy link
Copy Markdown
Member

@candleindark candleindark commented Apr 2, 2026

Summary

This PR introduces hatch-managed environments
to the project, providing a convenient way to quickly set up clean,
relevant environments for development. This change does not affect the
build or any other aspect of the project.

  • Add hatch environments (extensions, extras, style, test,
    tools, all), each corresponding to a project extra, using uv
    as the installer for fast environment setup
  • Add DANDI_PAGINATION_DISABLE_FALLBACK env var and a run script
    (hatch run test:run) to the test environment
  • Update CLAUDE.md and DEVELOPMENT.md to document hatch usage

Test plan

  • hatch run test:run runs tests in dandi/tests
  • CI passes

🤖 Generated with Claude Code

@candleindark candleindark added internal Changes only affect the internal API infrastructure Tools, build systems, CI/CD, development workflows labels Apr 2, 2026
- Add hatch environments (`extensions`, `extras`, `style`, `test`,
  `tools`, `all`), each corresponding to a project extra, using `uv`
  as the installer for fast environment setup
- Add `DANDI_PAGINATION_DISABLE_FALLBACK` env var and a `run` script
  (`hatch run test:run`) to the `test` environment
- Update `CLAUDE.md` and `DEVELOPMENT.md` to document hatch usage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@candleindark candleindark force-pushed the introduce-hatch-envs branch from 62057bb to 6b56e02 Compare April 2, 2026 21:17
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.10%. Comparing base (f14c1ee) to head (637faef).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1831      +/-   ##
==========================================
- Coverage   75.13%   75.10%   -0.03%     
==========================================
  Files          85       85              
  Lines       11932    11932              
==========================================
- Hits         8965     8962       -3     
- Misses       2967     2970       +3     
Flag Coverage Δ
unittests 75.10% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@candleindark candleindark requested a review from yarikoptic April 2, 2026 21:49
@yarikoptic
Copy link
Copy Markdown
Member

uff, if only for you since I personally do not use hatch and prefer tox. @CodyCBakerPhD @asmacdo do you use hatch or tox or neither?

@yarikoptic yarikoptic added the DX Developer eXperience label Apr 2, 2026
@CodyCBakerPhD
Copy link
Copy Markdown
Contributor

I do not use hatch

@asmacdo
Copy link
Copy Markdown
Member

asmacdo commented Apr 2, 2026

I use tox, not attached to it but it gets the job done. I haven't really used hatch.

@candleindark
Copy link
Copy Markdown
Member Author

uff, if only for you since I personally do not use hatch and prefer tox. @CodyCBakerPhD @asmacdo do you use hatch or tox or neither?

Well, in this team, it is only for me then. However, it is possible that there are people outside of this team find the setup useful/convenient. As it is noted in the top post of this PR, the changes in this PR don't add or modify any existing setup but just add the option of using Hatch-managed environments.

@candleindark
Copy link
Copy Markdown
Member Author

candleindark commented Apr 2, 2026

The main goal for me really is to replace

git clone https://github.com/dandi/dandi-cli \
&& cd dandi-cli \
&& virtualenv --system-site-packages --python=python3 venvs/dev3 \
&& source venvs/dev3/bin/activate \
&& pip install -e ".[test]"

with just hatch shell test which also has the need environment variable set for testing as in https://github.com/candleindark/dandi-cli/blob/6b56e0220a5547636786b483c918d7d206173694/pyproject.toml#L236-L241

and I can just delete the environment with hatch env remove test to start again with the environment as defined in pyproject.toml afresh again.

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

Labels

DX Developer eXperience infrastructure Tools, build systems, CI/CD, development workflows internal Changes only affect the internal API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants