跳转到主要内容

缩短Tryton模块中的样板代码

项目描述

缩短Tryton模块中的样板代码

Tryton模块通常包含并需要大量的setup.py中的样板代码。这不仅有很多重复代码,而且在Tryton的不同版本之间维护这些代码也是一种负担。

此软件包允许将大多数所有在Tryton模块和Tryton版本之间相对“静态”的元数据和选项移动到setup.cfg中,并仅使用相当简洁的setup.py

trytoncommunity-setuptools还支持许多开发者和集成人员使用的“模块前缀映射”。

示例 setup.py

from trytoncommunity_setuptools import setup, get_require_version

requires = ['lxml']
tests_require = [
    get_require_version('proteus'),
    'pycountry',
]

setup('trytoncommunity', 'country_order',
      requires=requires, tests_require=tests_require)

相应的示例 setup.cfg

[metadata]
; name will be filled by trytoncommunity-setuptools
description  = Precedence rating for countries in Tryton
long_description = file: README.rst
long_description_content_type = text/x-rst
url           = https://tryton.community
author        = Hartmut Goebel
author_email  = h.goebel@crazy-compilers.com
license       = GPL-3.0-or-later
license_files = LICENSE-GPL-3.0.txt
keywords      = tryton, country
classifiers =
  Development Status :: 5 - Production/Stable
  License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
  Natural Language :: English
  Natural Language :: German
;; These classifiers will be added by trytoncommunity-setuptools,
;  Environment :: Plugins
;  Framework :: Tryton
;  Intended Audience :: Developers
;  Programming Language :: Python :: … filled according to Tryton version
;  Programming Language :: Python :: Implementation :: CPython
;  Topic :: Office/Business
;  Operating System :: OS Independent

[options]
;python_requires = …          # filled by trytoncommunity-setuptools
;include_package_data = True  # enforced by trytoncommunity-setuptools
;zip_safe = False             # enforced by trytoncommunity-setuptools

当使用符合PEP 517的构建工具,例如build时,您还需要提供一个pyproject.toml文件

[build-system]
requires = ["trytoncommunity-setuptools >= 0.3"]
build-backend = "setuptools.build_meta:__legacy__"

项目细节


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

trytoncommunity_setuptools-0.4.0.tar.gz (18.1 kB 查看哈希值)

上传时间

构建分发

trytoncommunity_setuptools-0.4.0-py3-none-any.whl (18.3 kB 查看哈希值)

上传时间 Python 3

由以下支持