Automate creation of conda build assets
hamelsmu opened this issue · comments
Problem: Conda builds require a directory with files:
Example: https://github.com/fastai/fastconda/tree/master/opencv-python-headless
- build.bat
- meata.yaml
- build.sh
You don't have to understand anything about these files, except that these are basically boilerplate with a few variables of things that need to be changed:
- bld.bat: example in this file https://github.com/fastai/fastconda/blob/master/opencv-python-headless/bld.bat you need to replace package name with a variable that is the package name
- build.sh also just need to replace the package name, however this one can be done via an environment variable called PKG_NM But Jeremy will change this detail. Reference: https://docs.conda.io/projects/conda-build/en/latest/user-guide/environment-variables.html#id2
- In Meta.yaml
- Need to fill in the name and version (see the template variables and this will make sense)
- Need to fill in the requirements.run list of dependencies, which can be supplied via arguments from the user
- Need to fill in the test.imports. section with an import name, which can be different than the package name (example: opencv-python-headless vs cv2) -- investigate this to see if you can get the import name automatically somehow or if it needs to be supplied by the user.
Approach: look at fastrelase
- pypi_details
- update_meta
- write_pip_conda_meta for an example of how to create yaml files
Things I'm not 100% sure about but will investigate:
- Can I get the import name automatically ex: cv2 vs opencv-python-headless
- Does the file that I materialize need to to be meta.yaml not meta.yaml.tmpl correct? I assume that meta.yaml.tmpl is an intermediate file that is processed outside of conda build but maybe conda build is providing direct support for templating?
@jph00 please review LMK if I'm missing anything.
In Meta.yaml
You're missing the other stuff that comes from the pypi metadata, such as author, description, and license. There's already fastrelease.conda.write_pip_conda_meta
that can create meta.yaml from pypi metadata so you should be able to borrow from (or use) that.
Can I get the import name automatically ex: cv2 vs opencv-python-headless
No, that should be passed as an argument to the function
Does the file that I materialize need to to be meta.yaml not meta.yaml.tmpl correct
Correct. Ignore the current use of a tmpl
file - that's just a short-term thing to get an initial version working.
I've changed bld.bat
and build.sh
to use the env var now.