Background

The Pydigger site monitors the uploads to PyPI and collects meta-data about the packages. It shows various statistics and points you to packages that could be improved by adding some simple meta-data to them. One of the easiste to fix is the missing author field.

Adding Author

Each package can have a field called author that contains the name of, well the author. Accourding to our stats about 4.6% of the packages have not author field. About 1% has VCS but no author field making them very easy to fix. (Locating the missing VCS-es (ak Version Control System) will be the material of another post.

The most common way to include it in the package is to add a field called author to the setup function in the setup.py of the project. In the video we checked the eririn project to see how it is done and then fixed the arduino-udev project. This is the pull request you can see in the video. Within a few minutes the Pull-request was accepted.

setup.py

Here is the section of the setup.py file:
            author="Foo Bar",
        

Another project mr.flagly was using a pyproject.toml file which is documented here. I sent the pull-request from another account I was demonstrating it to the OSDC students.

pyproject.toml

Here is the section of the pyproject.toml files:
        authors = [
            { name="Foo Bar", email="foo@bar.com" },
        ]
        

Step you can do:

  • Visit the list of packages that have VCS but no author field and pick one.
  • Visit the source code of the package. (Link is on the page of the package)
  • In the VCS (Github, GitLab, Bitbucket, etc. look for the name of the author of the package.
  • Locate the setup.py in the root of the repository
  • Edit the file and add the author field.
  • Save it. (This creates a commit)
  • Send a Pull-Request

How to add the author field in a Python package

Elapsed time: 0.00231s