|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance for Claude Code when working with this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +`cernopendata-client` is a command-line tool to download files from the CERN |
| 8 | +Open Data portal. It enables querying datasets and downloading/verifying |
| 9 | +individual data files. |
| 10 | + |
| 11 | +## Development Setup |
| 12 | + |
| 13 | +```bash |
| 14 | +# Using mise (recommended) - installs Python versions 3.8-3.14 |
| 15 | +mise install |
| 16 | + |
| 17 | +# Create virtual environment and install in editable mode |
| 18 | +python3 -m venv env |
| 19 | +source env/bin/activate |
| 20 | +pip install -e '.[tests]' |
| 21 | +``` |
| 22 | + |
| 23 | +## Testing and Code Quality |
| 24 | + |
| 25 | +The project uses `run-tests.sh` for all quality checks. Run all checks with: |
| 26 | + |
| 27 | +```bash |
| 28 | +./run-tests.sh |
| 29 | +``` |
| 30 | + |
| 31 | +### Individual Check Commands |
| 32 | + |
| 33 | +| Command | Description | |
| 34 | +| ------------------------------------ | -------------------------------------- | |
| 35 | +| `./run-tests.sh --python-tests` | Run pytest test suite | |
| 36 | +| `./run-tests.sh --format-black` | Check Python formatting (black) | |
| 37 | +| `./run-tests.sh --lint-flake8` | Lint Python code (flake8) | |
| 38 | +| `./run-tests.sh --lint-pydocstyle` | Check Python docstrings | |
| 39 | +| `./run-tests.sh --format-prettier` | Check Markdown/YAML formatting | |
| 40 | +| `./run-tests.sh --format-shfmt` | Check shell script formatting | |
| 41 | +| `./run-tests.sh --lint-shellcheck` | Lint shell scripts | |
| 42 | +| `./run-tests.sh --lint-markdownlint` | Lint Markdown files | |
| 43 | +| `./run-tests.sh --lint-yamllint` | Lint YAML files | |
| 44 | +| `./run-tests.sh --lint-jsonlint` | Lint JSON files | |
| 45 | +| `./run-tests.sh --lint-commitlint` | Check commit message format | |
| 46 | +| `./run-tests.sh --lint-manifest` | Check Python manifest (check-manifest) | |
| 47 | +| `./run-tests.sh --docs-sphinx` | Build and test Sphinx documentation | |
| 48 | +| `./run-tests.sh --docker-build` | Build Docker image | |
| 49 | +| `./run-tests.sh --docker-tests` | Run tests in Docker container | |
| 50 | +| `./run-tests.sh --lint-hadolint` | Lint Dockerfile | |
| 51 | + |
| 52 | +### Using tox for Multi-Python Testing |
| 53 | + |
| 54 | +```bash |
| 55 | +tox # Run tests across all Python versions (3.8-3.14) |
| 56 | +tox -e py312 # Run tests for specific Python version |
| 57 | +``` |
| 58 | + |
| 59 | +## Project Structure |
| 60 | + |
| 61 | +- `cernopendata_client/` - Main Python package |
| 62 | + - `cli.py` - Command-line interface (Click-based) |
| 63 | + - `downloader.py` - File download functionality |
| 64 | + - `searcher.py` - Dataset search functionality |
| 65 | + - `verifier.py` - File verification |
| 66 | + - `validator.py` - Input validation |
| 67 | + - `metadater.py` - Metadata handling |
| 68 | + - `config.py` - Configuration |
| 69 | + - `printer.py` - Output formatting |
| 70 | + - `utils.py` - Utility functions |
| 71 | + - `walker.py` - Directory traversal |
| 72 | +- `tests/` - Test suite |
| 73 | +- `docs/` - Sphinx documentation |
| 74 | + |
| 75 | +## Code Style |
| 76 | + |
| 77 | +- Python formatting: black |
| 78 | +- Python linting: flake8 |
| 79 | +- Docstrings: pydocstyle (ignores D413, D301) |
| 80 | +- Commit messages: conventional commits (commitlint) |
| 81 | +- Shell scripts: shellcheck + shfmt |
| 82 | +- Markdown/YAML/JSON: prettier + markdownlint + yamllint + jsonlint |
| 83 | + |
| 84 | +## Key Notes |
| 85 | + |
| 86 | +- License: GPLv3 |
| 87 | +- Python support: 3.8 - 3.14 |
| 88 | +- Main branch: `master` |
0 commit comments