| scripts | ||
| src/shamash | ||
| tests | ||
| .gitignore | ||
| CLAUDE.md | ||
| LICENSE | ||
| Makefile | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| README.md | ||
| requirements.txt | ||
| TUTORIAL.md | ||
Shamash
This aims to be a physically accurate worldbuilder. A lot of these calculations are rather educated guesses than well-founded scientific principals, but they all have their foundation in recent scientific discoveries and laws of nature.
Based on the great Artifexian's Work "The Worldsmith" I wanted to continue his journey. Intruiged by building on the very idea of quantifying reality - but at the same time horrified by looking at a spreadsheet - the only logical next step was to build a python application. :)
[!important] AI Disclaimer Yeah, I know, this sucks. Until version 2026.0.3 I wrote everything myself, except some exporting functionality. The architecture, the Design Patterns, I came up with that myself. But with time being the only thing that does not accumulate over time (weird, right?) I simply couldn't stand another project wasting away over the years, and me not having the energy to finish it. Claude assists me heavily in writing the API and UI.
So, before the whole thing became a webfrontend with an API I designed it to be a CLI-Application. I like to work from the terminal, but after having hundreds of parameters scrolling past your tired eyes this was just not feasable any more. So I turned the CLI into an API (which still can be used as CLI as well) and created a React-Frontend.
Worldbuilding is an incredibly complex process. This application will never aim at calculating EVERYTHING, you know. I know some of you (including me) have those thoughts and it is only natural to desire a feeling of absolute control over reality. Understanding, caluclating, quantifiying everything until its smallest detail. But look into yourself. The motivation will most likely be fear, or some derivation of it. You are afraid to not be able to hold the world you are building in the palm of your hand.
But the very thing you are seeking to do - describing a reality by natural laws - is something we humans perfected since 300.000 years by immitating our natural surroundings (impressions), using them to express our feelings, pain and pleasure (expressions). This enables you to describe your newly formed reality in a way far more compley than any table of figures can. Put your world into writing, not into a table, so other humans can comprehend what you are creating.
The shamash repositories
shamash is split by audience:
- shamash-core (this repo) — the physics engine and the
shamashCLI. Published on PyPI. - shamash-server — the HTTP API around the engine and the React frontend for it, in one image.
Getting started
pip install shamash-core
shamash -p
The distribution is shamash-core; the command and the import name are both shamash.
For development, a Makefile is provided:
make venv
uv pip install --python venv/bin/python -e ../naturedynamics # the physics backend, as a sibling checkout
make install
make run
make test
Without -w, shamash reads the seed world packaged at src/shamash/data/default.yml, our own solar system. make run runs shamash -p, which prints it with everything computed.
The shamash command
shamash [-w WORLD] [-p | -e PATH] [-f yaml|json|csv] [-l]
shamash new PATH [-y]
shamash create TYPE [PARENT] [--set KEY=VALUE]... [--answer NAME=VALUE]... [--id ID] [-y] -w WORLD
shamash crs BODY [--projection NAME] [--central-meridian DEG] [-w WORLD]
shamash map init BODY DIR [-w WORLD] [--width PX] [--moon-width PX] [--major DEG] [--minor DEG]
shamash map ACTION [DIR]
shamash computes a world from a world file (stars, planets, moons, orbits, atmospheres) and builds things from it: a map project per planet, with Inkscape templates to paint, a QGIS project, a Blender scene, and from drawn plate tectonics a terrain and a climate. Without -w it uses the seed world: Sol, Earth and the Moon. A bare shamash prints this usage.
Options (work before or after a command)
-w, --worldfile PATH |
the world file to read; with create, also the one it changes. Alone, it just loads and checks the world |
-p, --print |
print the computed world to stdout |
-e, --export PATH |
write it to PATH instead. -p and -e write the same text, which loads back with -w |
-f, --format yaml|json|csv |
notation for -p/-e. csv is one row per value, for spreadsheets, and does not load back |
-l, --log |
also write the log (always on stderr) to settings.log_file |
Commands
new PATH |
copy the seed world to PATH, to edit into your own. Asks before overwriting unless -y |
create TYPE [PARENT] |
add a Star, Planet, Moon, Orbit, Atmosphere, Biosphere or Magnetosphere to the world in -w (or write the result to -e). Asks for required fields; --set mass=1.0:MSol gives one (values are SI unless a unit follows the colon), --answer strategy=add settles a choice. With no terminal and something left to ask, it fails and names what is missing |
crs BODY |
print the body's coordinate reference system (WKT2, a sphere of its radius) for QGIS, GDAL or PROJ. Projections: geographic, equirectangular, north-polar, south-polar, sinusoidal, mollweide, transverse-mercator. PROJ takes any sphere of 6,330–6,423 km for Earth |
map init BODY DIR |
start a map project in DIR for BODY and its moons: one equirectangular Inkscape template per body (a sample Earth and Moon from public data with the seed world), map.yml, export.sh and build.sh |
map ACTION [DIR] |
one step on an existing map project, DIR or the current directory; see below. The project's map.yml names its world, so -w is refused |
Map actions, in the order a project uses them:
| Action | Reads | Writes |
|---|---|---|
refresh |
the world, map.yml | shamash's locked layers in every map.svg (grid, tropics, moon tracks, tectonics guide), missing channel layers, export.sh, build.sh; map.svg.bak first. Run after changing the world or updating shamash |
georeference |
the PNGs export.sh wrote |
.pgw + .aux.xml beside each, so GDAL and QGIS place them on the body's sphere; the height map in metres |
qgis |
qgis/project.json + build_project.py; run that with QGIS's Python for one .qgz per body |
|
blender |
blender/scene.json + build_scene.py; run that with blender -b --python-exit-code 1 -P for scene.blend |
|
plates |
each body's Tectonics |
phase-1/seed/: plates, arrows and continents generated from mantle convection, which QGIS turns into the drawing; --overwrite replaces one |
tectonics |
<body>/tectonics/phase-N/plates.gpkg, drawn in QGIS |
the latest phase reconstructed every tectonics.step Myr |
next-phase |
the latest phase's end | phase-N+1/seed/, which QGIS turns into the next drawing |
terrain |
the latest reconstructed phase | <body>/terrain/dem.png, linked under the height channel |
climate |
dem.png, the world |
<body>/climate/: temperatures, precipitation, Köppen-Geiger classes, winds, ocean currents |
build.sh runs them all, plus export.sh and the QGIS and Blender scripts. TUTORIAL.md builds a planet step by step.
Files in a map project
map.yml the world, the bodies, their template sizes, elevation ranges and settings
export.sh, build.sh written by shamash; export.sh needs Inkscape
<body>/map.svg the template you paint; map.png and one PNG per channel beside it after export
<body>/tectonics/ phase-1, phase-2, ...: plates.gpkg, reconstructed/, next/
<body>/terrain/ dem.png
<body>/climate/ *.asc grids, koppen.json, winds_*.geojson, currents.geojson, planet.json
qgis/, blender/ the data and scripts for QGIS and Blender
Environment: QGIS_PYTHON and BLENDER tell build.sh where QGIS's Python and Blender are (default python3, blender).
Exit status: 0 on success, 1 on any error, with the reason on stderr.
Examples
shamash -p # the seed world, computed
shamash -f csv -p | awk -F, '$3 == "habitability"'
shamash new my-world.yml
shamash create Planet sol -w my-world.yml --answer strategy=add
shamash crs earth --projection north-polar > earth-north.wkt
shamash map init earth earth-map -w my-world.yml
cd earth-map && ./build.sh
As a library
Everything the CLI does is reachable from Python. A world loads into a registry, every value on it is computed on access, and Worldloader turns it back into text:
import shamash as sh
with sh.god.scope():
loader = sh.services.Worldloader()
loader.load(sh.services.BaseService.default_world_path())
print(sh.god.summons("earth").habitability)
print(loader.dumps(fmt="json"))
god.scope() gives the world a registry of its own, so two worlds can be computed at once without seeing each other — that is what shamash-server does per request.
sh.utils.describe_entities() is the per-type schema — every field and computed property with its unit, whether it is required, and its description — derived from the models rather than written down anywhere.
Property documentation
Every field and computed property carries a description, and each has a long-form page with formulas and sources under src/shamash/docs/properties/<Type>/<name>.md. The pages ship inside the package, so a server always hands out the pages for exactly the engine version it runs; shamash-server's web UI renders them. make test fails if a description has no page or a page documents nothing.
Releases
Development happens on origin (dev.fs.or.at). A release is an annotated
tag on main, and codeberg only ever sees tagged states:
git push origin main # every day
git tag -a v2026.1.1 -m "CLI verbs and output formats"
git push origin --tags # keep the markers on dev too
git push codeberg main v2026.1.1 # publish
Tags go to both remotes; commits go to origin until they are released.
Then the same commit goes to PyPI:
make publish-test # TestPyPI, with $PYPI_TEST_TOKEN; check it installs
make publish # PyPI, with $PYPI_TOKEN
That way the release history survives on the remote that has everything, rather than only on the one it is published to.
So git tag is the list of releases, each heading below names one, and the
version in pyproject.toml is bumped in the commit the tag points at.
__version__.py reads it from there — see the note in CLAUDE.md about why
the checkout's pyproject.toml wins over importlib.metadata.
2026.6.0
Generated plates, world editing, hydrology, erosion, deserts and networks: everything shamash-gui drives.
- A
Tectonicsmodel: a body's mantle convection from its size, core, age and radiogenic heat, by boundary-layer scaling anchored on Earth (Rayleigh number, heat flux, plate speed, convection degree), and whether its lithosphere breaks into plates (mobile lid) or holds (stagnant lid) shamash map plates: phase 1's plates and continents generated from it through shamash-orogen, editable in QGIS like a drawing- Plate motion as
direction,speedandspinon each plate instead of arrows; old drawings with arrows migrate once - World files edited in place:
set,delete(with--cascade),solve(one input moved until a planet's mean temperature is a target) andnew --empty, text-patched so hand-written files keep their layout - Fields may declare a range:
albedo_bondis 0 to 1,greenhouse_effectabove 0 and at most 1 shamash map set: a body's settings in map.yml, comments keptshamash map hydrology: lakes, salt flats and Strahler-ordered rivers from the DEM and the climate, linked into the water channelshamash map erosion(opt-in): rivers and glaciers carving the terrain, the climate rebuilt on the resultshamash map deserts: sand seas and dune crests in arid climatesshamash map networks: cities by suitability and Zipf sizes, fixed cities drawn in QGIS, roads and sea lanes, objects by recipe, night lights- Terrain, erosion, hydrology, deserts and networks can run inside one
feature of
<id>/areas.gpkg(areain map.yml,--areafor one run) setup.shbecomesbuild.sh, every step announcing itself as[i/n]- Windows: an unchanged
build.shis not rewritten under the running bash, a world file held open is retried, stdin from NUL is no terminal - Requires naturedynamics 1.4 (
geophysics/convection.py) and shamash-orogen 0.3
2026.5.1
- The tectonics, terrain and climate code carries no comments and no
docstrings, like the rest of shamash-core since 2026-10-09; behaviour is
that of 2026.5.0 (
shamash -pbyte-identical in every format)
2026.5.0
Tectonics, terrain and climate, and the 2026.4.1 work that was never tagged on its own.
-
shamash map tectonics: plates, motion arrows and continents drawn in QGIS (<id>/tectonics/plates.gpkg, created bybuild_project.py) become Euler rotations (and a GPlates rotation file); shamash-orogen reconstructs them everystepMyr -
The reconstruction comes back as a QGIS layer group and a locked
shamash: tectonicsguide layer in each Inkscape template -
One command:
map tectonicsruns the reconstruction in-process; neither GPlates, pygplates nor a second Python is needed (pygplates did the reconstruction until 2026-10-16) -
Chainable phases:
map next-phasestartsphase-N+1from the latest phase's present (overlaps resolved, continents merged) -
Valid lon/lat output for plates crossing the antimeridian or covering a pole; plate areas are conserved to 0.002% over ea's 200 Myr, where pygplates lost up to 0.1% at the antimeridian
-
Requires naturedynamics 1.3 (
geophysics/plate_kinematics.py,astrophysics/insolation.py) and shamash-orogen 0.2.0, both on PyPI -
Heuristic DEM from plate interactions (convergent/divergent/transform boundaries, age-depth seafloor):
shamash map terrain, through shamash-orogen, 0.1 deg by default, into QGIS and the height channel -
Commands renamed to say what they do:
shamash new PATHreplaces-i,map refreshreplacesmap gridandmap layers,map georefismap georeference; map actions default to the current directory, and a bareshamashprints its usage -
Climate from that DEM:
shamash map climate, shamash-orogen's seasonal energy balance model with Hadley cells scaled by rotation and heuristic rain, Köppen-Geiger classes into QGIS; seconds per body, any OS. On Earth it gets 65% of land cells' main class right against Beck et al. 2018 (ExoPlaSim was tried first and needs gfortran, Linux, and models no CH4) -
Climate: wind-driven ocean currents (Stommel gyres, western boundary currents, coastal upwelling) carry the sea's heat; London's class is right now
-
The seed world's map project starts from a sample Earth and Moon (NASA, NOAA, Natural Earth), linked into the templates and credited in
ATTRIBUTION.md;scripts/build_sample_data.shrebuilds it -
build.shbesidemap.ymlregenerates every derived file in one go, through the same shamash that wrote it -
A planet's template shows each moon's ground track, the path of the point directly beneath it over the Blender loop, on a locked layer
-
Every body gets a Blender camera that turns with it, placed per body in
map.yml(camera: {lat, lon, distance}) -
An observer scene per body: someone standing on it (
map.ymlobserver: {lat, lon, azimuth}, eye height fromheight_observer, new and optional onMoon) watching one of its days, under a physical sky, sunlight reddened through the air and a pale daytime moon -
Also from naturedynamics 1.3:
air_mass,DRY_AIR_COMPOSITION, andbeer_lambert_transmissionfixed for air masses other than 1 -
shamash map georefwarns about amap.pngwith nothing on it: an unpainted template, or a different copy ofmap.svgpainted than the oneexport.shreads -
Oceans come from height: a body with
ocean: trueinmap.yml(by default, one with an atmosphere) is sea in Blender wherever its height is at or below sea level, so unpainted ground is ocean and land is what you raise. The water channel now only adds lakes above sea level.
2026.4.0
Maps: everything from a paintable template to an animated Blender scene.
services/terrestrial/is nowservices/cartography/:TerrestrialServicebecameCartographyService,sh.services.terrestrialbecamesh.services.cartography. No alias is kept;crsoutput is byte-identical. shamash-server needs the same rename when it moves its pin.sh.services.cartographyalways names the module's exports. It used to come back as the bare subpackage once anything had touchedCartographyServicefirst (a latent bug since 2026.3.0, when it wasterrestrial).Planet.axial_tilt(optional), and thetropic_latitudeandpolar_circle_latitudeit gives;Orbit.raanis an optional field (it was aNotImplementedErrorstub);Atmosphere.scale_heightis computedshamash map init|grid: a map project directory with an equirectangular Inkscape template per body, whose locked grid layer shamash owns and redraws while leaving every other layer alone- Channel layers (height, water, night, clouds),
shamash map layers, and an emittedexport.shthat exports the colour map without the grid and one PNG per channel through Inkscape; height in metres, 16-bit, sea level snapped to a grey step shamash map georef: world file +.aux.xmlfor every exported PNG, sized from the PNG itself, height with Scale/Offset for GDAL/QGISshamash map qgis: the data and a PyQGIS script that build one QGIS project per body on its own CRS, registering every projection as a user CRSshamash map blender: the planet system at its vernal equinox, true scale, physically lit and eye-adapted, with atmosphere, bump, ocean glint, night lights and clouds, animated over one orbit of the outermost moon in 240 frames keyed from Kepler's equation- Requires naturedynamics 1.2 (
astrophysics/orbital.py,scale_height,srgb_to_linear)
2026.3.1
crsargument mistakes are typed: an unknown projection, or a polar projection given a central meridian, raisesInvalidProjectionErrorinstead of a bareValueError, so shamash-server can answer them with a 422 rather than a 500. The CLI behaves as before.
2026.3.0
- A terrestrial service and the
crsverbservices/terrestrial/is the home for anything on a body's surface. First in: WKT2 coordinate reference systems for any entity with a radius — geographic, equirectangular, polar stereographic, sinusoidal, Mollweide and transverse Mercator — mirroring the IAU 2015 definitions PROJ ships.- A sphere for now: a rotational ellipsoid needs a flattening model, and the simple homogeneous one gets Earth wrong (1/232 against 1/298).
- Tested against PROJ itself through pyproj (a dev-only dependency): every CRS parses, and known points land where the closed-form projection says they must.
2026.2.0
- Split the project into repositories
- This repo becomes shamash-core: the engine and the CLI, published
on PyPI as
shamash-core. The import name and the command stayshamash. - The HTTP layer moved to shamash-server and the frontend to
shamash-web, both dockerized; the marimo notebooks to a private
experiments repo.
shamash-apiis gone from this package. - The property docs moved into the package
(
src/shamash/docs/properties/), next to the descriptions they expand on, so a page and its description change in one commit. The coverage test moved with them and now checks both directions, the Settings pages and the sidebar — it used to check only that entity descriptions had a page, and skipped itself in any install without the frontend. describe_entities/describe_configmoved fromapi/schemas.pytosh.utils: they read only the models.- MIT licensed, in all three public repos.
- Dependencies cut to what the engine imports:
pyyaml,rich,naturedynamics.numpy/scipy/matplotlibarrive throughnaturedynamics, which declares them itself.
- This repo becomes shamash-core: the engine and the CLI, published
on PyPI as
2026.1.2
- Bring back a test suite —
make test, stdlibunittest, ~1 s- It loads the real seed world and asserts what comes out, rather than
mocking collaborators: the physics is a pure function of
default.yml, so running it is the test. Most of it is a transcription of numbersCLAUDE.mdalready presented as regression baselines — Sol at 1.000 RSol / 5770.8 K / G2.9, Earth habitability 1.000,#B3F49A, magnetopause 9.52 R⊕ — which described a suite nobody had written down. - 70 tests over the physics anchors, the loader's round-trips and error
taxonomy,
god.scope()isolation under 8 threads, the HTTP contracts (since moved to shamash-server's suite), the CLI, and thecreateverb's parent rules. - Mutation-probed while being written, which is the only reason to trust
it: feeding
Star.radiuskilograms fails 6 tests, droppingFACTOR_FLOORfails the hostile-world test, removing thePlanet.moonsbackref fails the tidal one. make test-packagingis separate (~15 s): it builds a wheel and runs the CLI and the API from it with no source tree in sight.
- It loads the real seed world and asserts what comes out, rather than
mocking collaborators: the physics is a pure function of
- Two bugs the suite found before it was finished
create Moon solran the orbit cascade before discovering a Star cannot host a moon, so it created an orbit and then refused — leaving it behind in a world the caller was told nothing had been added to. Legality is now decided first, so a refusal costs nothing.createasked its questions before validating--setnames and the--id, so a typo was reported only after you had answered three prompts. Both are checked up front now.
- Corrected numbers the docs stated but the code did not produce
magnetosphere.pydocumented Earth's magnetopause at 9.6 planetary radii and the bow shock at 12.5, in five places including user-facing text mirrored into the docs site. The code computes 9.52 and 12.37.
2026.1.1
- Output formats for the CLI —
-f yaml|json|csv- Notation moved out of both the codec and the HTTP layer into
services/world/formats.py, so there is one YAML dumper call and one JSON dumper call in the codebase and the CLI and API cannot drift.-pand-eare byte-identical per format;shamash -f json -pis byte-identical toGET /v1/world/default. - csv is the flat view — one row per scalar, the same shape shamash-web's matrix tab shows — and is one-way.
Worldloader.loadsnow parses a root-level{as JSON. PyYAML follows YAML 1.1, where5e-05without a dot is a string, so the app could not read back a file it had just written with-f json -e.
- Notation moved out of both the codec and the HTTP layer into
- CLI verbs —
shamash create <Type> <parent_id>cli.pygrows subparsers and aVERBSmap; flags work on either side of the verb.-wnames the file the verb modifies.- What can host what is declared per relationship as
parent_needs— what the child reads off its parent — never as a table of types. The refusal message is assembled from the models, so it follows them: the day a Moon can compute asurface_temperature, moon atmospheres start working with nothing to update. - Services never prompt. They call
self.ask(questions); the CLI injectsInteractionService.askand everything else getsrefuse_to_ask, which raises a 422 carrying the questions — a service reading stdin would block a uvicorn worker forever, andworld:create-orbitruns the same code. --setand--answermake a create fully scriptable; with nothing left to ask it needs no terminal at all.
2026.1.0
- Docker, and a React web frontend — both now live in their own repos, shamash-server and shamash-web, together with their design notes.
- Atmospheric
sky_color— the colour of the sky from the ground- Single-scattered starlight through the Rayleigh column, von Kries adapted
to the local star. Earth reads
#788CC4; a 90 atm column washes out to near-white, which is what a saturated column should do.
- Single-scattered starlight through the Rayleigh column, von Kries adapted
to the local star. Earth reads
2026.0.4
- Stateless HTTP API (FastAPI), so a web frontend can do what
-wdoes — now shamash-server. What it needed from the engine stayed here:- Phase 0: make the package survive outside its source checkout
- Resolve version/name/description without reading
pyproject.tomlat import - Ship
data/default.ymlas declared package data - Stop the exporter crashing on optional fields a world leaves out
- Validate a world file's units against the dimension the field declares
- Log normal conditions at DEBUG instead of ERROR
- Resolve version/name/description without reading
- Request-scoped
godregistry (contextvars) Worldloader.loads/load_data/to_dictseams, JSON and YAML in/out- Console entry point
shamash
- Phase 0: make the package survive outside its source checkout
v2026.0.3
- Refactor and Introduce Atmospheric model
- Maybe even in naturedynamics, taking atmospheric models from omniastro
- Introduce Plant Color and Biosphere Module
- Based on Star and Atmosphere
- Geomagnetic Dynamics/ Solarmagnetic Dynamics
- Make Habitability not true or false but a probability scale, taking into account:
- Class of the Star and Brightness
- Calculation Method relative habitability to how far the planet is away
v2026.0.2
Settled on name for project: shamash.
- Rename Project
- Refactor export/import handling
- do not use pprint, but format in cli as well
- use flag for cli dump
- Unify Units handling, refactor bad claude code
- Every function should have their units as metadata with them - decorators?
- Distances in space are AU/Parsecs/Lightyears
- Fix main_star_apparent_size=<error: division by zero>
- Improve logging
- Add a flag to write to a log file
- Star Class Calculation
- Add Star Classes as Enums, maybe directly into naturedynamics
- Fix Hillsphere Calculation and Inner/Outer Moon Zone Error
- Also push naturedynamics when pushing worldcreator
- As of 2026-09-01 naturedynamics is no longer a submodule; it lives at
~/Dev/projects/naturedynamicsand is installed into the venv. - Release Versioning and Cycle ?
- As of 2026-09-01 naturedynamics is no longer a submodule; it lives at
- Add Horizon Distance
- Add proper error handling
- Add a flag to init a new world yaml file
shamash init new_world
- Add Flag to point to yaml world file
- Make color calculation refined and add Hexcolor support
v2026.0.1
Finally, first working version finished, shamash.
Backlog
- Relief and ocean floor carried from one tectonics phase to the next
- Climate: monsoons
- A Windows-native counterpart to
build.sh/export.sh - Add Habitable Zone Shift Factor for planets, to shift habitable zone bonds,
- regarding how many greenhouse gases exist
- Axial Tilt
- Orbital Period
- Make Apparent Brightness, etc a function that can be calculated at any given point of the orbit.
- Add LSol as Unit for Luminosity
- Change ASol to AU
- Decide what log level a caller's mistake deserves
AppErrorlogs at ERROR on construction. Over HTTP every 422 is the client's bad world, not a server incident, so a busy API fills the error log with things no operator can act on — but the same exception from the CLI, against a world file you just edited, is worth an ERROR. One class, two contexts; Phase 0 already establishedlog_level=as the mechanism.
- Containerise — done under 2026.1.0 above, once unblocked on
2026-09-01 by the package no longer reading
pyproject.tomlat import, shipping its seed world as package data, and running (CLI and API both) from a wheel with no source tree. make venvpins--python 3.13while the venv in use is 3.14.6- Pinned to 3.14, what everything is verified on. It also gained
--seed: without pip in the venv,make installcould not run on a fresh one. And itsuv pip install -r requirements.txtnow namesvenv/bin/python: uv looks for.venvor an activated env, so it failed unlessvenvwas activated.
- Pinned to 3.14, what everything is verified on. It also gained