Skip to main content

setup.py generator

Project description

Installation

$ [sudo] pip install setuppy-generator

Pros

  • setup.py generator
  • create multiple setup.py files - dev/prod, github/pypi, etc
  • python classes/cli

Features

key file/environment variable
name current directory basename or $SETUP_NAME
version $SETUP_VERSION
url $SETUP_URL
classifiers classifiers.txt, $SETUP_CLASSIFIERS
description $SETUP_DESCRIPTION
keywords $SETUP_KEYWORDS
long_description README.md/README.rst, $SETUP_LONG_DESCRIPTION
long_description_content_type text/markdown if long_description is .md file
install_requires requirements.txt, $SETUP_INSTALL_REQUIRES
packages setuptools.find_packages(), $SETUP_PACKAGES
py_modules python files in a current directory, $SETUP_PY_MODULES
scripts scripts/* files, $SETUP_SCRIPTS

Examples

project-name.py/
├── classifiers.txt
├── module.py
├── package
|   └── __init__.py
├── README.md
├── requirements.txt
└── scripts
    └── script
$ cd path/to/project-name.py
$ export SETUP_VERSION="1.0.0"
$ python -m setuppy_generator > setup.py
setup(
    name='project-name',
    version='1.0.0',
    classifiers = [...],
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
    install_requires=['req1','req2'],
    packages=['pkgname'],
    py_modules=['module'],
    scripts=['scripts/script']
)

example #2 - environment variables

$ export SETUP_URL="https://github.com/owner/repo"
$ export SETUP_CLASSIFIERS="classifiers.txt"
$ export SETUP_DESCRIPTION="description ..."
$ export SETUP_KEYWORDS="key1 key2"
$ export SETUP_LONG_DESCRIPTION="README.md"
$ export SETUP_INSTALL_REQUIRES="requirements.txt"
$ export SETUP_PACKAGES="package1 package2"
$ export SETUP_PY_MODULES="module1 module2"
$ export SETUP_SCRIPTS="scripts/script1 scripts/script2"
$ python -m setuppy_generator > setup.py
setup(
    name='project-name',
    version='1.0.0',
    url='https://github.com/owner/repo',
    classifiers = [...],
    description='description ...',
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
    keywords='key1 key2',
    install_requires=['req1','req2'],
    packages=['package1','package2'],
    py_modules=['module1','module2'],
    scripts=['scripts/script1','scripts/script2']
)

open(path).read() function:

$ export SETUP_VERSION="open('.config/version.txt').read().split()"
$ export SETUP_DESCRIPTION="open('.config/description.txt').read().split()"
$ export SETUP_KEYWORDS="open('.config/keywords.txt').read().split(' ')"
$ python -m setuppy_generator > setup.py
setup(
    ...
    version=open('.config/version.txt').read().split(),
    description=open('.config/description.txt').read().split(),
    keywords=open('.config/keywords.txt').read().split(' '),
    ...
)

example #3 - minimal setup.py

$ export SETUP_CLASSIFIERS=""
$ export SETUP_DESCRIPTION=""
$ export SETUP_KEYWORDS=""
$ export SETUP_LONG_DESCRIPTION=""
$ export SETUP_URL=""
$ python -m setuppy_generator > setup.py
setup(
    name='project-name',
    version='1.0.0',
    install_requires=['req1','req2'],
    packages=['pkgname'],
    py_modules=['module'],
    scripts=['scripts/script']
)

Related

readme42.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuppy-generator-2020.12.2.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file setuppy-generator-2020.12.2.tar.gz.

File metadata

  • Download URL: setuppy-generator-2020.12.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for setuppy-generator-2020.12.2.tar.gz
Algorithm Hash digest
SHA256 b0cbaeed4baeff8c982df3b835d2fce2535f0ac8ffc9a1f6a075e8ce37a16c11
MD5 fed9130d199d9b182104012f8481493c
BLAKE2b-256 4e778253482190c3eb46d9e2304b874386a2476de6234f63ca7b0378b8a1e7f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page