python - Can I get pip to delete scripts that I installed but no longer want? -
say have following project:
confectionary/ __init__.py confections.py scripts/ crunchy_frog.py anthrax_ripple.py spring_surprise.py and has been installed users, can type
$ spring_surprise.py and have stainless steel bolts spring out of computer, piercing both cheeks.
however, constable parrot has convinced me move more conventional areas of confectionary, no longer offer such sweetmeats. have changed scripts this:
scripts/ praline.py lime_coconut.py yet, when install newer version, old scripts stay around.
is possible specify somehow in setup.py no longer want these old scripts when application upgraded?
the correct way via setuptools. delightful click library has great example.
rather having scripts directory, combine information in application somewhere, confections.py should contain this:
def crunchy_frog(): '''only freshest killed frogs... ''' # todo: implement def anthrax_ripple(): '''a delightful blend of anthrax spores... ''' # todo: implement def spring_surprise(): '''deploy stainless steel bolts, piercing both cheeks''' # todo: implement then in setup.py:
from setuptools import setup setup( name='confectionary', version='1.0.0', py_modules=['confectionary'], entry_points=''' [console_scripts] crunchy_frog=confectionary.confections:crunchy_frog anthrax_ripple=confectionary.confections:anthrax_ripple spring_surprise=confectionary.confections:spring_surprise ''', ) and when change up, you'll change confections.py appropriately, can change setup.py:
from setuptools import setup setup( name='confectionary', version='2.0.0', py_modules=['confectionary'], entry_points=''' [console_scripts] praline=confectionary.confections:praline lime_coconut=confectionary.confections:lime_coconut ''', ) now happy! , added bonus, you'll find setuptools create appropriate files on windows well.
delicious!
Comments
Post a Comment