My Project Tree Structure
.
├── example.gif
├── funmotd
│ ├── config.json
│ ├── __init__.py
│ └── quotes_db.py
├── LICENSE
├── README.md
└── setup.py
setup.py
(Removed some code in order to have less code)
import sys
import os
import setuptools
from setuptools.command.install import install
class PostInstall(install):
def run(self):
mode = 0o666
bashrc_file = os.path.join(os.path.expanduser('~'), ".bashrc")
install.run(self)
# Added CLI to .bashrc
# Change "config.json" file permission
setuptools.setup(
...
entry_points={'console_scripts': ['funmotd = funmotd:main']},
package_dir={'funmotd': 'funmotd/'},
package_data={'funmotd': ['config.json'], },
include_package_data=True,
python_requires=">=3.4",
cmdclass={'install': PostInstall, },
...
)
The PostInstall
is executing fine when I run python3 setup.py install
. So, uploaded to Pypi
like below(From this doc)
$ python3 setup.py bdist_wheel
# Created "dist", "funmotd.egg-info" and "build" dirs
$ twine upload dist/*
But when I run pip install funmotd
, PostInstall
is NOT executing, I see that dist/*
is like static compiled stuff.
Is there any trick to run post installation tasks when I run pip install funmotd
. Or how to make setup.py
execute at pip
.
I Followed below questions, didn't get solution what I need
PS: I don't want users to clone repo and run python setup.py install
. Want to make it simple pip install funmotd
UDPATE1
Seems there is already issue on github which is long thread