← All tasks
pythonhuggingface/huggingface_hub #4422Not a task: already works

[Build] `huggingface_hub.templates` absent from setuptools `packages` configuration

envgap__huggingface__huggingface_hub-4422

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
f46d7d5043e93e4a33cf122382fdc36c937db252
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

huggingface/huggingface_hub #4422 · read the original issue
### Describe the bug

Building the package with setuptools produces a warning that `huggingface_hub.templates` is absent from the `packages` configuration:

```
Package 'huggingface_hub.templates' is absent from the `packages` configuration.
Python recognizes 'huggingface_hub.templates' as an importable package,
but it is absent from setuptools' `packages` configuration.
```

### Root cause

`src/huggingface_hub/templates/` is a directory containing `datasetcard_template.md` and `modelcard_template.md` but no `__init__.py`. `find_packages("src")` in `setup.py:114` only discovers packages with `__init__.py`, so `templates` is excluded. However, Python treats any directory as an importable namespace package, triggering the setuptools warning.

### Reproduction

```bash
python -m build --wheel --no-isolation
```

### Suggested fix

Either:
1. Switch to `find_namespace_packages("src")` which discovers namespace packages (directories without `__init__.py`), or
2. Add an empty `__init__.py` to `src/huggingface_hub/templates/`

Option 1 is the modern setuptools recommendation for projects that ship data directories alongside Python packages.

### Environment

- `huggingface_hub` main branch (commit `1e41293`)
- setuptools 80.x, Python 3.14
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]