Flot is a simple tool to easily build multiple packages (wheel and sdist) from a single repo without having to create a subdir or another repo for each package, and by simply listing which files to include.
Project description
flot is an easy tool to build Python packages (wheel and sdist) with no magic and guesswork. Flot can also create one or more Python packages from a single code tree, just by listing which files you want to include.
Because “Explicit is better than implicit” and “Simple is better than complex”
flot takes the magic and guesswork away of which files are included in a Python package: you just specify a list of paths or glob patterns for the files you want to include or exclude in your package. No more mystery! Include data files, multiple modules or any files as easily as listing their paths.
With flot you can also have multiple pyproject.toml files to enjoy the benefits of a simpler monolithic code repo and still be able to easily share and package multiple Pypi packages and foster the reuse of subsets of your larger project, without having some imposed directory structure.
Unlike flot, other Python build tools assume that you can only build a single Python package from a given directory or repository and use a lot of magic to find which module or file to include in your package.
Also, while flot promotes declarative builds, it is also possible to run arbitrary Python scripts when you need more power.
See also Why use Flot?
Flot is derived from and based on a modified Flit https://github.com/pypa/flit/ by Thomas Kluyver @takluyver
It was started following this discussion https://github.com/pypa/flit/discussions/669
Install
pip install flot
Usage
Say you’re writing a module foobar - either as a single file foobar.py, or as a directory - and you want to distribute it.
Create a pyproject.toml file. It will look something like this:
[build-system] requires = ["flot"] build-backend = "flot.buildapi" [project] name = "foobar" version = "1.0.0" description = "foobar frobinator" [tool.flot] includes = ["foobar.py"]
You can edit this file to add other metadata, like URL for example to set up command line scripts or add your dependencies. See the pyproject.toml documentation at https://github.com/nexB/flot/blob/main/docs/pyproject_toml.rst
Run this command to build your wheel in the dist/ directory:
flot
Once your package is published to PyPI (I use the standard twine tool for this), people can install it using pip or any other Python packaging tool just like any other package.
Say you’re writing a second module baz as a single file baz.py. Just create a second file named for instance baz-pyproject.toml. It will look something like this:
[build-system] requires = ["flot"] build-backend = "flot.buildapi" [project] name = "baz" version = "1.0.0" description = "baz frobinator" [tool.flot] includes = ["baz.py"]
Run this command to build a second wheel in the dist/ directory:
flot --pyproject baz-pyproject.toml
You now have a second wheel built from the same tree with different content.
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
Built Distribution
File details
Details for the file flot-0.7.2.tar.gz
.
File metadata
- Download URL: flot-0.7.2.tar.gz
- Upload date:
- Size: 43.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e67acd59d78b216c2779f6acc42e104f9a46d0589b8b1e96ae1b21eaf1852fe |
|
MD5 | c0f7fdef79d5ebbccca49fb084c745c1 |
|
BLAKE2b-256 | 4392e544a5ed179e4cf906c1c28191416a3285ea199b48eb5d6e0d364be11a28 |
File details
Details for the file flot-0.7.2-py3-none-any.whl
.
File metadata
- Download URL: flot-0.7.2-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2d7d787f6072e96528228b6eeb2baf383b3fe7e9b344d704a48a5b8ed64fbd |
|
MD5 | 463625d6e51af36d712ad835b9f8c664 |
|
BLAKE2b-256 | 54989fc7924de9ebff67602f6934fff7411d089468d5aee878d7fd2f9d8be1f5 |