fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.8k stars 484 forks source link

No configuration options for `meta.yml` used by `nbdev_conda`, immediate fix required. #1387

Open dsm-72 opened 7 months ago

dsm-72 commented 7 months ago

Crux of the issue

In nbdev.release._get_conda_meta lines 220-233 we have the following:

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

'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).

Proposed solutions

Resources and References

Some key functions inside nbdev can be found here: