Overview

Bento aims at simplifying the packaging of python softwares, both from the user and developer point of view. Bento packages are described by a bento.info file, which is parsed by the different build tools to do the actual work. Currently, the main user interface to bento is bentomaker, a command line tool to build, install and query bento packages.

There are currently two ways to create bento packages : by writing a bento.info file from scratch, or by converting an existing setup.py.

Simple example

Those examples assume you have already a usable bentomaker in your PATH, either through bento installation or by using the one-file bentomaker bundle. If you can execute:

bentomaker help

successfully, you should be able to go on.

From scratch

Bento packages are created from a bento.info file, which describes metadata as well as package content in a mostly declarative manner.

For a simple python package hello consisting of two files:

hello/__init__.py
hello/hello.py

a simple bento.info may be written as follows:

Name: hello
Version: 1.0

Library:
    Packages:
        hello

The file contains some metadata, like package name and version. Its syntax is indentation-based, like python, except that only spaces are allowed (tab character will cause an error when used at the beginning of a line).

Building and installing

You use bentomaker to build and install bento packages. Its interface is similar to autotools:

bentomaker configure --prefix=somedirectory
bentomaker install

If you are fine with default configuration values, you can install in one step:

bentomaker install

bentomaker will automatically determine which commands need to be re-run. You can check where bento install files with the –list-files option (in which case bento does not install anything):

bentomaker install --list-files

Bentomaker contains a basic help facility, which list existing commands, etc...:

bentomaker help commands # list commands

From existing setup.py (convertion from distutils-based projects)

Bentomaker has an experimental convert command to convert an existing setup.py:

bentomaker convert

If successfull, it will write a bento.info file whose content is derived from your setup.py. The convert command is inherently fragile, because it has to hook into distutils/setuptools internals. Nevertheless, it has been used succesfully to convert packages such as Sphinx or Jinja.

::...
免责声明:
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
内容版权归原作者所有;
本人对内容的有效性/合法性不承担任何强制性责任.
若有不妥, 欢迎评注提醒:

或是邮件反馈可也:
askdama[AT]googlegroups.com


订阅 substack 体验古早写作:


点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

关注公众号, 持续获得相关各种嗯哼:
zoomquiet


自怼圈/年度番新

DU22.4
关于 ~ DebugUself with DAMA ;-)
粤ICP备18025058号-1
公安备案号: 44049002000656 ...::