Wicked fast hot reloading
Project description
Firehot
A package to quickly hot reload large Python projects. Currently for Linux & OSX.
Background
Once your project gets to a certain size, the main overhead of application startup is typically the loading of 3rd party packages. Packages can do varying degrees of global initialization when they're imported. They can also require 100s or 1000s of additional files, which the AST parser has to step through one by one. Cached bytecode can help but it's not a silver bullet.
Eventually your bootup can take 5-10s just to load these modules. Fine for a production service that's intended to run continuously, but horrible for a development experience when you have to reboot after changes. Firehot solves this by importing dependencies once, then forking your environment for each exec. Think of it like building a docker image then executing it whenever you make a change.
Python Usage
from firehot import isolate_imports
from os import getpid, getppid
def run_under_environment(value: int):
parent_pid = getppid()
print(f"Running with value: {value} (pid: {getpid()}, parent_pid: {parent_pid})")
with isolate_imports("my_package") as environment:
# Each exec will be run in a new process with the environment isolated, inheriting
# the package's third party imports without having to re-import them from scratch.
context1 = environment.exec(run_under_environment, 1)
context2 = environment.exec(run_under_environment, 2)
# These can potentially be long running - to wait on the completion status, you can do:
result1 = environment.communicate_isolated(context1)
result2 = environment.communicate_isolated(context2)
# If you change the underlying file on disk to add an import, you can run update_environment.
# If the files on disk don't add any new imports, it will be a no-op and keep the current
# environment process running.
environment.update_environment()
# Subsequent execs will use the updated environment.
context3 = environment.exec(run_under_environment, 3)
result3 = environment.communicate_isolated(context3)
Logging
By default, Firehot logs at the warn level, but you can adjust this by setting the FIREHOT_LOG_LEVEL environment variable. Most of these logs come from the Rust code.
Available log levels (from most to least verbose):
trace: Extremely detailed information, useful for debugging specific issuesdebug: Detailed information useful during developmentinfo: General information about what's happening (default)warn: Warning messages for potential issueserror: Error messages for actual problems
Example usage:
# Set to debug level for more detailed logs
FIREHOT_LOG_LEVEL=debug python your_script.py
# Set to error level for minimal logs
FIREHOT_LOG_LEVEL=error python your_script.py
Architecture
You launch Firehot by pointing it to your package name, which we resolve internally to a disk path that contains your code. From there, our Rust logic takes over. The pipeline will parse this directory recursively for all Python files, then parse the code's AST to determine which imports are used by your project.
It will then launch a continuously running process that caches only the 3rd party packages/modules. We think of this as the "template" process because it establishes the environment that will be used to run your code. None of your user code is run in this process.
When code changes are made in your project, we will:
- Determine if your changes affected the imported packages
- If not, we can fork the parent process and pass in your user code. This will load all modules from scratch, but because importlib caches the modules in global space, it will be a no-op because of the template.
- If so, we will tear down the current parent process and start a new one with the full 3rd party packages imported. Then we'll fork the environment as normal.
Local Experiments
To test how firehot works with a real project, we bundle a mypackage and external-package library in this repo.
# To do a regular, fast development build
(make build-develop && cd mypackage && uv run test-hotreload)
# To pass the args we use in a release
(make build-develop MATURIN_ARGS="--release --strip" && cd mypackage && uv run test-hotreload)
Unit tests
cargo test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file firehot-0.3.3.tar.gz.
File metadata
- Download URL: firehot-0.3.3.tar.gz
- Upload date:
- Size: 16.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dee4fa1b95b2b5804ea0acc6f020ef84e08eab01b9fbfe425fe68667d007d73
|
|
| MD5 |
b7210e3fc0f66f2d4c8be4bd3051d054
|
|
| BLAKE2b-256 |
f9e601084c77f9c17135ee1e9655e36f27c91294bad622961deb261f6bf6efa9
|
Provenance
The following attestation bundles were made for firehot-0.3.3.tar.gz:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3.tar.gz -
Subject digest:
6dee4fa1b95b2b5804ea0acc6f020ef84e08eab01b9fbfe425fe68667d007d73 - Sigstore transparency entry: 181629361
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: firehot-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53ed63548c46710426de042c1bc29d2c7cda381fd4e4ec16ce5988caf8f1a973
|
|
| MD5 |
643493f4ec802811fcea909b69b3a9e4
|
|
| BLAKE2b-256 |
8cfba15010285f38ae33784ed6427dbd09151bb196e233f3e038078ba4bc1f22
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl -
Subject digest:
53ed63548c46710426de042c1bc29d2c7cda381fd4e4ec16ce5988caf8f1a973 - Sigstore transparency entry: 181629364
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: firehot-0.3.3-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49c4f0c3ac8d9cfe9fb4af9498918887b12f71abece14eea77a3c9413064bed2
|
|
| MD5 |
64085e97ac11807ac822319422074c27
|
|
| BLAKE2b-256 |
4e46ab18a0ec2bc929f8a036ffae7d1ec9a01ae2c0557271142d2e1146b36b0c
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
49c4f0c3ac8d9cfe9fb4af9498918887b12f71abece14eea77a3c9413064bed2 - Sigstore transparency entry: 181629382
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: firehot-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82e67fdfc39b5067de675f113c7876dde670a13a5c2eb36b1724da1734780b4c
|
|
| MD5 |
9858e101fdb622a3528bcbdee08a77f6
|
|
| BLAKE2b-256 |
29b41c298bb67af3cd730bb9023510e8dbde783d61621eaf6344a0d3e829e09d
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl -
Subject digest:
82e67fdfc39b5067de675f113c7876dde670a13a5c2eb36b1724da1734780b4c - Sigstore transparency entry: 181629373
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: firehot-0.3.3-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abf9dfb5c60b4f078139e5dd3b1248c6e030ae41416e364d83e252854dc5719c
|
|
| MD5 |
3f36e9657535b25f8f5e089c4c212ad2
|
|
| BLAKE2b-256 |
103de378f85299db1057085e6f1bbc190c899400c36b0f75cf693c8360494a5f
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
abf9dfb5c60b4f078139e5dd3b1248c6e030ae41416e364d83e252854dc5719c - Sigstore transparency entry: 181629389
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: firehot-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb7266a6e10e07e3d43afafcd32313f60b8ce081a05da1d77baa109e4078fbb0
|
|
| MD5 |
93b787d49f50cf1650a339761180f8cd
|
|
| BLAKE2b-256 |
2ba12a09a3b51c17cb58773da02a81eeb57303f0971ecd8f7d2235cdba65ac28
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl -
Subject digest:
bb7266a6e10e07e3d43afafcd32313f60b8ce081a05da1d77baa109e4078fbb0 - Sigstore transparency entry: 181629385
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: firehot-0.3.3-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc143c5390a96881cbcaa1e8015e1a2190a6142cd92acd89cd57b108a7ef2065
|
|
| MD5 |
0c3bef9fc754c11a459c7066594ef34b
|
|
| BLAKE2b-256 |
eb65f927eeef1d5532bdfc2593a52df8b4dbebb5eca7fbbea91db66048a35e0b
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
dc143c5390a96881cbcaa1e8015e1a2190a6142cd92acd89cd57b108a7ef2065 - Sigstore transparency entry: 181629368
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: firehot-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b65a25d68d048605d5f0bd1c384c8633f91be65bc88cdf5e1a2852f772cec99a
|
|
| MD5 |
2cc9bfafeac3d457b259de6f4a183e4d
|
|
| BLAKE2b-256 |
51620584d13d3ea9a1f6f190eb4e36e5528722d83effec1dd2ea396d09be04d5
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl -
Subject digest:
b65a25d68d048605d5f0bd1c384c8633f91be65bc88cdf5e1a2852f772cec99a - Sigstore transparency entry: 181629380
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file firehot-0.3.3-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: firehot-0.3.3-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7da656f341cf018381c0071b9ab20cfbeb5bf8102d151160821def931ceaaa3
|
|
| MD5 |
ff4cded60383e4a2aede43d151869a94
|
|
| BLAKE2b-256 |
b19f3d53401baef6330b9cea6e92bd18a104796a4186ee1fd55d1b63afc95fb8
|
Provenance
The following attestation bundles were made for firehot-0.3.3-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
ci-build.yml on piercefreeman/firehot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firehot-0.3.3-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
e7da656f341cf018381c0071b9ab20cfbeb5bf8102d151160821def931ceaaa3 - Sigstore transparency entry: 181629377
- Sigstore integration time:
-
Permalink:
piercefreeman/firehot@ee221fbd395c334c87543fcc2131e61b041044c4 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/piercefreeman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-build.yml@ee221fbd395c334c87543fcc2131e61b041044c4 -
Trigger Event:
push
-
Statement type: