packaging - Python package: how to avoid redefining author version etc? -


i distribute python package (i use setuptools , have working setup.py file), , related documentation (produced using sphinx).

i find myself bit confused fact have specify authors names, maintainers, version, release, date, emails etc in different parts.

i wondering if there way define kind of common information once package , use both in setup.py script , in .rst files , on.

what possible approaches problem?

if invoking sphinx using distutils, case covered. answer in documentation in sphinx/setup_command.py. example, setup.py should have part looks this:

   # necessary when not using setuptools/distribute    sphinx.setup_command import builddoc    cmdclass = {'build_sphinx': builddoc}     name = 'my project'    version = '1.2'    release = '1.2.0'    setup(        name=name,        author='bernard montgomery',        version=release,        cmdclass=cmdclass,        # these optional , override conf.py settings        command_options={            'build_sphinx': {                'project': ('setup.py', name),                'version': ('setup.py', version),                'release': ('setup.py', release)}},    ) 

after that, calling python setup.py build_sphinx build documentation, having single point of truth shared values. done.

works me. hope helps!


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -