AnswerDotAI / AnswerDotAI/nbdev
No configuration options for `meta.yml` used by `nbdev_conda`, immediate fix required.
- Dominant language
- Jupyter Notebook
- Stars
- 5.3k
- Forks
- 513
- Avg merge
- 2d 30m
- Merged PRs (30d)
- 8
Description
## Crux of the issue
In [`nbdev.release._get_conda_meta`](https://github.com/fastai/nbdev/blob/master/nbdev/release.py#L196-L234)
lines [`220-233`](https://github.com/fastai/nbdev/blob/master/nbdev/release.py#L220-L233) we have the following:
```python
d2 = {
'build': {'number': '0', 'noarch': 'python',
'script': '{{ PYTHON }} -m pip install . -vv'},
'requirements': {'host':hostreqs, 'run':reqs},
'test': {'imports': [cfg.lib_path.name]},
'about': {
'license': 'Apache Software',
'license_family': 'APACHE',
'home': dev_url, 'doc_url': doc_url, 'dev_url': dev_url,
'summary': cfg.get('description'),
'description': descr
},
'extra': {'recipe-maintainers': [cfg.get('user')]}
}
```
This stands in stark contrast to other `nbdev` autogenerated documents and files which allow for the user to edit them without overwriting their edits (e.g. in `__init__.py` files of your package.
## Why is this a problem?
[Line 224](https://github.com/fastai/nbdev/blob/master/nbdev/release.py#L224C9-L224C50)
```python
'test': {'imports': [cfg.lib_path.name]},
```
If for whatever reason, whatsoever Conda's test environment can not make your package run (even if it passes conda verify locally), your release with `nbdev` will fail and all of your configuration options required to make the test pass are locked out. Of course you can make your own `meta.yml` file and build it independently, but the point is that this line makes `nbdev_conda` a very frustrating API.
While commenting out the `test` section may be in poor form, looking through the official `conda-archive/conda-recipes` one can find no shortage or examples just commenting out the `test` section (e.g. this [one](https://github.com/conda-archive/conda-recipes/blob/main/bedtools/meta.yaml#L5-L7)).
## Proposed solutions
- immediate fix: add a `--meta` argument to `nbdev_conda` that lets users point to a custom `meta.yml` file.
- short term: have that file serve as a template i.e. merge dictionary keys, so that way things like "version" still get updated automatically
- long term: make `meta.yml` consistent with other autogenerated docs.
## Resources and References
Some key functions inside `nbdev` can be found here:
- [`release_conda(...)`](https://github.com/fastai/nbdev/blob/master/nbdev/release.py#L262-L289)
- [`write_conda_meta(path='conda')`](https://github.com/fastai/nbdev/blob/master/nbdev/release.py#L237-L239)
- [`_get_conda_meta()`](https://github.com/fastai/nbdev/blob/master/nbdev/release.py#L196-L234)
Contributor guide
Research direction
Start in nbdev/release.py with _get_conda_meta, write_conda_meta, and release_conda, then trace how nbdev_conda generates meta.yml. Review the existing generated dictionary and the proposed custom-file workflow; done should provide a documented way to customize Conda metadata without losing automatically updated values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, release
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100