Semi-automatically generate a description of the package to be registered on PyPI

Overview

When registering a package on PyPI, README.md is used as a descriptive text unless otherwise specified. However, since it is not rendered in Markdown format, ugly sentences will be displayed as shown below.

Markdown形式による説明文

This description is rendered in reStructuredText format. Therefore, the method of generating README.rst from README.md and setting it as an explanation is described as a memorandum.

Convert from Markdown to reStructuredText

If you manage the code base with GitHub etc., README.md is considered to be prepared, so Convert this Markdown text to reStructuredText format.

Use Pandoc for conversion.

$ pandoc --from markdown --to rst README.md -o README.rst

Pandoc can be installed with brew.

$ brew install pandoc

Registration in package information

If both README.md and README.rst are included in the package Since README.md has priority, set up README.rst to be used as a descriptive text in setup.py.

Specifically, pass the contents of README.rst to the long_description keyword argument of the setup function.

setup.py


from os import path
from setuptools import setup, find_packages

def read(fname):
    return open(path.join(path.dirname(__file__), fname)).read()

setup(
    long_description=read("README.rst"),
    ... #Other items omitted
)

If you register the package by the above procedure, it will be rendered safely as shown below.

rst形式による説明文

Recommended Posts

Semi-automatically generate a description of the package to be registered on PyPI
How to register a package on PyPI (as of September 2017)
I want to find a popular package on PyPi
Register as a package on PyPI
A story that struggled to handle the Python package of PocketSphinx
A command to easily check the speed of the network on the console
I made a kitchen timer to be displayed on the status bar!
Get the list of packages for the specified user from the packages registered on PyPI
I made a tool to estimate the execution time of cron (+ PyPI debut)
How to calculate the volatility of a brand
How to access the contents of a Linux disk on a Mac (but read-only)
A memo created in a package and registered in PyPI
A record of the time it took to deploy mysql on Cloud9 + Rails
Calculate the probability of outliers on a boxplot
I want to take a screenshot of the site on Docker using any font
A memo on how to overcome the difficult problem of capturing FX with AI
A Python beginner was addicted to registering his own package on PyPI, February 2017 version
Try to estimate the number of likes on Twitter
Steps to calculate the likelihood of a normal distribution
I want to install a package of Php Redis
Generate that shape of the bottom of a PET bottle
A Study on Visualization of the Scope of Prediction Models
Create a shape on the trajectory of an object
Python Note: The mystery of assigning a variable to a variable
What seems to be a template of the standard input part of the competition pro in python3
How to easily draw the structure of a neural network on Google Colaboratory using "convnet-drawer"
[Python] A program to find the number of apples and oranges that can be harvested
[Ubuntu] How to delete the entire contents of a directory
A note on the default behavior of collate_fn in PyTorch
What to do if the package dependency cannot be repaired
The story of introducing jedi (python auto-completion package) to emacs
Get the package version to register with PyPI from Git
I made a function to check the model of DCGAN
How to generate a query using the IN operator in Django
[Introduction to AWS] A memorandum of building a web server on AWS
How to find the scaling factor of a biorthogonal wavelet
Listen to a novel that will be on Amazon Polly
Is there a secret to the frequency of pi numbers?
How to connect the contents of a list into a string
Run the output code on the local web server as "A, pretending to be B" in python
I will publish a shell script created to reduce the trouble of creating LiveUSB on Linux
How to register on pypi
A memorandum of understanding for the Python package management tool ez_setup
A memo that reproduces the slide show (gadget) of Windows 7 on Windows 10.
A pharmaceutical company researcher summarized the basic description rules of Python
How to determine the existence of a selenium element in Python
A note on how to check the connection to the license server port
Display the image of the camera connected to the personal computer on the GUI.
Conditional branch due to the existence of a shell script file
How easy is it to synthesize a drug on the market?
How to check the memory size of a variable in Python
On Linux, the time stamp of a file is a little past.
PyPI package for super easy use of Cotoha on Google colab
Switch the package to be installed for each environment with poetry
[Go] Create a CLI command to change the extension of the image
How to check the memory size of a dictionary in Python
How to find the memory address of a Pandas dataframe value
How to output the output result of the Linux man command to a file
I tried to register a station on the IoT platform "Rimotte"
[Python3] Define a decorator to measure the execution time of a function
How to get the vertex coordinates of a feature in ArcPy