microsoft / microsoft/typespec

[http-client-python] Remove setuptools warnings for pygen template directories

Open
#11,604 1 comment 1 reaction 1 assignee Claimed by @msyyc View on GitHub
bug emitter:client:python
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

## Description

Building `@typespec/http-client-python` with current setuptools reports warnings that the data-only template directories are absent from the package configuration:

```text
Package 'pygen.codegen.templates' is absent from the `packages` configuration.
Package 'pygen.codegen.templates.packaging_templates' is absent from the `packages` configuration.
```

`generator/setup.py` uses `find_packages()` with `include_package_data=True`, while `generator/MANIFEST.in` recursively includes the Jinja templates. Since the template directories do not contain `__init__.py`, `find_packages()` does not discover them, but recent setuptools versions treat them as importable packages and warn about the ambiguous configuration.

## Reproduction

From `packages/http-client-python`:

```shell
npm run build
```

The warnings are emitted while building the pygen wheel.

## Current behavior

The wheel currently appears complete: `pygen-0.1.0-py3-none-any.whl` contains all 44 `.jinja2` template files, including the seven files under `pygen/codegen/templates/packaging_templates`. This is therefore a packaging-configuration warning rather than a known missing-artifact bug.

## Expected behavior

The pygen package configuration should explicitly and unambiguously include its template data, and building the wheel should not emit the missing-package warnings.

## Acceptance criteria

- Building the pygen wheel does not report that `pygen.codegen.templates` or `pygen.codegen.templates.packaging_templates` is absent from the package configuration.
- All existing Jinja templates remain present in the built wheel.
- `jinja2.PackageLoader("pygen.codegen", "templates")` and the packaging-template loader continue to work from an installed wheel.
- Add or update a packaging test that verifies the required template files are included in the wheel.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.