Skip to content

Commit c3fbf35

Browse files
Merge pull request #1300 from datajoint/claude/clarify-column-type-names-2dpns
Implement Codec Infrastructure
2 parents 164e7cc + fa47f47 commit c3fbf35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+4040
-4988
lines changed

README.md

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,30 +146,57 @@ DataJoint (<https://datajoint.com>).
146146

147147
### Prerequisites
148148

149-
- [Docker](https://docs.docker.com/get-docker/) for MySQL and MinIO services
149+
- [Docker](https://docs.docker.com/get-docker/) (Docker daemon must be running)
150150
- Python 3.10+
151151

152-
### Running Tests
153-
154-
Tests are organized into `unit/` (no external services) and `integration/` (requires MySQL + MinIO):
152+
### Quick Start
155153

156154
```bash
157-
# Install dependencies
155+
# Clone and install
156+
git clone https://github.com/datajoint/datajoint-python.git
157+
cd datajoint-python
158158
pip install -e ".[test]"
159159
160-
# Run unit tests only (fast, no Docker needed)
161-
pytest tests/unit/
160+
# Run all tests (containers start automatically via testcontainers)
161+
pytest tests/
162162
163-
# Start MySQL and MinIO for integration tests
164-
docker compose up -d db minio
163+
# Install and run pre-commit hooks
164+
pip install pre-commit
165+
pre-commit install
166+
pre-commit run --all-files
167+
```
165168

166-
# Run all tests
169+
### Running Tests
170+
171+
Tests use [testcontainers](https://testcontainers.com/) to automatically manage MySQL and MinIO containers.
172+
**No manual `docker-compose up` required** - containers start when tests run and stop afterward.
173+
174+
```bash
175+
# Run all tests (recommended)
167176
pytest tests/
168177
178+
# Run with coverage report
179+
pytest --cov-report term-missing --cov=datajoint tests/
180+
169181
# Run specific test file
170182
pytest tests/integration/test_blob.py -v
171183
172-
# Stop services when done
184+
# Run only unit tests (no containers needed)
185+
pytest tests/unit/
186+
```
187+
188+
### Alternative: External Containers
189+
190+
For development/debugging, you may prefer persistent containers that survive test runs:
191+
192+
```bash
193+
# Start containers manually
194+
docker compose up -d db minio
195+
196+
# Run tests using external containers
197+
DJ_USE_EXTERNAL_CONTAINERS=1 pytest tests/
198+
199+
# Stop containers when done
173200
docker compose down
174201
```
175202

@@ -183,24 +210,46 @@ docker compose --profile test up djtest --build
183210

184211
### Alternative: Using pixi
185212

186-
[pixi](https://pixi.sh) users can run tests with automatic service management:
213+
[pixi](https://pixi.sh) users can run tests with:
187214

188215
```bash
189216
pixi install # First time setup
190-
pixi run test # Starts services and runs tests
191-
pixi run services-down # Stop services
217+
pixi run test # Runs tests (testcontainers manages containers)
192218
```
193219

194220
### Pre-commit Hooks
195221

222+
Pre-commit hooks run automatically on `git commit` to check code quality.
223+
**All hooks must pass before committing.**
224+
196225
```bash
197-
pre-commit install # Install hooks (first time)
198-
pre-commit run --all-files # Run all checks
226+
# Install hooks (first time only)
227+
pip install pre-commit
228+
pre-commit install
229+
230+
# Run all checks manually
231+
pre-commit run --all-files
232+
233+
# Run specific hook
234+
pre-commit run ruff --all-files
235+
pre-commit run codespell --all-files
199236
```
200237

238+
Hooks include:
239+
- **ruff**: Python linting and formatting
240+
- **codespell**: Spell checking
241+
- **YAML/JSON/TOML validation**
242+
- **Large file detection**
243+
244+
### Before Submitting a PR
245+
246+
1. **Run all tests**: `pytest tests/`
247+
2. **Run pre-commit**: `pre-commit run --all-files`
248+
3. **Check coverage**: `pytest --cov-report term-missing --cov=datajoint tests/`
249+
201250
### Environment Variables
202251

203-
Tests use these defaults (configured in `pyproject.toml`):
252+
For external container mode (`DJ_USE_EXTERNAL_CONTAINERS=1`):
204253

205254
| Variable | Default | Description |
206255
|----------|---------|-------------|

docker-compose.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# Development environment with MySQL and MinIO services
22
#
3-
# Quick start:
4-
# docker compose up -d db minio # Start services
5-
# pytest tests/ # Run tests (uses localhost defaults)
3+
# NOTE: docker-compose is OPTIONAL for running tests.
4+
# Tests use testcontainers to automatically manage containers.
5+
# Just run: pytest tests/
66
#
7-
# Full Docker testing:
7+
# Use docker-compose for development/debugging when you want
8+
# persistent containers that survive test runs:
9+
# docker compose up -d db minio # Start services manually
10+
# pytest tests/ # Tests will use these containers
11+
#
12+
# Full Docker testing (CI):
813
# docker compose --profile test up djtest --build
914
services:
1015
db:

docs/mkdocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ nav:
3333
- Blobs: design/tables/blobs.md
3434
- Attachments: design/tables/attach.md
3535
- Filepaths: design/tables/filepath.md
36-
- Custom Datatypes: design/tables/customtype.md
36+
- Custom Codecs: design/tables/codecs.md
3737
- Dependencies: design/tables/dependencies.md
3838
- Indexes: design/tables/indexes.md
3939
- Master-Part Relationships: design/tables/master-part.md

0 commit comments

Comments
 (0)