pythoncommand-line-interfacepython-wheeldocopt

Test python cli wheel package during local development


I'm developing a CLI tool in python using docopt and packaging via wheels.

I can build and install the wheel package locally with the following:

python setup.py sdist bdist_wheel
pip install dist/mypackage.whl

I can then test my package from the command line

mypackage --v

This works fine, but does not provided a very practical dev / test loop. In order to view any changes I need to uninstall the package, rebuild it and reinstall it.

Is there a more practical way to easily test and run changes locally during development?


Solution

  • Failing any better solution I have simply combined uninstall, build and install into a make task:

    reload:
        pip uninstall -y mypkg && python setup.py sdist bdist_wheel && pip install dist/mypkg.whl
    

    Now simply running make reload will achieve what I need.