Skip to content

Instantly share code, notes, and snippets.

@hamelsmu
Created January 9, 2021 23:57
Show Gist options
  • Save hamelsmu/872e5c02d7053ef7d85c1b01ff8b669c to your computer and use it in GitHub Desktop.
Save hamelsmu/872e5c02d7053ef7d85c1b01ff8b669c to your computer and use it in GitHub Desktop.
Notes on working with Jeremy Howard to automate creation of files for Conda builds https://github.com/fastai/fastconda

Automating Conda Directory

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:

  1. 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
  2. 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
  3. In Meta.yaml
    1. Need to fill in the name and version (see the template variables and this will make sense)
    2. Need to fill in the requirements.run list of dependencies, which can be supplied via arguments from the user
    3. 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment