How to specify multiple authors / email addresses in setup.py

We wrote a small wrapper for the Twitter application and published this information at http://pypi.python.org . But setup.py just contained one field to indicate the email / author name. How to specify several contributors / list of email addresses in the following fields, since we would like this package to be listed under our names, which is very similar to the way it is displayed in http://rubygems.org .

author='foo', author_email='foo.bar@gmail.com', 
+47
python pypi
Apr 3 '12 at 19:13
source share
2 answers

As far as I know, setuptools does not support using a list of strings to indicate multiple authors. It is best to list the authors in one line:

 author='Foo Bar, Spam Eggs', author_email='foobar@baz.com, spameggs@joe.org', 

I'm not sure if PyPI checks the author_email field, so you might have problems with this. In any case, I would recommend that you limit them to one author and mention all the participants in the documentation or description.

[Edit] Some sources:

This was reported as a bug , but it seems that the support of several authors has not been implemented. Here is an alternative solution. Here is an idea on how to provide a contact letter for a project with several authors.

+43
Apr 04 '12 at 5:10
source share

I kind of get distracted by @modocache answer if you need some features.

Throughout this answer, I will refer to the version of the file FOO-PYTHON-ENV\Lib\distutils\dist.py python3.6

To repeat, you cannot use the list in the author field. That's why:

Spoiler: Two methods belonging to the DistributionMetadata class are the reason -

 def _read_field(name): value = msg[name] if value == 'UNKNOWN': return None return value def _read_list(name): values = msg.get_all(name, None) if values == []: return None return values 

Here, where you will get an error if you try to insert a list in the author field:

 class DistributionMetadata: #*...(REDACTED)...*# def read_pkg_file(self, file): """Reads the metadata values from a file object.""" #*...(REDACTED)...*# # #################################### # Note the usage of _read_field() here # #################################### self.name = _read_field('name') self.version = _read_field('version') self.description = _read_field('summary') # we are filling author only. self.author = _read_field('author') self.maintainer = None self.author_email = _read_field('author-email') self.maintainer_email = None self.url = _read_field('home-page') self.license = _read_field('license') #*...(REDACTED)...*# # ################################### # Note the usage of _read_list() here # ################################### self.platforms = _read_list('platform') self.classifiers = _read_list('classifier') #*...(REDACTED)...*# 

& Everybody is here:

 class DistributionMetadata: """Dummy class to hold the distribution meta-data: name, version, author, and so forth. """ _METHOD_BASENAMES = ("name", "version", "author", "author_email", "maintainer", "maintainer_email", "url", "license", "description", "long_description", "keywords", "platforms", "fullname", "contact", "contact_email", "classifiers", "download_url", # PEP 314 "provides", "requires", "obsoletes", ) def __init__(self, path=None): if path is not None: self.read_pkg_file(open(path)) else: self.name = None self.version = None self.author = None self.author_email = None self.maintainer = None self.maintainer_email = None self.url = None self.license = None self.description = None self.long_description = None self.keywords = None self.platforms = None self.classifiers = None self.download_url = None # PEP 314 self.provides = None self.requires = None self.obsoletes = None def read_pkg_file(self, file): """Reads the metadata values from a file object.""" msg = message_from_file(file) def _read_field(name): value = msg[name] if value == 'UNKNOWN': return None return value def _read_list(name): values = msg.get_all(name, None) if values == []: return None return values metadata_version = msg['metadata-version'] self.name = _read_field('name') self.version = _read_field('version') self.description = _read_field('summary') # we are filling author only. self.author = _read_field('author') self.maintainer = None self.author_email = _read_field('author-email') self.maintainer_email = None self.url = _read_field('home-page') self.license = _read_field('license') if 'download-url' in msg: self.download_url = _read_field('download-url') else: self.download_url = None self.long_description = _read_field('description') self.description = _read_field('summary') if 'keywords' in msg: self.keywords = _read_field('keywords').split(',') self.platforms = _read_list('platform') self.classifiers = _read_list('classifier') # PEP 314 - these fields only exist in 1.1 if metadata_version == '1.1': self.requires = _read_list('requires') self.provides = _read_list('provides') self.obsoletes = _read_list('obsoletes') else: self.requires = None self.provides = None self.obsoletes = None 
0
Jul 18 '17 at 21:06
source share



All Articles