spaceprime
- Free software: MIT License
- Documentation: https://connor-french.github.io/spaceprime
Overview
spaceprime is a Python package that facilitates the creation and analysis of spatially gridded coalescent models in the msprime library. The package is designed to make it easier for practitioners to convert spatial maps of habitat suitability into extensible two-dimensional stepping-stone models of gene flow, where each pixel of the map represents a deme and demes are able to migrate with their neighbors. Demes and migration rates are able to change over time according to habitat suitability model projections. These demographic parameters are then used to simulate genetic data under a coalescent model with msprime as the simulator, which can be used to infer the demographic history of the population. The package is designed to be user-friendly and intuitive, allowing users to easily simulate and analyze spatially explicit genetic data.
This page provides an overview of the package and its main features. For more detailed information, please refer to the documentation.
Note for R users: spaceprime is coded in Python, yet many interested users may come from an R background. I have a spaceprime for R users vignette that provides a brief introduction to the Python concepts necessary to use spaceprime in a practical walk-through of an example analysis. Additionally, it is possible to use Python code in R using the reticulate package. For more information on how to use Python code in R, see the reticulate documentation.
Main features
spaceprime includes a number of features:
- Convert habitat suitability values into demographic parameters, including deme sizes, migration rates, and their change through time using very little code. Code complexity does not increase with model complexity, allowing users to focus on the biological questions they are interested in.
- Simulate spatially explicit genetic data under a coalescent model with msprime. The modeling approach is fully coalescent with no forward-time component, allowing for computationally efficient simulations of large spatially explicit models.
- Visualize demographic models to facilitate model interpretation and model checking.
- Compute genetic summary statistics for simulated and empirical data to facilitate comparison with empirical data.
- Extensibility: spaceprime is designed to be interoperable with msprime, where users can setup a model with spaceprime, then customize it using the full range of msprime functionality.
Installation
Stable release
spaceprime can be installed using pip or conda. Due to the package's reliance on msprime, the pip installation is only available on unix-based systems (MacOS, Linux). Windows users should install spaceprime using conda.
To install spaceprime using pip, run the following command in your terminal:
pip install spaceprime
To install spaceprime using conda, run the following command in your terminal:
conda install -c conda-forge spaceprime
The mamba package manager can also be used to install spaceprime using conda. mamba tends to be much faster than conda. To install spaceprime using mamba, install mamba, then run the following command in your terminal:
mamba install -c conda-forge spaceprime
From source
To install spaceprime from source, run this command in your terminal:
pip install git+https://github.com/connor-french/spaceprime
Metadata
Release files for spaceprime 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spaceprime-0.0.6.tar.gz | 2.8 MB | With provenance | Details for spaceprime-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spaceprime-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for spaceprime-0.0.6-py3-none-any.whl |
Total release size: 3.0 MB
Release files / spaceprime-0.0.6.tar.gz
| Download URL | spaceprime-0.0.6.tar.gz |
|---|---|
| Size | 2.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
959c2385fa13fce8e24e712aab8d61db55beea1ee5cea2691b1a324be7935eeb
|
|
BLAKE2b-256 checksum How to use checksums |
20010c2be9d93f142ab11e21cb361802a70a13a4087d7fe23b5bec3b0ee31bbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logRelease files / spaceprime-0.0.6-py3-none-any.whl
| Download URL | spaceprime-0.0.6-py3-none-any.whl |
|---|---|
| Size | 222.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1701e8526ec8bf24bb312c22b1ea715f93430e96bb14ea177919550cd3b54b77
|
|
BLAKE2b-256 checksum How to use checksums |
279046d3fc2f4e8780972aaa15fc8b7a6f1c314018dfb95cbdca01ce6add303f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logSecurity for spaceprime 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for spaceprime-0.0.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.