Package: riotkit.pbs
Python Build SimplifiedLighter alternative to PBR. Created to support easily multiple namespace packages built from single repository.
Ultra simple, allows to have almost empty setup.py file, while keeping all information in setup.jsonOptionally integrates with Pipfile.lock which means you can stop using requirements.txt and use fully reproducible builds on production without doing pip freeze manuallyFeatures:External dependencies inrequirements-external.txtInternal dependencies (packages from same repository) inrequirements-subpackages.txtAll arguments that goes to setup() are placed as dictionary insetup.jsonfile, there is no magic thereREADME.md and README.rst (in order) are loaded automatically as long descriptionUses SCM plugin (setuptools_scm) by defaultOptional Pipfile.lock from Pipenv supportCommand./setup.py --quiet freeze_dependenciesto print dependencies in requirements.txt formatCommand./setup.py install_dependenciesto install dependencies using pipGetting startedproject.tomlNeeds to be configured, so the pip and pipenv would know the dependencies to run setup.py file[build-system]requires=["setuptools>=45","wheel","setuptools_scm[toml]>=6.0","riotkit.pbs>=1.0"]setup.pyThe usage of PBS is really simple, import and unpack a dictionary.
Optionally override values as you wish - there is no magic, everything is passed explicitly, so you can print it or pass to setup()#!/usr/bin/env python3fromsetuptoolsimportsetupfromriotkit.pbsimportget_setup_attributes# advanced usage: override any attributeattributes=get_setup_attributes(git_root_dir='../../')attributes['long_description']+="\nBuilt using Riotkit Python Build Simplified"setup(**attributes)setup.jsonAgain, there is no any magic. Every key there is an attribute that should go to setup() from setuptools.
Please look at setuptools documentation for list of available attributes, you can find it there:https://setuptools.readthedocs.io/en/latest/references/keywords.html{"name":"rkd.process","author":"RiotKit non-profit organization","author_email":"riotkit@riseup.net","description":"rkd.process provides easy process interaction and output capturing/redirecting, wraps subprocess from Python's standard library.","url":"https://github.com/riotkit-org","license":"Apache-2","classifiers":["Development Status :: 5 - Production/Stable","Environment :: Console","Intended Audience :: Developers","Intended Audience :: System Administrators","Intended Audience :: Information Technology","License :: OSI Approved :: Apache Software License","Operating System :: POSIX","Programming Language :: Python :: 3 :: Only"],"keywords":["rkd","riotkit","anarchism","output capturing","output","subprocess"]}requirements-external.txtIt's a regularrequirements.txtreplacement, with all versions there.some-package>=1.0MANIFEST.inPoints out which files should be included in a distribution package.recursive-excludetests*
recursive-excludeexample*
includerequirements-external.txt
includerequirements-subpackages.txt
includesetup.jsonAdditional work to do in multiple-package repositoryMultiple-package repositories are used to keep versioning in synchronization for multiple packages.
Some of packages could be dependent on each other, but possible to install standalone.See real use case:https://github.com/riotkit-org/riotkit-do/tree/master/src/corerequirements-subpackages.txtA dynamic version ofrequirements.txt, where a simple templating mechanism is available to allow
creating dependencies to packages that are released together with current package from same repository.rkd.process>={{current_version}},<{{next_minor_version}}Available variables:current_version: Example 1.3.1.2next_minor_version: Example 1.4next_major_version: Example 2.0Pipenv supportPipenv support could be optionally enabled. In this case all standard dependencies fromPipfile.lockwould be frozen
and added toinstall_requiresautomatically.setup.py#!/usr/bin/env python3fromsetuptoolsimportsetupfromriotkit.pbsimportget_setup_attributessetup(**get_setup_attributes(pipenv=True))DebuggingPBS is not performing any magic inside, so there is a possibility to just print the attributes that would be used insetup()setup.py#!/usr/bin/env python3fromsetuptoolsimportsetupfromriotkit.pbsimportget_setup_attributesimportpprintattributes=get_setup_attributes(git_root_dir='../../')pp=pprint.PrettyPrinter(indent=4)pp.pprint(attributes)# setup(#     **attributes# )