Package: pkutils
IndexIntroduction|Requirements|Motivation|Usage|Installation|Project Structure|Design Principles|Scripts|Contributing|LicenseIntroductionpkutils is a Pythonlibrarythat simplifies python module packaging. It is
intended to be used in your package’ssetup.pyfile.With pkutils, you canParse requirements filesDetermine your project’s development statusRead text filesand much more…Requirementspkutils has been tested and is known to work on Python 3.7, 3.8, and 3.9; and PyPy3.7.MotivationPython has a great packaging system, but to actually create and publish a
package requires a lot of work to do well. I designed pkutils to provide
many useful packaging use-cases out of the box. For example, to automatically
include the contents of yourrequirements.txtfile, simply add the following
tosetup.py:importpkutils...requirements=list(pkutils.parse_requirements('requirements.txt'))dev_requirements=list(pkutils.parse_requirements('dev-requirements.txt'))setup(...install_requires=requirements,tests_require=dev_requirements,...)Usagepkutils is intended to be used directly as a Python library.my_package/__init__.py__version__='0.5.4'__author__='Reuben Cummings'__description__='My super awesome great package'__email__='reubano@gmail.com'__license__='MIT'__copyright__='Copyright 2015 Reuben Cummings'You can set__title__explicitly in your Python file.  If you leave__title__unset, pkutils will use:The parent directory for paths ending in__init__.py.The filename before the extention for other paths
(e.g.my_packageformy_package.py).setup.pyimportpkutilstry:fromsetuptoolsimportsetupexceptImportError:fromdistutils.coreimportsetuprequirements=list(pkutils.parse_requirements('requirements.txt'))dependencies=list(pkutils.parse_requirements('requirements.txt',True))dev_requirements=list(pkutils.parse_requirements('dev-requirements.txt'))readme=pkutils.read('README.rst')module=pkutils.parse_module('my_package/__init__.py')version=module.__version__project=module.__title__email=module.__email__user=pkutils.get_user(email)setup(name=project,version=version,description=module.__description__,long_description=readme,author=module.__author__,author_email=email,install_requires=requirements,tests_require=dev_requirements,dependency_links=dependencies,setup_requires=['pkutils'],url=pkutils.get_url(project,user),download_url=pkutils.get_dl_url(project,user,version),classifiers=[pkutils.get_license(module.__license__),pkutils.get_status(version),...],...)This is then converted into something like the following:...setup(name='my_package',version='0.5.4',description='My super awesome great package',long_description='my_package: a super awesome great...',author='Reuben Cummings',author_email='reubano@gmail.com',install_requires=['semver==2.2.1'],tests_require=['semver==2.2.1','wheel==0.24.0','flake8==2.5.1',...],dependency_links=[],setup_requires=['pkutils'],url='https://github.com/reubano/pkutils',download_url='https://github.com/reubano/pkutils/archive/v0.5.4.tar.gz',classifiers=['License :: OSI Approved :: MIT License','Development Status :: 4 - Beta',...],...)Installation(You are using avirtualenv, right?)At the command line, install pkutils using eitherpip(recommended)pipinstall-upkutilsoreasy_installeasy_installpkutilsPlease see theinstallation docfor more details.Project Structure┌──CHANGES.rst├──CONTRIBUTING.rst├──LICENSE├──MANIFEST.in├──Makefile├──README.md├──dev-requirements.txt├──helpers│├──check-stage│├──clean│├──srcdist│├──test│└──wheel├──manage.py├──pkutils.py├──requirements.txt├──setup.cfg├──setup.py├──tests│├──__init__.py│└──standard.rc└──tox.iniDesign Principlesminimize external dependenciesprefer functions over objectskeep the API as simple as possibleScriptspkutils comes with a built in task managermanage.pySetuppipinstall-rdev-requirements.txtExamplesView available commandsmanageShow help for a given commandmanage<command>-hRun python linter and nose testsmanagelintmanagetestOr ifmakeis more your speed…makelintmaketestContributingPlease mimic the coding style/conventions used in this repo.
If you add new classes or functions, please add the appropriate doc blocks with
examples. Also, make sure the python linter and nose tests pass.Please see thecontributing docfor more details.Licensepkutils is distributed under theMIT License.