cosmos-synthia 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. cosmos_synthia-0.1.0/.github/workflows/deploy.yml +63 -0
  2. cosmos_synthia-0.1.0/.github/workflows/python-app.yml +35 -0
  3. cosmos_synthia-0.1.0/.gitignore +12 -0
  4. cosmos_synthia-0.1.0/.pre-commit-config.yaml +20 -0
  5. cosmos_synthia-0.1.0/CONTRIBUTING.md +99 -0
  6. cosmos_synthia-0.1.0/INSTALL.md +38 -0
  7. cosmos_synthia-0.1.0/LICENSE +674 -0
  8. cosmos_synthia-0.1.0/PKG-INFO +121 -0
  9. cosmos_synthia-0.1.0/README.md +92 -0
  10. cosmos_synthia-0.1.0/benchmarks/PLAN.md +229 -0
  11. cosmos_synthia-0.1.0/benchmarks/cases.py +181 -0
  12. cosmos_synthia-0.1.0/benchmarks/grade.py +181 -0
  13. cosmos_synthia-0.1.0/benchmarks/harness.py +506 -0
  14. cosmos_synthia-0.1.0/benchmarks/report.py +190 -0
  15. cosmos_synthia-0.1.0/benchmarks/run.py +234 -0
  16. cosmos_synthia-0.1.0/pyproject.toml +93 -0
  17. cosmos_synthia-0.1.0/src/synthia/__init__.py +12 -0
  18. cosmos_synthia-0.1.0/src/synthia/_safety.py +180 -0
  19. cosmos_synthia-0.1.0/src/synthia/_version.py +24 -0
  20. cosmos_synthia-0.1.0/src/synthia/grids.py +577 -0
  21. cosmos_synthia-0.1.0/src/synthia/guidance.py +480 -0
  22. cosmos_synthia-0.1.0/src/synthia/inspection.py +566 -0
  23. cosmos_synthia-0.1.0/src/synthia/install.py +678 -0
  24. cosmos_synthia-0.1.0/src/synthia/plots.py +413 -0
  25. cosmos_synthia-0.1.0/src/synthia/server.py +72 -0
  26. cosmos_synthia-0.1.0/src/synthia/skill/SKILL.md +252 -0
  27. cosmos_synthia-0.1.0/src/synthia/skill/examples/agn.py +53 -0
  28. cosmos_synthia-0.1.0/src/synthia/skill/examples/custom-emission-model.py +51 -0
  29. cosmos_synthia-0.1.0/src/synthia/skill/examples/emission-models.py +57 -0
  30. cosmos_synthia-0.1.0/src/synthia/skill/examples/imaging.py +59 -0
  31. cosmos_synthia-0.1.0/src/synthia/skill/examples/lines.py +51 -0
  32. cosmos_synthia-0.1.0/src/synthia/skill/examples/mock-data.py +75 -0
  33. cosmos_synthia-0.1.0/src/synthia/skill/examples/model-variations.py +37 -0
  34. cosmos_synthia-0.1.0/src/synthia/skill/examples/parametric-sed.py +46 -0
  35. cosmos_synthia-0.1.0/src/synthia/skill/examples/particle-sed.py +50 -0
  36. cosmos_synthia-0.1.0/src/synthia/skill/examples/photometry.py +65 -0
  37. cosmos_synthia-0.1.0/src/synthia/skill/examples/pipeline.py +57 -0
  38. cosmos_synthia-0.1.0/src/synthia/skill/examples/plotting.py +54 -0
  39. cosmos_synthia-0.1.0/src/synthia/skill/references/concepts.md +165 -0
  40. cosmos_synthia-0.1.0/src/synthia/skill/references/custom-emission-models.md +113 -0
  41. cosmos_synthia-0.1.0/src/synthia/skill/references/emission-models.md +153 -0
  42. cosmos_synthia-0.1.0/src/synthia/skill/references/emitter-blackholes.md +100 -0
  43. cosmos_synthia-0.1.0/src/synthia/skill/references/emitter-galaxy.md +76 -0
  44. cosmos_synthia-0.1.0/src/synthia/skill/references/emitter-gas.md +54 -0
  45. cosmos_synthia-0.1.0/src/synthia/skill/references/emitter-stars.md +84 -0
  46. cosmos_synthia-0.1.0/src/synthia/skill/references/lines.md +81 -0
  47. cosmos_synthia-0.1.0/src/synthia/skill/references/model-parameters.md +137 -0
  48. cosmos_synthia-0.1.0/src/synthia/skill/references/observables.md +145 -0
  49. cosmos_synthia-0.1.0/src/synthia/skill/references/parametric.md +129 -0
  50. cosmos_synthia-0.1.0/src/synthia/skill/references/particle.md +118 -0
  51. cosmos_synthia-0.1.0/src/synthia/skill/references/pipeline.md +62 -0
  52. cosmos_synthia-0.1.0/src/synthia/skill/references/premade-emission-models.md +114 -0
  53. cosmos_synthia-0.1.0/src/synthia/skill/references/troubleshooting.md +166 -0
  54. cosmos_synthia-0.1.0/src/synthia/skill/references/units-and-data.md +178 -0
  55. cosmos_synthia-0.1.0/src/synthia/validation.py +526 -0
  56. cosmos_synthia-0.1.0/tests/conftest.py +60 -0
  57. cosmos_synthia-0.1.0/tests/test_grids.py +382 -0
  58. cosmos_synthia-0.1.0/tests/test_guidance.py +169 -0
  59. cosmos_synthia-0.1.0/tests/test_inspection.py +311 -0
  60. cosmos_synthia-0.1.0/tests/test_install.py +385 -0
  61. cosmos_synthia-0.1.0/tests/test_plots.py +173 -0
  62. cosmos_synthia-0.1.0/tests/test_safety.py +95 -0
  63. cosmos_synthia-0.1.0/tests/test_server.py +164 -0
  64. cosmos_synthia-0.1.0/tests/test_validation.py +231 -0
