Development =========== Setting up ---------- .. code-block:: bash git clone https://github.com/jam-sadiq/celestial-rhapsody.git cd celestial-rhapsody python -m venv .venv && source .venv/bin/activate pip install -e ".[test,docs]" The ``-e`` (editable) flag means changes to the code in ``src/`` take effect immediately, without reinstalling. Project layout -------------- .. code-block:: text celestial-rhapsody/ ├── pyproject.toml # package metadata, dependencies, `nbody` command ├── README.md ├── LICENSE.txt ├── src/celestial_rhapsody/ │ ├── config.py # reading .json / .txt input files │ ├── solvers.py # gravity + Euler/RK2/RK4 integrators │ ├── animation.py # GIF / MP4 output │ └── cli.py # the `nbody` command ├── examples/ # ready-to-run input files ├── tests/ # pytest tests (+ tests/data/ config files) └── docs/ # this documentation (Sphinx) Running the tests ----------------- .. code-block:: bash pytest Building the documentation -------------------------- .. code-block:: bash cd docs make html # on Windows: make.bat html Then open ``docs/build/html/index.html`` in a browser. The included GitHub Actions workflow (``.github/workflows/ci.yml``) runs the tests and publishes the docs to GitHub Pages on every push to ``main``. To turn this on, open the repository settings, go to *Pages*, and set *Source* to *GitHub Actions*. Making a release ---------------- 1. Update ``version`` in ``pyproject.toml`` and ``__version__`` in ``src/celestial_rhapsody/__init__.py``, then commit and push. 2. On GitHub, open *Releases*, then *Draft a new release*. Create a tag such as ``v0.1.0`` and click *Publish release*. 3. The workflow ``.github/workflows/publish.yml`` builds the package and uploads it to PyPI. It uses PyPI "Trusted Publishing", so you need to register the repository on PyPI once (see the comments at the top of that file). After that, anyone can install it with ``pip install celestial-rhapsody``. Uploading by hand (alternative) ------------------------------- .. code-block:: bash pip install build twine python -m build # creates dist/*.whl and dist/*.tar.gz twine upload --repository testpypi dist/* # rehearsal on test.pypi.org twine upload dist/* # the real thing