planetary-computer-tasks
Copilot instructions43 starsChanged 5 years agoMITView on GitHub
Monorepo of 12 Python namespace packages under pctasks/, each independently installable via hatchling. Dependency order: core → cli → task → client → ingest → ingest_task → dataset → run → notify → router → server → dev. Additional code in pctasks_funcs/ (Azure Functions), datasets/ (~60 dataset definitions), and deployment/ (Terraform/Helm). Core data flow: blob storage assets → splits (by prefix) → chunks (file listing CSVs) → Collection.create_item() produces pystac Items → ingest into PgSTAC via pypgstac. Key abstractions: -…
The file
We split this copilot-instructions.md into the rules it gives an agent
7 rules. About 0 are common, 0 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
All models extend PCBaseModel (Pydantic v2).
- Very specific: line 70
Use StorageFactory() in tests for blob access.
- Very specific: line 74
Use a fresh date tag (for example YYYY.MM.DD) rather than reusing an existing ACR tag, so Batch nodes do not pull a stale cached image.
- Very specific: line 75
If using scripts/publish-ingestion-images, first check the current script contents.
- Very specific: line 78
Ensure pctasks is on PATH before workflow operations.
- Very specific: line 81
Verify before/after upsert by generating the workflow without --upsert and grepping for the expected image tag.
- Very specific: line 89
Azure Blob Storage: All asset URIs use blob://<account>/<container>/<path> scheme.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Guidelines — Planetary Computer Tasks (pctasks)
Architecture
Monorepo of 12 Python namespace packages under pctasks/, each independently installable via hatchling. Dependency order: core → cli → task → client → ingest → ingest_task → dataset → run → notify → router → server → dev. Additional code in pctasks_funcs/ (Azure Functions), datasets/ (~60 dataset definitions), and deployment/ (Terraform/Helm).
Core data flow: blob storage assets → splits (by prefix) → chunks (file listing CSVs) → Collection.create_item() produces pystac Items → ingest into PgSTAC via pypgstac.
Key abstractions:
PCBaseModel(pctasks/core/pctasks/core/models/base.py): Pydantic v2 base with YAML serde,by_alias=True,exclude_none=True.Task[T, U](pctasks/task/pctasks/task/task.py): Generic abstract task, define_input_model/_output_modelandrun(input, context).Collection(pctasks/dataset/pctasks/dataset/collection.py): Abstract base for datasets; implementcreate_item(cls, asset_uri, storage_factory) -> List[pystac.Item] | WaitTaskResultas a classmethod.StorageFactory: CreatesStorageobjects fromblob://<account>/<container>/<path>URIs.- Settings:
pydantic-settingswith double-underscore env vars (PCTASKS__COSMOSDB__URL,PCTASKS_RUN__TASK_RUNNER_TYPE).
Code Style
- Formatter: black (default settings) + isort. Run
scripts/format. - Linter: flake8 with
max-line-length = 120, ignoresE203, W503, E731, E722(see.flake8). - Type checking: mypy with
disallow_untyped_defs = True— all functions must have type annotations (seemypy.ini). - No docstrings unless explicitly requested.
- All models extend
PCBaseModel(Pydantic v2). Usemodel_validate,model_dump,field_validator,model_validator.
Build and Test
scripts/install # Create venv with uv, install all packages in editable mode
scripts/server # Start local dev stack (Azurite, PgSTAC, server, STAC API)
scripts/test # Full lint + test suite (runs in Docker via docker-compose.console.yml)
scripts/test --subpackage core # Test one package
scripts/test --test-only # Skip lint
scripts/test --lint-only # Skip tests
scripts/format # Auto-format all packages (black + isort)Per-package test commands (from within pctasks/<pkg>/):
pytest tests/ # Run package tests
mypy --config-file ../../mypy.ini pctasks # Type-checkProject Conventions
Dataset directory pattern (datasets/<name>/)
dataset.yaml # Required: dataset definition (id, image, collections, asset_storage, chunks)
<name>.py # Required: Collection subclass with create_item classmethod
collection/template.json # STAC collection Jinja2 template
test_<name>.py # Tests: import collection class, call create_item with blob URIs
requirements.txt # Optional: extra pip deps
Dockerfile # Optional: custom image (otherwise uses pctasks-task-base)Dataset YAML references code via ${{ local.path(./<file>.py) }} and class via <module>:<ClassName> (no .py).
Templating syntax in YAML
${{ args.<name> }}— CLI arguments${{ secrets.<key> }}— KeyVault/dev-secrets.yaml${{ local.path(<relative>) }}— Path relative to YAML file${{ local.file(<relative>) }}— Inline file contents
CLI
Click-based with plugin discovery via pctasks.commands entry point group. Each package registers subcommands in its pyproject.toml.
Testing patterns
- pytest with
asyncio_mode = auto(seepytest.ini) - Dataset tests are co-located:
datasets/<name>/test_<name>.py - Package tests:
pctasks/<pkg>/tests/ - Integration tests:
tests/ - Use
StorageFactory()in tests for blob access;SimpleWorkflowExecutorfor local workflow execution.
Dataset image publish + workflow republish
- For dataset-specific Docker image changes, update the dataset image tag everywhere the workflow reads it. Dynamic update workflows often use a separate
datasets/<name>/update.yaml, not justdataset.yaml. - Use a fresh date tag (for example
YYYY.MM.DD) rather than reusing an existing ACR tag, so Batch nodes do not pull a stale cached image. - If using
scripts/publish-ingestion-images, first check the current script contents. It may be temporarily narrowed to one dataset image. SetTAGto the same tag used in the dataset YAML and ensure the desired image entry is enabled. - Authenticate before pushing:
az acr login -n pccomponents. - Publish to ACR with
scripts/publish-ingestion-images(or an equivalentdocker build/docker pushcommand) from the repo root. Make sure only the image you want pushed is in theimagesarray in the script so that no other images are inadvertently built and pushed. - Ensure
pctasksis onPATHbefore workflow operations. If absent, create/use.venvwithuv venvand install the editable packages fromscripts/installlogic, then usePATH="$PWD/.venv/bin:$PATH". - Republish dynamic update workflows with the command in the dataset README, commonly:
pctasks dataset process-items '${{ args.since }}' -d datasets/<name>/update.yaml -c <collection-id> --workflow-id=<workflow-id> --is-update-workflow --upsert - Verify before/after upsert by generating the workflow without
--upsertand grepping for the expected image tag. - Submit an update/backfill by adding
--submit --confirm -a registry pccomponents.azurecr.io -a since <ISO datetime>to the sameprocess-itemscommand. Example since value:2026-04-01T00:00:00. - Production workflow pods run in Kubernetes namespace
pc; recent workflows can be found withkubectl -n pc get workflows.argoproj.io --sort-by=.metadata.creationTimestamp. - Workflow/task logs are uploaded to Azure Storage account
pctaskscommon, containertasklogs, underlogs/<run-id>/. The main workflow log islogs/<run-id>/workflow-run-log.txt; task logs are nested by job/partition/task, e.g.logs/<run-id>/process-chunk/0/create-items/task-log.txt. - Argo may show
Succeededwhen the wrapper pod completed even if PCTasks loggedWorkflow failed!; always inspect thepctaskscommon/tasklogsworkflow log and failed task logs for the true PCTasks status.
Integration Points
- Azure Blob Storage: All asset URIs use
blob://<account>/<container>/<path>scheme. - Cosmos DB: Workflow/run state persistence; emulated locally via docker-compose.
- PgSTAC: STAC item storage (PostgreSQL + PostGIS), port 5499 locally.
- Azurite: Local Azure Storage emulator, ports 10000-10002.
- Argo Workflows: Production workflow orchestration on Kubernetes.
- Azure Batch: Production task execution.
- Kind cluster: Local Kubernetes for Argo testing (
scripts/cluster setup).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

