3

I created package, and deployed it to a private pypi service. The source package contains a README.md:

tar -tzf client/dist/my-api-client-0.1.0.tar.gz | grep README
my-api-client-0.1.0/README.md

But when I install it with

pip install --pre --extra-index-url https://pypi.myservice.com my-api-client

I get python sources, but the README.md does not appear anywhere under site-packages. I tried forcing the source install with --no-binary :all:, but that didn't seem to make any difference.

Do I need some option to pip to install it? Or am I doing something wrong entirely?

Dima
  • 39,570
  • 6
  • 44
  • 70
  • 2
    Typically you [create a `MANIFEST.in`](https://stackoverflow.com/questions/11848030/how-include-static-files-to-setuptools-python-package) and include the README in that manifest – Cory Kramer Jun 01 '21 at 15:51
  • 2
    Heads up that [a README is usually only included in the metadata](https://packaging.python.org/guides/making-a-pypi-friendly-readme/). Actually installing it is not common, and most people won't be aware that they can look for it next to the source code. – MisterMiyagi Jun 01 '21 at 15:57
  • 1
    I was looking at [the docs](https://packaging.python.org/guides/using-manifest-in/) and it said that `README.md` is included automatically with setuptools 36.4.0+. Is it lying to me? (I am using 40.6.2) – Dima Jun 01 '21 at 18:34
  • @MisterMiyagi Hm ... I did not realize it wasn't common ... I see a whole bunch of readmes from various packages under my `site_packages`. Where would be a more common way to find it? (This is an internal package for an api client, that is generated from swaggerdocs, so it doesn't have its own repo or any other obvious place to be hosted) – Dima Jun 01 '21 at 18:41

1 Answers1

0

If you want to include other files like README.md, you must specify it.

  1. Add the include_package_data option to your setup.py :

    setup( .... include_package_data=True, ...)

  2. Create a MANIFEST.in file and specify the files you want to include in your package :

    include README.me

ChaamC
  • 31
  • 8
  • 1
    Thanks. I was looking at [the docs](https://packaging.python.org/guides/using-manifest-in/) and it said that `README.md` is included automatically with setuptools 36.4.0+. Is it lying to me? (I am using 40.6.2) Also, I am not sure I understand the relationship between wheel and source ... my understanding is that pip will not install source if there is a wheel package, and I also read that MANIFEST.in does not affect wheel. So, what's the solution for that? Not publish wheel at all? – Dima Jun 01 '21 at 18:37