Skip to main content

setup.cfg from python dict

Project description

Install

$ [sudo] pip install setupcfg

Features

  • python -m setupcfg autogenerate setup.cfg :
    • default values (install_requires, name, packages, py_modules, scripts)
    • environment variables support (metadata, options keys)
  • setupcfg.Setupcfg class
    • dict, attr access. string, dict representation
    • load(path), save(path) methods
  • setup.cfg known sections and keys ordering

Usage

usage: python -m setupcfg

Examples

python -m setupcfg autogenerate setup.cfg

# environment variables (metadata, options known keys)
$ export CLASSIFIERS="file: path/to/classifiers.txt"
$ export DESCRIPTION="project description"
$ export KEYWORDS="key1 key2"
$ python -m setupcfg > setup.cfg
setupcfg.Setupcfg class
>>> import setupcfg

>>> medatata = dict(name="pkgname", version"0.0.1")
>>> options = dict(packages=["pkgname"])
>>> cfg = setupcfg.Setupcfg(metadata=medatata, options=options)

string/dict representation

>>> str(cfg)  # string representation
[metadata]
name = pkgname
version = 0.0.1

[options]
packages =
    pkgname

>>> dict(cfg)  # dict representation
{'metadata':{...},'options':{...}}

load(path), save(path)

>>> cfg.load("setup.cfg")
>>> cfg.save("setup.cfg")

setupcfg.get(section, option, default=None)

>>> setupcfg.get("metadata","name")
'pkgname'
>>> setupcfg.get("options","scripts",[])
[]
default values
.
├── requirements.txt (req1, req2)
├── module.py
├── package
|   └── __init__.py
├── scripts
|   └── script
├── setup.py
  • name - repo basename
  • scripts - files in scripts/ folders
  • packages - setuptools.find_packages()
  • py_modules - python files in repo root
  • install_requires - install_requires, requirements.txt, requires.txt content

Links

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

setupcfg-0.0.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

setupcfg-0.0.2-py2.py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 2 Python 3

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