So, I want the long_description
of my setup script to be the contents from my README.md
file. But when I do this, the installation of the source distribution will fail since python setup.py sdist
does not copy the readme file.
Is there a way to let distutils.core.setup()
include the README.md
file with the sdist
command so that the installation will not fail?
I have tried a little workaround where I default to some shorter text when the README.md
file is not available, but I actually do want that not only PyPi gets the contents of the readme file but also the user that installs the package.
README files can help your users understand your project and can be used to set your project’s description on PyPI. This guide helps you create a README in a PyPI-friendly format and include your README in your package so it appears on PyPI. README files for Python projects are often named README, README.txt, README.rst, or README.md.
It’s customary to save your README file in the root of your project, in the same directory as your setup.py file. To include your README’s contents as your package description, set your project’s Description and Description-Content-Type metadata, typically in your project’s setup.py file.
This guide helps you create a README in a PyPI-friendly format and include your README in your package so it appears on PyPI. README files for Python projects are often named README, README.txt, README.rst, or README.md. For your README to display properly on PyPI, choose a markup language supported by PyPI.
To include your README’s contents as your package description, set your project’s Description and Description-Content-Type metadata, typically in your project’s setup.py file. For example, to set these values in a package’s setup.py file, use setup () ’s long_description and long_description_content_type.
To manually include files in a distribution do the following:
set include_package_data = True
Create a MANIFEST.in file that has a list of include <glob>
lines for each file you want to include from the project root. You can use recursive-include <dirname> <glob>
to include from sub-directories of the project root.
Unfortunately the documentation for this stuff is really fragmented and split across the Python distutils, setuptools, and old distribute docs so it can be hard to figure out what you need to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With