Installation

CompactObject supports installation with either Python’s venv module or Conda. The package name on PyPI is CompactObject-TOV.

Python virtual environment

Create and activate an isolated environment:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip

On Windows, activate the environment with .venv\Scripts\activate instead.

Install the released package:

python -m pip install CompactObject-TOV

Release 2.1.1 includes the standard example-notebook dependencies, including pandas, sympy, ultranest, h5py, and numba. If CompactObject is already installed, upgrade it in the same Python environment before running the notebooks:

python -m pip install --upgrade CompactObject-TOV

In the source checkout, FastRMF uses the standard SciPy and Numba dependencies; see FastRMF solver. No separate solver installation is needed.

To run the example notebooks from a source checkout, install the package’s notebooks extra:

git clone https://github.com/ChunHuangPhy/CompactObject.git
cd CompactObject
python -m pip install -e ".[notebooks]"

The dependencies declared in pyproject.toml are installed automatically. There is no separate requirements.txt dependency list.

The optional Dynesty sampler is available through the sampling extra:

python -m pip install -e ".[notebooks,sampling]"

UltraNest is included in the standard installation. The test extra also installs Dynesty and pytest-cov so the complete sampler and coverage checks can run. The supplied Conda environment includes these test dependencies as well.

Conda environment

The repository includes an environment.yml file. It explicitly installs Python into the environment and installs the runtime and notebook dependencies from conda-forge:

git clone https://github.com/ChunHuangPhy/CompactObject.git
cd CompactObject
conda env create --file environment.yml
conda activate CompactObject
python -m pip install --no-deps --no-build-isolation -e .

The environment specifies python>=3.8, matching requires-python in pyproject.toml. Conda selects a Python version compatible with the other dependencies rather than requiring Python 3.11.

The final command installs only the CompactObject source package. The --no-deps and --no-build-isolation options are intentional because the runtime and build dependencies have already been installed by Conda. Using python -m pip also guarantees that pip belongs to the Python interpreter in the active environment.

Do not use conda create -n CompactObject without listing Python. An empty Conda environment has no local Python or pip executable, so a subsequent pip command can resolve to the system installation and fail with an externally-managed-environment error.

To update an existing environment after environment.yml changes, recreate it:

conda env remove --name CompactObject
conda env create --file environment.yml

Dependency policy

pyproject.toml is the canonical dependency declaration for pip builds and published package metadata. It lists direct, unpinned runtime dependencies so pip can select a mutually compatible set. environment.yml is the corresponding Conda-native environment and is tested separately in continuous integration. Exact package versions belong in a generated lock file for a specific reproducible analysis, not in the library’s installation instructions.

FastRMF solver

EOSgenerators.fastRMF_EoS uses SciPy’s Levenberg–Marquardt solver (scipy.optimize.root(method="lm")) with Numba-compiled residual and thermodynamic calculations. SciPy and Numba are already runtime dependencies, so the accelerated solver is available with the standard installation.

From a source checkout:

python -m pip install -e ".[notebooks]"
python -c "import EOSgenerators.fastRMF_EoS; print('FastRMF import OK')"

The former fast extra and separate NumbaMinpack installation are no longer required. The first FastRMF calculation includes Numba compilation time; subsequent calls reuse the compiled functions. The EOS example notebook measures first-call and repeated-call timings separately.