Skip to main content

Human papillomavirus simulator (HPVsim)

PyPI version Tests

About HPVsim

HPVsim is a flexible agent-based model for simulation HPV transmission and progression through cervical disease to cancer. The model can be parameterized with country-specific vital dynamics, structured sexual networks, co-transmitting HPV genotypes, B- and T-cell mediated immunity, and high-resolution disease natural history. HPVsim is designed with a user-first lens: it is implemented in pure Python, has built-in tools for simulating commonly-used interventions, has been extensively tested and documented, and runs in a matter of seconds to minutes on a laptop.

Version 3.0 of HPVsim is built on the Starsim modeling architecture. This is a significant shift from the v2 series: the disease model, sexual network, demographics, interventions, and analyzers are now Starsim modules, and the API changed accordingly. The science is preserved — see the migration guide for a full v2→v3 walkthrough. The v2 series is frozen aside from critical bugfixes.

The scientific paper describing HPVsim is available at https://doi.org/10.1371/journal.pcbi.1012181. The recommended citation is:

HPVsim: An agent-based model of HPV transmission and cervical disease (2024). Stuart RM, Cohen JA, Kerr CC, Mathur P , NDMC India, Zimmermann M, Rao DW, Boudreau MC, Lee S, Yang L, Klein DJ. PLOS Computational Biology 20(7): e1012181. https://doi.org/10.1371/journal.pcbi.1012181

Background

HPVsim has been used for analyses in several countries. Academic papers that have been written using HPVsim include:

  1. Inferring the natural history of HPV from global cancer registries: insights from a multi-country calibration (2024). Stuart RM, Cohen JA, Abeysuriya RG, Sanz-Leon P, Kerr CC, Rao DW, Klein DJ. Sci Rep 14, 15875. https://doi.org/10.1038/s41598-024-65842-3
  2. HPV DNA Screening and Vaccination Strategies in Tunisia (2025). Lahdhiri A, Benzina B, Ennaifer E, Tounsi H, Gzara A, Rammeh-Rommani S, Laraj O, Arfaoui H, Stuart RM Kebir, A, BenMiled S (2025). Sci Rep, forthcoming.
  3. Can pruning improve agent-based models’ calibration? An application to HPVsim (2025). Sturman F, Swallow B, Kerr CC, Stuart RM, Panovska-Griffiths J. Journal of Theoretical Biology, forthcoming.

Installation

The easiest way to install is simply via pip: pip install hpvsim. Alternatively, you can clone this repository, then run pip install -e . (don't forget the dot!) in this folder to install hpvsim and its dependencies. This will make hpvsim available on the Python path. The first time HPVsim is imported, it will automatically download the required data files (~30 MB). You can also download the data manually by running hpvsim-download-data from the terminal.

For users without Python

If you don't already have Python set up, the install/ folder contains standalone installers that handle Miniforge (conda-forge) and HPVsim in one step:

  • Linux / macOS: curl -LsSf https://hpvsim.org/install.sh | sh
  • Windows: download install/install.bat and double-click it.

See install/README.md for details.

Usage and documentation

Documentation is available at https://docs.hpvsim.org, including tutorials. Additional usage examples are available in the examples folder.

Contributing

If you wish to contribute, please follow the Starsim style guide at: https://github.com/starsimhub/styleguide. See the code of conduct readme for more information.

Disclaimer

The code in this repository was developed by IDM, the Burnet Institute, and other collaborators to support our joint research on HPV. We've made it publicly available under the MIT License to provide others with a better understanding of our research and an opportunity to build upon it for their own work. Note that HPVsim depends on a number of user-installed Python packages that can be installed automatically via pip install. We make no representations that the code works as intended or that we will provide support, address issues that are found, or accept pull requests. You are welcome to create your own fork and modify the code to suit your own modeling needs as contemplated under the MIT License.

Metadata

Release files for hpvsim 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hpvsim 3.3.0
File Size Uploaded Provenance Actions
hpvsim-3.3.0.tar.gz 586.2 kB With provenance Details for hpvsim-3.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hpvsim 3.3.0
File Interpreter ABI Platform Actions
hpvsim-3.3.0-py3-none-any.whl Python 3 none any Details for hpvsim-3.3.0-py3-none-any.whl

Total release size: 738.5 kB

Release files / hpvsim-3.3.0.tar.gz

Download URL hpvsim-3.3.0.tar.gz
Size 586.2 kB
Tags Source
SHA-256 checksum
How to use checksums
307912d87e87e3ceb42b1e121a0f1c3e194d8834d34a199e976a64723e2de8eb
BLAKE2b-256 checksum
How to use checksums
ae22af05250782a7c43a4853365875a15423938c9eff518985b189b302f19ad8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 2, 2026.

Transparency log

Release files / hpvsim-3.3.0-py3-none-any.whl

Download URL hpvsim-3.3.0-py3-none-any.whl
Size 152.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97e204f6a526b687034750bae8255932017900d7587505ff0f7dc38d6052ccd1
BLAKE2b-256 checksum
How to use checksums
b3afae9d516b65f512ae74bb4088ab9a6bcb3eb1de9932b8e38a818190de1ad0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 2, 2026.

Transparency log

Security for hpvsim 3.3.0

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.

Select from 2 files

Attestation for hpvsim-3.3.0.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 Nov 2, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page