AnswerDotAI / AnswerDotAI/nbdev
No configuration options for `meta.yml` used by `nbdev_conda`, immediate fix required.
- Lingua principale
- Jupyter Notebook
- Stelle
- 5.3k
- Fork
- 513
- Merge medio
- 2g 30m
- PR unite (30g)
- 8
Descrizione
## 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)
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in nbdev/release.py con _get_conda_meta, write_conda_meta e release_conda, quindi segui il modo in cui nbdev_conda genera meta.yml. Esamina il dizionario generato esistente e il workflow proposto per i file personalizzati; al termine dovrebbe esserci un modo documentato per personalizzare i metadati Conda senza perdere i valori aggiornati automaticamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- build-system, release
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100