I have created a simple python3.7.1
command-line application using click
in a conda
virtual env that works fine when running as a module python -m
.
End-goal:
To create a single command (binary) executable that can be shipped to somewhere on the filesystem that is preferably not dependent on a python/conda virtual environment.
Note that this question is likely closely tied to my complete lack of understanding of setuptools
(I have read through the docs).
Project structure:
python_clean_repo/
├── README.md
├── conda-environment.yaml
├── setup.py
├── tests
│ └── test_basic.py
└── yourpackage
├── configs
│ ├── app_config.yaml
│ └── config.py
├── main.py
└── scripts
└── cmdline.py
When run with the -m
option, everything works as expected:
$ python -m yourpackage.scripts.cmdline
Hello World!
here i am in main
config is {'key': 'value'}
The packaging appears to complete successfully:
$ pip install -e .
...
Successfully installed python-clean-repo
So I now have an executable in my virtual env called yourscript
(which is the name of the entrypoint provided in setup.py
) which works exactly as I would expect:
$ yourscript
Hello World!
here i am in main
config is {'key': 'value'}
The question is:
How do I "ship" this executable, that now appears directly tied to my virtual environment? I have also tried python setup.py sdist
but for some reason the created tar.gz does not contain everything (there are no included .py
modules, just a bunch of .txt
files such as entry_points.txt
and requires.txt