Skip to content

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

Description

@msyyc

Description

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

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:

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.

Metadata

Metadata

Labels

bugSomething isn't workingemitter:client:pythonIssue for the Python client emitter: @typespec/http-client-python

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions