kivy-history
kivy-history is a Kivy helper inspired by the
JavaScript History API.
It lets you navigate back and forth through a ScreenManager and manipulate the
contents of its history stack.
Features
- Navigate with
back(),forward()andgo(delta). - Push and replace states with
push_state()andreplace_state(). - Inspect the current
state, thestack, theindexand the number of entries (lenght). - Optional logging of the stack (
HISTORY_LOG=1). - No visual dependency beyond a Kivy
ScreenManager(works with any transition).
Installation
With uv (recommended)
uv add kivy-history
With pip
pip install kivy-history
Quick start
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy_history import History
class MyApp(App):
def build(self):
manager = ScreenManager()
manager.add_widget(Screen(name="home"))
manager.add_widget(Screen(name="settings"))
manager.current = "home"
manager.history = History(manager)
return manager
MyApp().run()
Then use manager.history.back(), manager.history.forward(),
manager.history.go(-1), manager.history.push_state("screen_name") or
manager.history.replace_state(name="screen_name").
See src/kivy_history/sample.py for a complete
demo. You can also run it after installing the package:
kivy-history
Migration from the previous History() API
History now requires the ScreenManager it tracks (a breaking change from
the previous no-argument constructor):
# Before
history = History()
manager.bind(current=history.on_state)
# Now
history = History(manager)
What changed:
- The current screen is recorded synchronously when
History(manager)is created, so the history stack is never empty. - The manager's
currentproperty is bound automatically; the manualmanager.bind(current=history.on_state)is no longer needed (and would register each change twice). Historyno longer depends onApp.get_running_app(); it only needs theScreenManager.
Development
This project uses uv as the package manager while
remaining fully compatible with pip (standard PEP 517/621 pyproject.toml).
# Create the environment and install the project in editable mode + dev tools
uv sync --extra dev
# Run the test suite (headless)
uv run pytest
# In a headless environment such as CI, run under a virtual framebuffer:
xvfb-run -a uv run pytest
# Lint and format checks
uv run ruff check .
uv run ruff format --check .
# Build sdist + wheel
uv build
Nota sobre tests headless: Kivy necesita una ventana con contexto OpenGL, por lo que
SDL_VIDEODRIVER=dummy(el driver dummy de SDL2) no sirve para ejecutar la suite en GitHub Actions: no expone OpenGL y el proceso termina conexit code 102. Por eso el CI ejecuta los tests bajo Xvfb con renderizado por software de Mesa (libgl1-mesa-dri, llvmpipe).
With pip, install in editable mode with the dev extras:
pip install -e ".[dev]"
Continuous integration
GitHub Actions runs the lint, test and build steps on every push and pull
request (Python 3.9–3.12) on ubuntu-24.04 (pinned because newer runner images
no longer ship the prebuilt Python 3.9 toolchain). See
.github/workflows/ci.yml.
Releasing / deploying to PyPI
Publishing to PyPI is automated with GitHub Actions using PyPI trusted publishing (OpenID Connect) — no tokens are stored in the repository.
-
Bump the version in
src/kivy_history/version.py. -
Commit and push.
-
Create and push an annotated tag:
git tag -a v2.0.0 -m "Release v2.0.0" git push origin v2.0.0
Pushing a v* tag triggers
.github/workflows/publish.yml, which builds
the package and publishes it to PyPI.
One-time setup: in PyPI, configure the repository
gmork2/kivy-historyas a trusted publisher (Project → Publishing → Add a new trusted publisher) with the workflow namepublish.yml.
License
Metadata
Release files for kivy-history 2.0.0
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 |
|---|---|---|---|---|
| kivy_history-2.0.0.tar.gz | 31.0 kB | With provenance | Details for kivy_history-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kivy_history-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for kivy_history-2.0.0-py3-none-any.whl |
Total release size: 50.8 kB
Release files / kivy_history-2.0.0.tar.gz
| Download URL | kivy_history-2.0.0.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0765f5af5e501715e8191b7104763fcf66a0426e12c00d8456c97ca2fef510c1
|
|
BLAKE2b-256 checksum How to use checksums |
051f0384679fe58c20b90793cc8d29646318d6fd5f39bfb71a4cacceca43bec8
|
| 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 Oct 27, 2026.
Transparency logRelease files / kivy_history-2.0.0-py3-none-any.whl
| Download URL | kivy_history-2.0.0-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
011dd7a5cea6db658afb0b9bda6df89b81b9a6572c5f4fdd9fc5d90cd05a3ee8
|
|
BLAKE2b-256 checksum How to use checksums |
34991ff488c085d059ad9476110b1c81077ffc80e6eb51255ba42a312338ad6f
|
| 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 Oct 27, 2026.
Transparency logSecurity for kivy-history 2.0.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
Both files in this release have been uploaded with provenance metadata.
Attestation for kivy_history-2.0.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 Oct 27, 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.