Skip to content

Home

CI Nightly Package Tests Codecov Documentation (stable)
PyPI version Python BSD-3-Clause
Ruff Doc style: google OpenSSF Scorecard
Downloads Monthly downloads GitHub stars

Overview

feu (French word for "fire" 🔥) is a lightweight Python library designed to help manage Python packages and their versions across different Python environments. It provides utilities to:

  • Check package availability: Verify if packages and modules are available in your environment
  • Install packages intelligently: Install packages with version compatibility checks for your target environment
  • Version management: Find the closest valid package version for your target environment
  • Package configuration: A registry of known package version compatibility, shipped as data generated from the wheels published on PyPI, which you can extend with your own constraints
  • Version requests: Every version argument is an exact version (2.4.0), a wildcard (2.4.*) or an empty string for the latest version
  • Version utilities: Compare, filter and sort versions, fetch the versions published on PyPI, and read dependency bounds from pyproject.toml
  • Git and GitHub utilities: Get the tags of a local git repository, and fetch and sort repository metadata from the GitHub API
  • Benchmark trend: Follow the results of pytest-benchmark and detect the regressions
  • Optional dependencies: Check them, raise a helpful error when one is missing, and skip the tests that need them (feu.imports, feu.testing)

The library is particularly useful for projects that need to support multiple Python versions, free-threaded builds, OSes, and CPU architectures, and want to ensure they install compatible package versions.

Key Features

  • Target-aware: Automatically selects compatible package versions based on the Python version, free-threadedness, OS, and CPU architecture
  • CLI interface: Command-line tools to install a package, find the closest valid version, check a version, list the versions to test and follow the trend of benchmarks
  • Lightweight: Minimal dependencies (only packaging required for core functionality)
  • Extensible: Registry of common packages (numpy, pandas, polars, torch, etc.) with known version constraints, PyPI-backed discovery for anything not in the registry, and registries of installers (pip, uv) and dependency resolvers that you can add to

Quick Example

>>> from feu import is_package_available
>>> from feu.compat import Target, find_closest_version
>>> is_package_available("packaging")
True
>>> target = Target(python_version="3.9", os="linux", arch="x86_64")
>>> find_closest_version("numpy", "2.3.0", target)
'2.0.2'
>>> find_closest_version("numpy", "1.*", target)  # doctest: +SKIP
'1.26.4'

A wildcard needs network access (and the requests extra), so the example is skipped by the tests.

Install a package at the closest valid version, from Python or from the command line:

from feu import InstallerSpec, PackageSpec, install_package_closest_version

install_package_closest_version(InstallerSpec("uv"), PackageSpec("numpy", "2.*"))
feu install --installer-name=uv --pkg-name=numpy --pkg-version='2.*'

The Usage Guide has examples of every feature.

Documentation

Installation

pip install feu            # only the required dependency, packaging
pip install 'feu[all]'     # every optional dependency
pip install 'feu[cli]'     # the feu command (click)

The other extras are feu[git] (feu.local_git), feu[requests] (PyPI and GitHub calls, which wildcard version requests need) and feu[rich] (show_compat_targets). See Get Started.

API stability

⚠ While feu is in development stage, no API is guaranteed to be stable from one release to the next. In fact, it is very likely that the API will change multiple times before a stable 1.0.0 release. In practice, this means that upgrading feu to a new version will possibly break any code that was using the old version of feu.

License

feu is licensed under BSD 3-Clause "New" or "Revised" license available in LICENSE file.