PythTB is a Python library for constructing and analyzing tight-binding models, built for modern topological band theory applications. It provides a streamlined path from model specification to physical interpretation, making it useful for both learning electronic structure and conducting research-level studies. With only a few lines of code, you can define lattice models, build tight-binding Hamiltonians, and compute electronic properties.
PythTB provides tools for:
- Band structures and density of states
- Berry phases and Berry curvature
- Chern numbers, Wilson loops, and related invariants
- Quantum geometric tensors and local Chern markers
- Chern-Simons axion angle
- Maximally localized Wannier functions
- Wannier-based tight-binding models generated through Wannier90
Resources
- Documentation: https://pythtb.readthedocs.io/en/latest/
- Contributing: https://pythtb.readthedocs.io/en/latest/development.html
- Tutorials: https://pythtb.readthedocs.io/en/latest/tutorials.html
- Formalism: https://pythtb.readthedocs.io/en/latest/formalism.html
- Source: https://github.com/pythtb/pythtb
- Report Issues: https://github.com/pythtb/pythtb/issues
Installation
PythTB is available through conda-forge (recommended) and PyPI.
# Conda (pythtb >= 1.8.0)
conda install -c conda-forge pythtb
# pip
pip install pythtb
To install from source in editable mode:
git clone https://github.com/pythtb/pythtb.git
cd pythtb
pip install -e .
PythTB ≥ 2.0.0 requires Python ≥ 3.12 and the core dependencies:
- numpy ≥ 2.0
- matplotlib ≥ 3.9
Optional extras can be installed via pip install .[group]:
[plotting]: Plotly for interactive visualization[speedup]: TensorFlow for GPU-accelerated routines[notebooks]: Jupyter support (IPython ≥ 8.17, ipykernel, notebook, jupyter, jupyterlab)[docs]: Sphinx toolchain for documentation[tests]: pytest[dev]: developer tools (pytest, ruff, pre-commit)
For more detailed instructions, see:
Citation
If you use the code in your paper, please cite us
@software{Cole_Python_Tight_Binding_2025,
author = {Cole, Trey and Coh, Sinisa and Vanderbilt, David},
doi = {10.5281/zenodo.12721315},
license = {GPL-3.0-or-later},
month = nov,
title = {{Python Tight Binding (PythTB)}},
url = {https://zenodo.org/records/12721315},
version = {2.0.0},
year = {2025}
}
Metadata
Release files for pythtb 2.0.2
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 |
|---|---|---|---|---|
| pythtb-2.0.2.tar.gz | 36.4 MB | With provenance | Details for pythtb-2.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pythtb-2.0.2-py3-none-any.whl | Python 3 | none | any | Details for pythtb-2.0.2-py3-none-any.whl |
Total release size: 36.6 MB
Release files / pythtb-2.0.2.tar.gz
| Download URL | pythtb-2.0.2.tar.gz |
|---|---|
| Size | 36.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4577a54fa81cf308550dd3df211643ddb64f1c4b1f622ed8fc5cc70ebdae1c6
|
|
BLAKE2b-256 checksum How to use checksums |
b175396e241d8714de9a7643199528c0f4a1f8c1cc1152d22b51a16fef30031e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 26, 2026.
Transparency logRelease files / pythtb-2.0.2-py3-none-any.whl
| Download URL | pythtb-2.0.2-py3-none-any.whl |
|---|---|
| Size | 196.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfa169c0bbb949788044fccb1ede3f3cbe058e9a3f5cc6cdff862fc730b19d26
|
|
BLAKE2b-256 checksum How to use checksums |
d4abbd69c37a93fc804da448ec0363f4303bcca3774191c070f0f879d2e0f009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 26, 2026.
Transparency logSecurity for pythtb 2.0.2
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 pythtb-2.0.2.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 26, 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.