duncanhall
duncanhall

Reputation: 11431

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?

Upvotes: 1

Views: 1625

Answers (2)

Stephan Hahn
Stephan Hahn

Reputation: 11

and by using pip install --editable . in your dev folder?

You will have your package installed in editable mode, and continue to develop without having to reinstall all.

Upvotes: 1

duncanhall
duncanhall

Reputation: 11431

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.

Upvotes: 1

Related Questions