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.2.dev1.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.2.dev1-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.2.dev1-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.2.dev1-cp313-cp313-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

firehot-0.4.2.dev1-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.2.dev1-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.2.dev1-cp312-cp312-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

firehot-0.4.2.dev1-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.2.dev1-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.2.dev1-cp311-cp311-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.12+ x86-64

firehot-0.4.2.dev1-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.2.dev1-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.2.dev1-cp310-cp310-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

firehot-0.4.2.dev1-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.2.dev1.tar.gz.

File metadata

  • Download URL: firehot-0.4.2.dev1.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.2.dev1.tar.gz
Algorithm Hash digest
SHA256 8c7f795a0435057dd57e6573becd705f44ef93024b9a1d76c28199154c934c1f
MD5 69599ce4a4b481c4b91a79d87d25e835
BLAKE2b-256 d6fda3198d04c1b8b56221accdbb479079c6d4a1a9011bfacf98ac523e99db09

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1.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.2.dev1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46c6a8efc66a33b416a03fc01e95351b707216ccfdcf99ac4ba26d2eeb067cfc
MD5 a7f63750645923c5c5cc5a389be15bde
BLAKE2b-256 877f78d3a131127e3f35c172525e8fd47129fa9673a2b3436c90c57f8f0d1552

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83c8b61133063cf797818f027473f912b959846d2530814ade0b69bade9b11e7
MD5 c82e068b1f281593933d75325f2b24d4
BLAKE2b-256 8ea42b03b4876b5ceff2bbe9c0197c37d9c7fcf5eec836232549b7f56b73c99a

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9abb1dabd79d188692e7a49dbacfa51e336391b5612fb88bfd13d57dabdc69f4
MD5 245396e00e411ddc36ba95786a0003e4
BLAKE2b-256 15b37b193b33c4f8c6db3c776083cf619cced62cf31d78d4f920b1d3e2155739

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b7f3538792ae7b4e12ddf2659e89ef5a00d70493512036a9acd5bfb1fe8bbfa3
MD5 f9c3af81cf7e1120e8a605b386c71926
BLAKE2b-256 847289cad13654ae702b858d314481b5fba4ec96fef8deb278f496fb56a1ea36

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e980abb6b0721887010dacadd9da0fbd19efb2a634d54d19023ccfb46b71f67e
MD5 49629c88ef98c03ef2ca5025898f814e
BLAKE2b-256 11aed1cef66e603bc8549e80f2edb263249a79196b53a2275639ebe89b8a73c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2edf59c7dcc39ef890381c784b17fbc933f6ceaad957744b008da6ceb2393aa5
MD5 76f95baa6477e711091198a4fa7b8d2d
BLAKE2b-256 cb1d1367ff8022e2b0ed1c216edb3e46f296fe5b5831bd16a618da1f76bc0d25

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5425770fb0cf8d47a724201d013d8bf0e2b3bb0292b863320a2dc86d9d170559
MD5 5a43685675baf73bdc1dabb51575f90a
BLAKE2b-256 85280997fb12a8f8c5708722821bd405e6f3046ad2852623062b259d80c08ce1

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0c74ca01010e5496997d1ab58f7e8930772b75ef1734a04693c8d3eeeda4ee69
MD5 9c8f1f5bd040786b1c59a7afcb18377f
BLAKE2b-256 dfa69e17059942c386c28d4cbe3c09787c3b941a4904a8a138c17a683d090b58

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd612b90e88cfece15c468022c37ffd6521fa36eff6f4a3d45eb019c8e6bab6d
MD5 030d938db7a3246ce2a8dcaa8f2f8d14
BLAKE2b-256 52bdd0615ebcffca612a0fa9dd102071e9cbef3e91f25c62b25fb67a139045db

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cac3e9fba743d4e6923758041ecb898b62f2e10be16d2f987c0d3cbb98d86344
MD5 8adfab8e8fa323c44744b71b9db62e08
BLAKE2b-256 ca6c2f478fb9c7ded3d2c2a223199c355a658cd03022f071ada744e5ebc3734b

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3e7570116d3bec377faad9d9421b125e90e141fcf46677b113bf80dc64eb58f
MD5 9699e94930bd9ffd790ecd6c7a9a5132
BLAKE2b-256 526d4665386812795d77686392bd5d59d90e96399293ede8f703382b42822815

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b87007073e19f891ccd07a9c84c0036b2e09b7d09700759a02acf8c05a54a3ec
MD5 700d88b75a9d104be1c8d2a1837dffb8
BLAKE2b-256 f79cbc532cdc9ae9881ef0f0aebc70b7f2bf9fe3552ea0220ef1557b9051dab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36da14f0787ec9bf77f64f9bd52b3fd9e3ab12c62d221b555b71c367380a3749
MD5 45b910ffb1951135b2fbb6ffd65c62b4
BLAKE2b-256 983663e219606f716bc3c8b737c44d42b30f86701d01622f47a34f3fb1a201fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 420f93612e5185462ebcf31318802f6adbc1db38057493dbb8050cc12ead5de4
MD5 bb88c564e968dd9df602939d16b21b70
BLAKE2b-256 f06371de7a399c72418f6d39214d36504d7657b53d3a5d5a2769feb0c9baade8

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f73a708a70157aec4d23448472672e3ae12ff0dafc0c7ba2d9fe9cb17e2271ec
MD5 7274c357bfc8cea86871c3dc9463e4d2
BLAKE2b-256 37672a8b48bf5e8cf5e86db6ba7813b29cf0a7f24293ba6d8f7ef2d835869260

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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.2.dev1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for firehot-0.4.2.dev1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 561fee6b5f2ecac3e44c4e90d410409985b60984854e5b51771efc8273e68b6b
MD5 855eab70fe3611870fb6ebe5827397e2
BLAKE2b-256 e7ac3285465ca233b4ff1f05fd072a4fe8883a98ddfe3d00f5d0299d75a473d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for firehot-0.4.2.dev1-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