I'm working on a Python CLI application that deals with climate data, using conda as a package manager.
To run the tool locally, I create and activate a conda environment (conda env create --file environment.yaml
then conda activate mycli
), install the app (pip install .
), then run it with mycli --version
.
I'd like to share this tool with colleagues. I'm trying to use conda constructor to create an installer for the tool and its dependencies. At the moment, when running constructor .
, the result only installs the dependencies, with no trace of my app.
How do I tell constructor to include my Python app? Specifically, how do I make sure my CLI entrypoint is added to the installed bin
directory by the constructor installer?
I've set up a stripped-down version of the repo here: conda-constructor-python-demo. I've pasted some key files below.
Some caveats:
- I need to use conda as some dependencies (namely esmpy) are only available in conda-fe.
- There may be a better way of packaging this project, but I've tried everything I can see out there (PyInstaller, Homebrew, conda-pack), and I've not had any lucky with any of them. Conda constructor seems like the most promising solution.
constructor.yaml
name: MyCli
version: "0.0.1"
channels:
- /
installer_type: pkg
specs:
- python=3.13
- pip
- typer
- numpy
- xcdat
- xesmf
environment.yaml
name: MyCli
version: "0.0.1"
channels:
- /
installer_type: pkg
environment_file: "./environment.yaml"
pyproject.yaml
[project]
name = "my-cli"
version = "0.0.1"
[project.scripts]
mycli = "mycli.cli:app"