Apr-06-2019, 12:31 AM
I'm trying to package my single-file tool with a README.md file for pip. I've tried couple of ways but failed. Here is one of them.
The file structure is very simple:
pytreelog/
|- README.md
|- pytreelog.py
I suppose the following would have worked (added 3 files: ):
pytreelog/
|- README.md
|- pytreelog.py
|
|- __init__.py
|- setup.py
|- MANIFEST.in
Where:
__init__.py:
name = "pytreelog"
MANIFEST.in:
include README.md
setup.py:
...pytreelog> python setup.py sdist bdist_wheel
The new folder structure (dist/* are displayed):
pytreelog/
|- README.md
|- pytreelog.py
|
|- __init__.py
|- setup.py
|- MANIFEST.in
|
|- build/
|- dist/
| -- pytreelog-runsun-20190405.post6.tar.gz
| -- pytreelog_runsun-20190405.post6-py3-none-any.whl
|- pytreelog_runsun.egg-info/
Then I switch to dist/ and run this:
...pytreelog\dist> pip install pytreelog_runsun-20190405.post6-py3-none-any.whl
The console responded saying it's successfully installed. So now I have my lib in the /site-packages:
C:/python37/Lib/site-packages/
| ...
|- pytreelog_runsun-20190405.post6.dist-info/
|- pytreelog.py
The pytreelog.py is there (as a stand-alone file) but, where is my README.md? How can I get it installed with my lib?
The file structure is very simple:
pytreelog/
|- README.md
|- pytreelog.py
I suppose the following would have worked (added 3 files: ):
pytreelog/
|- README.md
|- pytreelog.py
|
|- __init__.py
|- setup.py
|- MANIFEST.in
Where:
__init__.py:
name = "pytreelog"
MANIFEST.in:
include README.md
setup.py:
#!/usr/bin/env python from setuptools import setup, find_packages setup(name='pytreelog-runsun', version='20190405.post6', description='Tree-like logging util for python', author='runsun', author_email= <my email>, url= <the url>, packages=find_packages(), py_modules = ["pytreelog"], include_package_data=True, # Need this to include README.md in the pacakge classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] )Then I run this:
...pytreelog> python setup.py sdist bdist_wheel
The new folder structure (dist/* are displayed):
pytreelog/
|- README.md
|- pytreelog.py
|
|- __init__.py
|- setup.py
|- MANIFEST.in
|
|- build/
|- dist/
| -- pytreelog-runsun-20190405.post6.tar.gz
| -- pytreelog_runsun-20190405.post6-py3-none-any.whl
|- pytreelog_runsun.egg-info/
Then I switch to dist/ and run this:
...pytreelog\dist> pip install pytreelog_runsun-20190405.post6-py3-none-any.whl
The console responded saying it's successfully installed. So now I have my lib in the /site-packages:
C:/python37/Lib/site-packages/
| ...
|- pytreelog_runsun-20190405.post6.dist-info/
|- pytreelog.py
The pytreelog.py is there (as a stand-alone file) but, where is my README.md? How can I get it installed with my lib?