Skip to content

Commit fa33e8d

Browse files
authored
Merge pull request #1822 from dandi/enh-validators
ENH: Machine-readable validate output with store/reload
2 parents f42d958 + 505de8f commit fa33e8d

21 files changed

Lines changed: 2659 additions & 69 deletions

.specify/specs/validate-machine-readable-output.md

Lines changed: 1108 additions & 0 deletions
Large diffs are not rendered by default.

DEVELOPMENT.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,31 @@ instance as `dandi-api-local-docker-tests`. See the note below on the
9292
`DANDI_DEVEL` environment variable, which is needed in order to expose the
9393
development command line options.
9494

95+
## Code style conventions
96+
97+
### Dataclass and attrs field documentation
98+
99+
Document dataclass/attrs fields using `#:` comments above the field, not
100+
docstrings below. This is the format Sphinx autodoc recognizes for attribute
101+
documentation:
102+
103+
```python
104+
@dataclass
105+
class Movement:
106+
"""A movement/renaming of an asset"""
107+
108+
#: The asset's original path
109+
src: AssetPath
110+
#: The asset's destination path
111+
dest: AssetPath
112+
#: Whether to skip this operation because an asset already exists at the
113+
#: destination
114+
skip: bool = False
115+
```
116+
117+
See [dandi.move.Movement on RTD](https://dandi.readthedocs.io/en/latest/modref/generated/dandi.move.html#dandi.move.Movement)
118+
for a rendered example.
119+
95120
## Environment variables
96121

97122
- `DANDI_DEVEL` -- enables otherwise hidden command line options, such as

dandi/bids_validator_deno/_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pydantic import DirectoryPath, validate_call
1414

1515
from dandi.utils import find_parent_directory_containing
16-
from dandi.validate.types import (
16+
from dandi.validate._types import (
1717
Origin,
1818
OriginType,
1919
Scope,

dandi/cli/cmd_upload.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,21 @@ def upload(
9696
can point to specific files you would like to validate and have uploaded.
9797
"""
9898
# Avoid heavy imports by importing with function:
99-
from ..upload import upload
99+
from ..upload import upload as upload_
100+
from ..validate._io import validation_companion_path
100101

101102
if jobs_pair is None:
102103
jobs = None
103104
jobs_per_file = None
104105
else:
105106
jobs, jobs_per_file = jobs_pair
106107

107-
upload(
108+
ctx = click.get_current_context()
109+
companion = (
110+
validation_companion_path(ctx.obj.logfile) if ctx.obj is not None else None
111+
)
112+
113+
upload_(
108114
paths,
109115
existing=existing,
110116
validation=validation,
@@ -115,4 +121,5 @@ def upload(
115121
jobs=jobs,
116122
jobs_per_file=jobs_per_file,
117123
sync=sync,
124+
validation_log_path=companion,
118125
)

0 commit comments

Comments
 (0)