Skip to main content

quicken

Make Python tools fast.

# app/cli.py
import slow_module
import has_lots_of_dependencies


def cli():
    print('hello world')
    # Finally get to work after everything is loaded.
    slow_module.do_work(has_lots_of_dependencies)
    

# app/main.py
from quicken import cli_factory


@cli_factory('app')
def main():
    from .cli import cli
    return cli

That's it! The first time main() is invoked a server will be created and stay up even after the process finishes. When another process starts up it will request the server to execute cli instead of reloading all modules (and dependencies) from disk. This relies on the speed of fork being lower than the startup time of a typical cli application.

If python -c '' takes 10ms, this module takes around 40ms. That's how fast your command-line apps can start every time after the server is up.

Why

Python command-line tools are slow. We can reduce dependencies, do lazy importing, and do little/no work at the module level but these can only go so far.

Our goal is to speed up the cli without giving up any dependencies. Every Python CLI tool should be able to get to work in less than 100ms.

Goals

  • Be as fast as possible when invoked as a client, be pretty fast when invoked and we need to start a server.

Limitations

  • Unix only.
  • Debugging may be less obvious for end users or contributors.
  • Daemon will not automatically have updated gid list if user was modified.
  • Access to the socket file implies access to the daemon (and the associated command that it would run if asked).

Tips

  • Profile import time with -X importtime, see if your startup is actually the problem. If it's not then this package will not help you.
  • Distribute your package as a wheel. When wheels are installed they create scripts that do not import pkg_resources, which can save 60ms+ depending on disk speed and caching.

Development

ln -sf ../.githooks .git/hooks

Metadata

Release files for quicken 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quicken 0.1.0
File Size Uploaded Provenance Actions
quicken-0.1.0.tar.gz 19.8 kB Without provenance Details for quicken-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quicken 0.1.0
File Interpreter ABI Platform Actions
quicken-0.1.0-py3-none-any.whl Python 3 none any Details for quicken-0.1.0-py3-none-any.whl

Total release size: 81.3 kB

Release files / quicken-0.1.0.tar.gz

Download URL quicken-0.1.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1ef2bbdf1c8965f5d4f7e36477222529407e369fbdea3fd4e94b686b08b09fc2
BLAKE2b-256 checksum
How to use checksums
aa21dc60fd882e34c678b002c0a805ec210922cb2f1be6c19f87bec54abd7245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.1 Linux/4.19.11-041911-generic

Release files / quicken-0.1.0-py3-none-any.whl

Download URL quicken-0.1.0-py3-none-any.whl
Size 61.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a11bbc7603c69c712f53eb5f0b81e3fc3c333386e79ce7d58013ceff32abc908
BLAKE2b-256 checksum
How to use checksums
9f5b97a90771be089664dbdd3361bac07a4e708527ba8943968aea47301cea6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.1 Linux/4.19.11-041911-generic

Security for quicken 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page