-
Notifications
You must be signed in to change notification settings - Fork 15
DOC: Adopt from dandi-cli - rudimentary CLAUDE.md and pytest_plugin.py (summary of depends, ai_generated marker, better diff for DandiBaseModel) #402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Repo Overview | ||
| - `dandischema` is a pure-Python library defining the DANDI metadata schemata (no CLI). | ||
| - Source lives under `dandischema/`, tests under `dandischema/tests/`. | ||
| - Helper scripts (schema publishing, license fetching, etc.) live under `tools/`. | ||
| - `pyproject.toml` is the single source of truth for dependencies and tool config; `tox.ini` orchestrates testing/linting; `.pre-commit-config.yaml` runs auto-formatters. | ||
|
|
||
| ## Build/Test Commands | ||
| - Run full test suite: `tox -e py3` (or `tox -e py` to use the active interpreter). | ||
| - Run a single test: `tox -e py3 -- dandischema/tests/test_models.py::test_function -v`. | ||
| - Inside an active venv (`uv venv` / `source .venv/bin/activate`): `python -m pytest dandischema`. | ||
| - Lint: `tox -e lint` (runs `codespell` + `flake8` over `dandischema/`). | ||
| - Type checking: `tox -e typing` (runs `mypy dandischema`). | ||
| - Lint + types together: `tox -e lint,typing`. | ||
| - Set `DANDI_TESTS_NONETWORK=1` to make tests refuse outbound HTTP (the `disable_http` autouse fixture in `dandischema/tests/conftest.py` points proxies at a dead address). | ||
| - DataCite-dependent tests require `DATACITE_DEV_LOGIN` / `DATACITE_DEV_PASSWORD`; set `NO_ET=1` to disable etelemetry. Both are passed through by tox. | ||
| - There is no `docker-compose` in this repo and no `hatch run test:run` env — don't suggest those (the dandi-cli pattern doesn't apply here). | ||
|
|
||
| ## Pre-commit | ||
| - Install hooks if missing (no `.git/hooks/pre-commit` present): `pre-commit install`. | ||
| - Hooks run: trailing-whitespace, end-of-file-fixer, check-yaml, check-added-large-files, black, isort, codespell, flake8. | ||
| - If a commit fails because hooks auto-fixed files, just re-run `git commit` — the second attempt usually succeeds. Investigate further only if it fails twice. | ||
|
|
||
| ## Test Markers | ||
| - Mark AI-generated tests with `@pytest.mark.ai_generated`. | ||
| - This project does **not** have a `pytest_plugin.py`. If a new marker is introduced, register it under a `[pytest]`/`markers =` block in `tox.ini` (or via `pytest.ini`/`conftest.py`) — otherwise `filterwarnings = error` (set in `tox.ini`) will turn the unregistered-marker warning into a failure. | ||
|
|
||
| ## Code Style | ||
| - Black-formatted, line length 100 (see `.flake8: max-line-length = 100`; flake8 ignores `E203,W503`). | ||
| - isort with `profile = "black"`, `force_sort_within_sections = true`, `reverse_relative = true`, `known_first_party = ["dandischema"]`. | ||
| - Type annotations required for all new code — `mypy` runs in strict-ish mode (`allow_untyped_defs = false`, `warn_return_any`, `warn_unreachable`, `pydantic.mypy` plugin enabled). Models use Pydantic v2 (`pydantic[email]~=2.4`). | ||
| - Class names: CamelCase; functions/variables: snake_case. | ||
| - Exception names end with `Error` (see `dandischema/exceptions.py`). | ||
| - Docstrings in NumPy style for public APIs; keep them in sync with signature changes. | ||
| - Prefer specific exceptions over generic ones. | ||
| - Imports organized stdlib / third-party / local, alphabetical within groups (isort handles ordering). | ||
| - All imports at module top — no function-local imports (per global rule), unless guarding an optional dep with `try/except ImportError`. | ||
|
|
||
| ## Schema / Data Files | ||
| - `dandischema/*.yaml` (e.g. `standards.yaml`, `model_standards.yaml`, `personinfo.yaml`) are tracked schema/data inputs — don't reformat or rename casually; downstream consumers and `tools/pubschemata.py` rely on them. | ||
| - `dandischema/_version.py` is generated by `versioningit` (see `[tool.versioningit.write]`); don't edit by hand. | ||
|
yarikoptic marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.