Skip to main content

Make Python CLI tools win the speed race, by cheating!

Project description

Jump the Gun

Make Python CLI tools win the speed race, by cheating!

What?

Make Python CLI tools blazing fast, by entirely avoiding the time taken for Python interpreter startup and module imports.

Why?

CLI tools should be fast. Ideally, running them should be near-instant.

This is especially significant, for example, when running code linting and formatting tools on just a few files in SCM hooks, such as via pre-commit.

Installation

Install into the same Python env where you have tools like black or flake8 installed:

pip install jumpthegun

Usage

Example:

jumpthegun run black --help

time black --help
time jumpthegun run black --help

time black --check .
time jumpthegun run black --check .

With pre-commit

pre-commit is awesome, but it makes commits slower. JumpTheGun fixes that!

Example config (.pre-commit-config.yaml):

repos:
- repo: https://github.com/PyCQA/flake8
  rev: 6.0.0
  hooks:
  - id: flake8
    entry: jumpthegun run flake8
    additional_dependencies:
    - jumpthegun

You may need to run pre-commit install --install-hooks if you've changed the config in an existing working copy of a project.

Then, edit your .git/hooks/pre-commit and make this change:

if [ -x "$INSTALL_PYTHON" ]; then
    #exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
    exec jumpthegun run pre-commit "${ARGS[@]}"

Copyright & License

Copyright 2022-2023 Tal Einat.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Version 3.90 of the filelock library is included in this codebase as-is. It is made available under the terms of the Unlicense software license. See it's LICENSE file for details.

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

jumpthegun-0.0.3.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

jumpthegun-0.0.3-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file jumpthegun-0.0.3.tar.gz.

File metadata

  • Download URL: jumpthegun-0.0.3.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for jumpthegun-0.0.3.tar.gz
Algorithm Hash digest
SHA256 43fcf8f74e64e71dd80d82bb804cd1859a4a33f7f4bb15c7cd7762b093799081
MD5 bd4a7dc111ba640f495d20471aeeb773
BLAKE2b-256 285bbba802f0c920ada139ef24617a4ea9a74fd7e3b0261e5f73d53f129fac2a

See more details on using hashes here.

File details

Details for the file jumpthegun-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: jumpthegun-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for jumpthegun-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2be9729b6c27014ceaa6f0a261c31840ed682e8e36a35e0f3902d13a2b6d256b
MD5 2a4b50a0dfd107fadd984986e8526a19
BLAKE2b-256 e1a8be26850887a72ed0a3691ad2c559d1ff124a33193ba941f3be8240e40ddc

See more details on using hashes here.

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