@@ -0,0 +1,63 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*" # Matches version tags like v1.0.0, v2.1.3, etc.
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ # Grant the job permission to request an OIDC token
12
+ permissions:
13
+ contents: read
14
+ id-token: write
15
+
16
+ steps:
17
+ - name: Check out the repository
18
+ uses: actions/checkout@v5
19
+ with:
20
+ persist-credentials: false
21
+ # hatch-vcs derives the version from the tag, so the full
22
+ # history must be present; a shallow clone yields a dev version.
23
+ fetch-depth: 0
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v6
27
+ with:
28
+ python-version: "3.10"
29
+
30
+ - name: Install build dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install build
34
+
35
+ - name: Build source distribution and wheel
36
+ run: python -m build
37
+
38
+ - name: Store the distribution packages
39
+ uses: actions/upload-artifact@v4
40
+ with:
41
+ name: python-package-distributions
42
+ path: dist/
43
+
44
+ publish-to-pypi:
45
+ name: >-
46
+ Publish Python 🐍 distribution 📦 to PyPI
47
+ needs:
48
+ - build
49
+ runs-on: ubuntu-latest
50
+ environment:
51
+ name: pypi-deployment
52
+ url: https://pypi.org/p/cosmos-synthia
53
+ permissions:
54
+ id-token: write
55
+
56
+ steps:
57
+ - name: Download all the dists
58
+ uses: actions/download-artifact@v4
59
+ with:
60
+ name: python-package-distributions
61
+ path: dist/
62
+ - name: Publish distribution 📦 to PyPI
63
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,35 @@
1
+ name: Synthia
2
+
3
+ on:
4
+ pull_request:
5
+ branches: ["main"]
6
+ push:
7
+ branches: ["main"]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ max-parallel: 2
17
+ matrix:
18
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v7
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@v7
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install '.[test]'
30
+ - name: Check Python formatting and linting
31
+ run: |
32
+ ruff format --check --diff .
33
+ ruff check .
34
+ - name: Test with pytest
35
+ run: pytest
@@ -0,0 +1,12 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ /benchmarks/results/
10
+
11
+ # Generated at build time from the git tag
12
+ src/synthia/_version.py
@@ -0,0 +1,20 @@
1
+ # Run repository checks before changes are committed.
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v5.0.0
5
+ hooks:
6
+ - id: check-merge-conflict
7
+ - id: check-case-conflict
8
+ - id: check-added-large-files
9
+ - id: check-toml
10
+ - id: check-yaml
11
+ - id: end-of-file-fixer
12
+ - id: trailing-whitespace
13
+
14
+ - repo: https://github.com/astral-sh/ruff-pre-commit
15
+ rev: v0.15.15
16
+ hooks:
17
+ - id: ruff-check
18
+ args:
19
+ - --fix
20
+ - id: ruff-format
@@ -0,0 +1,99 @@
1
+ # Contributing
2
+
3
+ Synthia follows Synthesizer's development and documentation standards.
4
+
5
+ ## Development Environment
6
+
7
+ ```bash
8
+ python -m venv .venv
9
+ source .venv/bin/activate
10
+ python -m pip install -e '.[dev,test]'
11
+ pre-commit install
12
+ ```
13
+
14
+ Install both extras, not just `dev`. They are deliberately separate: `dev`
15
+ carries the linters and `pre-commit`, `test` carries `pytest`. `pip install
16
+ -e '.[dev]'` alone leaves you without a test runner.
17
+
18
+ ## Required Checks
19
+
20
+ ```bash
21
+ ruff check .
22
+ ruff format --check .
23
+ pytest
24
+ ```
25
+
26
+ Most Synthesizer-specific tests skip when `cosmos-synthesizer` is not
27
+ importable. Run the suite a second time in an environment that has it, as CI
28
+ does, before claiming a change is covered:
29
+
30
+ ```bash
31
+ pytest -q # Synthesizer absent
32
+ /path/to/synth-env/bin/pytest -q # Synthesizer present
33
+ ```
34
+
35
+ `pre-commit run --all-files` runs repository hygiene, linting, and formatting
36
+ checks together. CI runs the same checks, plus a wheel build.
37
+
38
+ ## Python Style
39
+
40
+ - Follow PEP 8 and the repository Ruff configuration (79-character lines).
41
+ - Write Google-style docstrings for public modules, classes, methods, and
42
+ functions.
43
+ - Use `snake_case` for variables and functions and `PascalCase` for classes.
44
+ - Add focused tests for non-trivial behaviour and bug fixes.
45
+
46
+ ## Documentation
47
+
48
+ Synthia has no separate documentation site. `README.md` is the single source
49
+ of truth for installation, tool behaviour and usage — update it in the same
50
+ change that alters any of them. `PLAN.md` records design intent and open work
51
+ only; do not restate tool behaviour there.
52
+
53
+ Bundled skill references and examples are product behaviour. Keep them concise,
54
+ version-aware, and tested where executable.
55
+
56
+ Do not document a tool as available before it is implemented. Anything blocked
57
+ on the remote grid catalogue service must stay explicitly marked as planned.
58
+
59
+ ## Packaging: the skill must reach the wheel
60
+
61
+ Synthia's entire packaging story is that the bundled skill ships inside the
62
+ distribution. Everything under `src/synthia/skill/` — `SKILL.md`, every
63
+ reference, every example — must be present in the built wheel and resolvable
64
+ through `importlib.resources` after a clean install.
65
+
66
+ Hatchling ships every file under the selected package directory, so no
67
+ `package_data`, `MANIFEST.in`, or `force-include` is needed. There is one
68
+ sharp edge:
69
+
70
+ > **Hazard: `.gitignore` can silently eat the skill.** Hatchling's default
71
+ > file selection honours VCS ignore files. A broad pattern in `.gitignore` —
72
+ > `examples/`, `*.md`, `references/`, a bare `docs/` — will quietly drop
73
+ > matching skill files from the wheel. The package still imports, the tests
74
+ > still pass under an editable install, and users get a skill with holes in
75
+ > it. Before adding a `.gitignore` pattern, check it cannot match anything
76
+ > under `src/synthia/skill/`.
77
+
78
+ `tests/test_server.py` checks that `skill/SKILL.md` resolves, but under an
79
+ editable install that check passes trivially by reading the source tree; it
80
+ cannot catch a build-configuration regression. The wheel job in CI is the real
81
+ guard: it builds the distribution, installs it into a clean environment away
82
+ from the source tree, and asserts the packaged skill resources resolve. If you
83
+ change build configuration or `.gitignore`, verify locally too:
84
+
85
+ ```bash
86
+ python -m pip install build # not in any extra
87
+ python -m build
88
+ python -m venv /tmp/synthia-wheel-check
89
+ /tmp/synthia-wheel-check/bin/python -m pip install dist/*.whl
90
+ cd /tmp && /tmp/synthia-wheel-check/bin/python -c "
91
+ from importlib.resources import files
92
+ skill = files('synthia') / 'skill'
93
+ assert (skill / 'SKILL.md').is_file()
94
+ assert (skill / 'references' / 'concepts.md').is_file()
95
+ "
96
+ ```
97
+
98
+ Run that check from outside the repository. Inside it, `src/` on the path can
99
+ mask a missing file.
@@ -0,0 +1,38 @@
1
+ # Install Synthia
2
+
3
+ These instructions are for the coding agent reading this file. Install Synthia
4
+ for the user; do not merely describe the commands.
5
+
6
+ 1. Use the Python environment containing the user's `cosmos-synthesizer`
7
+ installation. Check with:
8
+
9
+ ```bash
10
+ python -c "import sys, synthesizer; print(sys.executable); print(synthesizer.__file__)"
11
+ ```
12
+
13
+ If this fails, ask which environment contains Synthesizer. Do not use
14
+ `pipx`, `uv tool install`, `sudo`, or a separate environment: Synthia must
15
+ import Synthesizer from the same environment.
16
+
17
+ 2. Install Synthia and run its idempotent setup command:
18
+
19
+ ```bash
20
+ python -m pip install cosmos-synthia
21
+ synthia-install
22
+ ```
23
+
24
+ The distribution is named `cosmos-synthia`; the import name is `synthia`.
25
+ Install from `git+https://github.com/synthesizer-project/synthia.git`
26
+ instead only if the user asks for an unreleased change.
27
+
28
+ 3. Report the environment and server paths printed by `synthia-install`, plus
29
+ any warnings or refusals. Do not use `--force` without asking the user: it
30
+ can replace an existing skill or MCP configuration owned by them.
31
+
32
+ 4. Tell the user to restart their agent client. After restart, verify the
33
+ installation by asking Synthia's `inspect_environment` tool for the
34
+ Synthesizer version and path.
35
+
36
+ `synthia-install --dry-run` previews changes. `synthia-install --uninstall`
37
+ removes the skill and MCP registrations; run it before uninstalling the Python
38
+ package.