Skip to main content

Wicked fast hot reloading

Project description

Firehot

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 issues
  • debug: Detailed information useful during development
  • info: General information about what's happening (default)
  • warn: Warning messages for potential issues
  • error: 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 demopackage and external-package library in this repo.

# To do a regular, fast development build
(make build-develop && cd demopackage && uv run test-hotreload)
# To pass the args we use in a release
(make build-develop MATURIN_ARGS="--release --strip" && cd demopackage && uv run test-hotreload)

Unit tests

cargo test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firehot-0.4.1.tar.gz (35.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

firehot-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

firehot-0.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

firehot-0.4.1-cp313-cp313-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

firehot-0.4.1-cp313-cp313-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

firehot-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

firehot-0.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

firehot-0.4.1-cp312-cp312-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

firehot-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

firehot-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

firehot-0.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

firehot-0.4.1-cp311-cp311-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

firehot-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

firehot-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

firehot-0.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

firehot-0.4.1-cp310-cp310-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

firehot-0.4.1-cp310-cp310-macosx_10_12_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file firehot-0.4.1.tar.gz.

File metadata

  • Download URL: firehot-0.4.1.tar.gz
  • Upload date:
  • Size: 35.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for firehot-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d19ca93f0ad62c32043b6e4e338cf3f6dce948fdf6c3756b62582b4ba3a77444
MD5 56dd659d9788286fa7ded55859015dbc
BLAKE2b-256 076c66563a7c6b7cfb1f1af7fcea0b31228c05f0fbad7f2321ff2b867992dcc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1.tar.gz:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5256083ecb3c8f792a4ce352608a7e8dd5ed7257efc2a07f4ebc4f81e7b2c5c4
MD5 e310f924990c75961ec4d26e955e8658
BLAKE2b-256 45e3a52d6ecd4b0a8c8f16e3ac951507fdd4e333568a59e46af8aec42c88b1c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 086218f557703f69d338fd93fedd11e04c096edc050d09992f594f4dcba39095
MD5 6f40de928e14934ff03505abd24f0f92
BLAKE2b-256 cd8143a59ce19b583cb9e45c80ef3edadf5f87b4007186238517b37393e4a76b

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0333e74bc0d49732efde5b8deb7bf02697a9eef9af5d4ac373a55bf87634838b
MD5 ed16d86c329316e15259f66ebedccf34
BLAKE2b-256 6aaee296acfce31ee523195bc20a61c8d2e6ef433c302dee8b6648f8afce18bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c43dce07754951c168b2f83e81b2aa167d5b5911a73b7687c9e4356ceafc6b51
MD5 8c3a85df2e34b3f19db98baa555890f7
BLAKE2b-256 00547f43e71914901c8c01a7927c72adc3ac3fa1ce09825b65fa10ac58a02cfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bc3034e588146df70e0115f88c5a5d59b154618e9f77ae550cefadb1f7c2d33
MD5 0b5f2429f9521dd433309371e73999e6
BLAKE2b-256 35979b44b024680af8e564b1e7ae3c50ba9500556faf0fd0348747c5f6711f3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f68e226ad3842689e3d44d9e20669de0e7ef1e8536f73e51e83ba48cfba0c67f
MD5 3340043533f0a8292222c0889e54566d
BLAKE2b-256 b083dbab2026bb4b13c6a33c5ad18105cf0c5e030b93274beaf3b4cf9279bae0

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e9b6da39a6360befe019b0df2b5c9a5a483ba83448cd9748d4692d65e828a1e
MD5 f4ed2f33916153195606be198e7a0baa
BLAKE2b-256 0a849a24ec0c5721f977ba9d73c6ffe43ff690e59ae2d05fcaa9577028dffa86

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 43a2c9e361132c8eb33553311c2fb1e7e854a17c9e2cc930dcf92c22a832c994
MD5 712ca9a522dbf8f4be7f8a27c725159c
BLAKE2b-256 10c57239b84ce9f7c1c3843a47d228eefa3fbaa9a14df7aec741f934338a9658

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f88743317340a87c088335331d220f31cc9484bbabb779aa0cd814dbbae56aa
MD5 46675a43d94a0b4368e1f386b5aaabd7
BLAKE2b-256 a717644b3ae4ca6d80937207dc706c3932851dc4b4870a04bfbd6fba3e3f4eee

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6147583fea491ac4f5609a56748356b3d2ee8d0705299e02240882b59012d5d5
MD5 c83861d6ebc325c3d0ebf39be52e76db
BLAKE2b-256 6ac837028e8102aef9e86c36431b5cce67a240c80248e8fdb9179ce3926940fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2bb660796c8c41266bda793e1406ace96ff23b2111c97ab86640623013d533e7
MD5 10ddd57bc27c59bc75eef938abe2b670
BLAKE2b-256 b4ff91760462bb509d45a3cda1efe40deb7f82ddd65488600e19cf1c176854ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9aafe8b12c0b0f6afd658d6491d106e4a9ca5545220f1c868b92455cccd0e902
MD5 f8ed9f11fe4ba470d80bffdfaaeaaa6f
BLAKE2b-256 18248c9f7d106489c18f4ecbe294e657b74a1343f4157bb63c19411109f28807

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e5816fe972c7c3735ca602d42f133ee952afd07285a01f02f4e9274d3e5d058
MD5 eab1d5bd4aef3622f852d9fad3a89d47
BLAKE2b-256 5f8a3e42dfc2a5d138f2105f0b395718b106470caacc6ac304b9a5504f3becdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3e5bfde61a769f5b53e221fbc15b67468515c8bc933b79711b06701a577ab44d
MD5 12b3aed333659a12e8852e41ab734da3
BLAKE2b-256 3735e745342789e676f717dc32938587abcbcde9dea11d62923285ea797eae6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b662b23fbb7899938bcf6654c6cccb8f96d3fc132f49b0c65bf0efab6b24a961
MD5 44fec6f1969c8188932cd10b6922f995
BLAKE2b-256 f8fa172bb8f79deffefe8c10185e15569a9ad308652eef2a7393e73a5cd0c98e

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firehot-0.4.1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e2ed9aa18d9898f5a80ef12b7921f524038358c46cfe4de86fdf8f9423b88f93
MD5 4698152e7073e25623294312e332b9eb
BLAKE2b-256 3c2feeaa925d45e66492dac83cc55e8d975a02f609a0d948515aeb2276449573

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.1-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: ci-build.yml on piercefreeman/firehot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page