- Core PubPub API helpers live in
pypubpub/(Pubv6.py,scripttasks/,repec/,utility/); keep reusable abstractions here. - Automation and maintenance scripts sit under
scripts/(pubpub_automation/for package assembly,utilities/for DOI/link fixes); notebooks and exploratory work live innotebooks/. tests/houses pytest suites grouped by feature (test_create/,test_batch_operations/,test_repec/). Large production artifacts stay inrepec_rdfs/and should not be edited unless regenerating metadata.- Add new docs beside existing references in
docs/(automation guides, setup summaries) so operational notes remain centralized.
- Create a virtual environment and install editable dependencies:
python -m venv .venv && source .venv/bin/activate pip install -e .[dev]
- Run the full suite (requires API creds via
tests/conf_settings.py):pytest
- Targeted checks:
pytest tests/test_create/test_create_pub.py -k batchfor creation flows,python scripts/utilities/delete_untitled_pubs.pyor otherscripts/pubpub_automation/*.pyentries to exercise individual tools.
- Follow PEP 8 with 4-space indentation, snake_case for functions, PascalCase for classes (
Pubshelper_v6,UserAttribution), and descriptive module names; match the existing pattern when adding helpers (e.g.,generate_sluginutils.py). - Prefer dataclasses/TypedDicts for structured payloads and keep API payload assembly near the helper that submits it.
- Inline logging should stay human-readable; favor f-strings and avoid leaking passwords (mask as done in
login).
- Pytest discovers any
test_*.py; mirror the existing directory naming (feature folders) and keep fixtures intests/conftest.py. - Integration tests depend on live PubPub credentials stored in a developer-only
tests/conf_settings.py; copy and edittests/conf_settings_template.pyand never commit secrets. - When adding automation, provide a fast unit-style test that mocks network calls in addition to any credentialed integration case; include assertions for retries, slug generation, and cleanup.
- Recent history (
moves and cleanups,Add utility script to delete untitled publications) shows concise, imperative summaries—stick to that voice and keep titles under ~50 chars. - PRs should describe the automation or API behavior touched, reference the relevant script or module paths, list manual test commands (e.g.,
pytest, script invocations), and attach screenshots or logs when they change PubPub content. - Link Coda tasks or GitHub issues when applicable, call out required credentials/config files, and note any doc updates made in
docs/orAGENTS.md.
- Store secrets in environment variables or
.env/tests/conf_settings.py;.env.exampledocuments required keys. - Scripts that call PubPub or Coda APIs assume HTTPS endpoints—double-check community IDs and avoid committing generated RDFs or evaluation drafts unless they are finalized.