Giter Club home page Giter Club logo

setuptools-py2cfg's Introduction

setuptools-py2cfg

Latest version released on PyPi Build status BSD 3-Clause

Since version 30.3.0, setuptools supports declarative configuration through the setup.cfg file. This script helps convert existing setup.py files to setup.cfg in the format expected by setuptools.

Usage

Just point setuptools-py2cfg to a setup.py file or run it in a directory containing a setup.py. For example, given the following setup.py:

from setuptools import setup, find_packages

classifiers = [
    'Development Status :: 5 - Production/Stable',
    'Programming Language :: Python :: 2.7',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.3',
    'Programming Language :: Python :: 3.4',
    'Programming Language :: Python :: 3.5',
    'Programming Language :: Python :: 3.6',
    'Intended Audience :: Developers',
    'Topic :: Software Development :: Libraries',
    'License :: OSI Approved :: BSD License',
]

extras_require = {
    'tests': [
        'tox >= 2.6.0',
        'pytest >= 3.0.3',
    ],
    'devel': [
        'check-manifest >= 0.35',
        'readme-renderer >= 16.0',
    ]
}

kw = {
    'name':                 'ansimarkup',
    'version':              '1.3.0',

    'description':          'Produce colored terminal text with an xml-like markup',
    'long_description':     open('README.rst').read(),

    'author':               'Georgi Valkov',
    'author_email':         '[email protected]',
    'license':              'Revised BSD License',
    'keywords':             'ansi terminal markup',
    'url':                  'https://github.com/gvalkov/python-ansimarkup',
    'classifiers':          classifiers,
    'install_requires':     'colorama',
    'extras_require':       extras_require,
    'packages':             find_packages(),
    'zip_safe':             True,
}

if __name__ == '__main__':
    setup(**kw)

Running setuptools-py2cfg.py would print:

[metadata]
name = ansimarkup
version = 1.3.0
author = Georgi Valkov
author_email = [email protected]
license = Revised BSD License
description = Produce colored terminal text with an xml-like markup
keywords = ansi, terminal, markup
url = https://github.com/gvalkov/python-ansimarkup
long_description = file: README.rst
classifiers =
    Development Status :: 5 - Production/Stable
    Programming Language :: Python :: 2.7
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.3
    Programming Language :: Python :: 3.4
    Programming Language :: Python :: 3.5
    Programming Language :: Python :: 3.6
    Intended Audience :: Developers
    Topic :: Software Development :: Libraries
    License :: OSI Approved :: BSD License

[options]
packages = find:
zip_safe = True
install_requires = colorama

[options.extras_require]
tests =
    tox >= 2.6.0
    pytest >= 3.0.3
devel =
    check-manifest >= 0.35
    readme-renderer >= 16.0

There are several non-essential options that control the format of the generated ini-file:

usage: setuptools-py2cfg.py [-h] [-t int] [-i int] [-a] [path]

converts an existing setup.py file to a setup.cfg in the format expected by
setuptools

positional arguments:
  path                  path to setup.py file (default: ./setup.py)

optional arguments:
  -h, --help            show this help message and exit
  -t int, --dangling-list-threshold int
                        lists longer than this many characters are converted
                        to a dangling list (default: 40)
  -i int, --dangling-list-indent int
                        number of spaces to use when indenting dangling lists
                        (default: 4)
  -a, --always-use-dangling-lists
                        use dangling lists everywhere (default: False)

Keep in mind that a setup.py file with a single call to setuptools.setup() is still needed after migrating all metadata to setup.cfg.

Installation

The latest stable version of setuptools-py2cfg can be installed from pypi:

$ pip install setuptools-py2cfg

Todo

  • Handle entry_scripts in ini-format.
  • Write a test or two.

License

Released under the terms of the Revised BSD License.

setuptools-py2cfg's People

Contributors

gvalkov avatar amrsoll avatar kolanich avatar pganssle avatar imba-tjd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.