conda-forge / conda-forge/conda-forge.github.io
RFC: Remove `name` from recipe `context` in defaults and documentation
- Dominant language
- JavaScript
- Stars
- 170
- Forks
- 320
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
## Issue
At the moment (January, 2026) the recommendations from [the conda-forge documentation](https://github.com/conda-forge/conda-forge.github.io/blob/e445dfcd31f4dece3cbaa4304d57a3a270bb3a80/docs/maintainer/example_recipes/rust.md?plain=1#L9), the [`conda-forge/staged-recipe` examples](https://github.com/conda-forge/staged-recipes/blob/126db5b0011add103ab41dfc5d2d06a74c4a2f24/recipes/example-v1/recipe.yaml#L15), and [grayskull](https://github.com/conda/grayskull/tree/b6bf50331118abb14df16cfe203551c1f616842a) all show/produce recipes that contain the package name as a field in `context` (for the `v1` recipe format)
```yaml
context:
name: example
version: "1.2.3"
package:
name: ${{ name|lower }}
version: ${{ version }}
source:
url: https://github.com/org/${{ name }}/archive/refs/tags/v${{ version }}.tar.gz
...
```
or as [jinja variables for the `v0` recipe format](https://github.com/conda-forge/staged-recipes/blob/126db5b0011add103ab41dfc5d2d06a74c4a2f24/recipes/example/meta.yaml#L8)
```yaml
{% set name = "example" %}
{% set version = "1.2.3" %}
package:
name: ${{ name|lower }}
version: ${{ version }}
source:
url: https://github.com/org/${{ name }}/archive/refs/tags/v${{ version }}.tar.gz
```
such that it can be used as a variable in the recipe for substitution.
I assume (but lack the historical context) that the original motivation for this was to avoid repeating information throughout the recipe format, as in the case of a [recipe that gets its source from PyPI](https://github.com/conda-forge/staged-recipes/blob/126db5b0011add103ab41dfc5d2d06a74c4a2f24/recipes/example-v1/recipe.yaml#L14-L23)
```yaml
context:
name: simplejson
version: "3.8.2"
package:
name: ${{ name|lower }}
version: ${{ version }}
source:
url: https://pypi.org/packages/source/${{ name[0] }}/${{ name }}/${{ name }}-${{ version }}.tar.gz
...
```
In reality, if a maintainer is debugging and needs to download the source to get the digest, having to manually change the instances of `${{ name }}` in
```
curl -sL https://pypi.org/packages/source/${{ name[0] }}/${{ name }}/${{ name }}-${{ version }}.tar.gz | openssl sha256
```
is more of an annoyance than a help in regular recipe maintenance.
Use of `name` as a recipe variable for replacement purposes only has been seen [historically](https://conda-forge.zulipchat.com/#narrow/channel/457337-general/topic/.E2.9C.94.20Motivation.20for.20.60name.60.20field.20in.20.60context.60.20for.20recipes.3F/with/567023367) to create the misconception that like other recipe variables that `name` might change in the future. It cannot be changed without an admin request to change the feedstock output, and the new name must be checked for conflicts with existing conda-forge and bioconda packages. It would be better and more clear to avoid doing substitution through a `name` variable and have all examples and generated recipes produce the `name` in full.
This is a recommendation that multiple members of the `conda-forge/core` team are already making to contributed recipes in https://github.com/conda-forge/staged-recipes/, which is good, except that when contributors are following the documentation their "by the book" recipe is now at odds with experienced maintainers and this can cause confusion or frustration.
## Suggested changes
To address this, and importantly _reduce time and effort of conda-forge/core members_, it would be beneficial to:
* Remove the use of `name` as a variable in all examples in the conda-forge documentation, as well as in `conda-build` and `rattler-build`'s documentation.
- Note that this already is the case in `conda-build`'s ["Defining metadata (meta.yaml)" documentation](https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html)
* Remove the use of `name` as a variables in all examples in https://github.com/conda-forge/staged-recipes/.
- Done for Go and Rust recipe example in https://github.com/conda-forge/conda-forge.github.io/pull/2713
* Remove the generation of `name` as a variable in recipes created by `grayskull`.
* Remove `name` as a variable in any other part of documentation of the conda-forge ecosystem.
## References
* conda-forge Zulip topic: [#general > ✔ Motivation for `name` field in `context` for recipes?](https://conda-forge.zulipchat.com/#narrow/channel/457337-general/topic/.E2.9C.94.20Motivation.20for.20.60name.60.20field.20in.20.60context.60.20for.20recipes.3F/with/567023367)
---
cc @conda-forge/core
cc @danielnachun (who agreed to co-author this RFC with me): Please revise any and all of the text here as you see fit.
Contributor guide
Assessment
This issue has not been assessed yet.