Skip to main content

Run Python scripts using the local virtual environment without activating it

Project description

localpython

Run Python scripts using your local virtual environment — without activating it manually.

localpython is a simple cross-platform CLI tool that automatically detects your local .venv, venv, or env folder and uses its Python interpreter to run a script — just like a smart alias.

Features

  • ✅ Runs scripts using .venv/Scripts/python or bin/python
  • ✅ No need to activate virtual environments manually
  • ✅ Supports arguments, flags, and quoted paths
  • ✅ Automatically searches parent directories with -p
  • ✅ Includes --version, --which, --help

Installation

Install via pip:

pip install localpython

Usage

Basic

localpython script.py

Pass arguments to your script

localpython script.py --input file.json --debug true

Search in parent directories for a venv

localpython -p script.py --some arg

Show path to the interpreter

localpython --which

Show version

localpython --version

Example

Given a project:

myproject/
├── .venv/
├── script.py

And a command:

localpython script.py --run fast

This tool will automatically run:

./.venv/Scripts/python script.py --run fast

(Or the Unix equivalent if on Linux/Mac)

License

This project is licensed under the MIT License.

Author

Created by Yali Ach

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

localpython-0.1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

localpython-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file localpython-0.1.2.tar.gz.

File metadata

  • Download URL: localpython-0.1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for localpython-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4330520031597f9682a8d5950afece963e88f43652620f1d0add0ecf4fa949fc
MD5 e31bfbd02f5f7c130ac3271e111103a1
BLAKE2b-256 79b156796827c59ca8cbc76447cea6316e810ea1777b3ae10cc55e99c5fb8e77

See more details on using hashes here.

Provenance

The following attestation bundles were made for localpython-0.1.2.tar.gz:

Publisher: publish.yml on YaliAch/localpython

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

File details

Details for the file localpython-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: localpython-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for localpython-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d8b1dff82233e83c8528520ec647b64d1e2014515801281f52d80bd989d22230
MD5 bee0746baf840c355958cc8b77184bd3
BLAKE2b-256 8e0e9a6ac462d685034f5f5cb25b20bd85b9e03c9b6a4fd8dd4a1bf9cf4da896

See more details on using hashes here.

Provenance

The following attestation bundles were made for localpython-0.1.2-py3-none-any.whl:

Publisher: publish.yml on YaliAch/localpython

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