Giter Club home page Giter Club logo

flot's Introduction

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 pypa/flit#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.

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

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

  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"]
    build-backend = "flot.buildapi"
    
    [project]
    name = "baz"
    version = "1.0.0"
    description = "baz frobinator"
    
    [tool.flot]
    includes = ["baz.py"]
  2. 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.

flot's People

Contributors

antarcticrainforest avatar aodag avatar blink1073 avatar carreau avatar cclauss avatar davidrft avatar dciborow avatar dependabot[bot] avatar edward-knight avatar flying-sheep avatar gotmax23 avatar holgi avatar hugovk avatar huy-ngo avatar iwpnd avatar jhamrick avatar joukewitteveen avatar jwkvam avatar layday avatar mariatta avatar minrk avatar nanonyme avatar ntninja avatar okken avatar pombredanne avatar sander76 avatar sbidoul avatar takluyver avatar uranusjr avatar wimglenn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

flot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.