27 releases (2 stable)

1.0.1 Jul 1, 2024
1.0.0 Jul 24, 2021
0.18.1 Jul 24, 2021
0.15.0 Feb 27, 2021
0.4.0 Jun 26, 2018

#402 in Command line utilities

MIT license

48KB
742 lines

The Python Launcher for Unix

Motivation

Launch your Python interpreter the lazy/smart way!

This project is an implementation of the py command for Unix-based platforms (with some potential experimentation for good measure 😉).

Example

Typical usage would be:

py -m venv .venv
py ...  # Normal `python` usage.

This creates a virtual environment in a .venv directory using the latest version of Python installed. Subsequent uses of py will then use that virtual environment as long as it is in the current (or higher) directory; no environment activation required (although the Python Launcher supports activated environments as well)!


lib.rs:

Search for Python interpreters in the environment

This crate provides the code to both find Python interpreters installed and utilities to implement a CLI which mimic the Python Launcher for Windows.

Layout

At the top-level, the code directly related to searching is provided. The RequestedVersion enum represents the constraints the user has placed upon what version of Python they are searching for (ranging from any to a major.minor version). The ExactVersion struct represents an exact major.minor version of Python which was found.

The [cli] module contains all code related to providing a CLI like the one the Python Launcher for Windows provides.

Dependencies

~7–16MB
~219K SLoC