Skip to main content

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 a simple way to create one or more Python packages from a single repository or code tree, just listing the files you want top include.

Because “Explicit is better than implicit” and “Simple is better than complex.”

You can now have multiple pyproject.toml files and enjoy the benefits of a simpler monolithic code layout and still be able to easily share and package multiple Pypi packages to foster reuse of subsets of your larger project.

Other 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.

flot takes the magic away: you just specify a list of paths or path patterns for the files you want to include in your package. No mystery! Include data files, multiple modules or any files as easily as listing their paths.

See Why use Flot? for more details.

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.

  1. Install flot if you don’t already have it:

    pip install flot
  2. Create a pyproject.toml file in the directory containing the module. It will look something like this:

    [build-system]
    requires = ["flot >=0.5,<1"]
    build-backend = "flot.buildapi"
    
    [project]
    name = "foobar"
    version = "1.0.0"
    description = "foobar frobinator"
    authors = [{name = "Sir Robin", email = "robin@camelot.uk"}]
    
    [project.urls]
    Home = "https://github.com/sirrobin/foobar"
    
    [tool.flot]
    includes = ["foobar.py"]

    You can edit this file to add other metadata, for example to set up command line scripts. See the pyproject.toml page of the documentation.

  3. Run this command to build your wheel in the dist/ directory:

    flot

Once your package is published to PyPI (like with the twine tool), people can install it using pip or any other Python packaging tool just like any other package.

  1. 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 >=0.5,<1"]
    build-backend = "flot.buildapi"
    
    [project]
    name = "baz"
    version = "1.0.0"
    description = "baz frobinator"
    authors = [{name = "Sir Robin", email = "robin@camelot.uk"}]
    
    [project.urls]
    Home = "https://github.com/sirrobin/foobar"
    
    [tool.flot]
    includes = ["baz.py"]
  2. Run this command to build a second wheel in the dist/ directory:

    flot --pyproject baz-pyproject.toml

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

flot-0.6.0.tar.gz (43.5 kB view details)

Uploaded Source

Built Distribution

flot-0.6.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file flot-0.6.0.tar.gz.

File metadata

  • Download URL: flot-0.6.0.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for flot-0.6.0.tar.gz
Algorithm Hash digest
SHA256 861bf5bb7ba5a22bd367a17a3285f496cab47b55b4ef4dc014de70a861435205
MD5 c049a70dda048e5131b54528cfb74525
BLAKE2b-256 8b96074a2a3cb44018b86e9707978647291ddff155e9ef402640992fa46c5e87

See more details on using hashes here.

Provenance

File details

Details for the file flot-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: flot-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.10

File hashes

Hashes for flot-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3339d19ff67c3d286c98edc74576631e543f3fb6205f08d6e5bd3cadcc4ef1a1
MD5 e6756a7354902a47c4d0b24a7da44fd6
BLAKE2b-256 3e83901f92d87ba6e7f6d02bc64a017b0c2b134a8d23c59516f0b1e7e276f741

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page