Skip to content

fix(py): drop unused pydantic[email] extra and runtime type stubs from dotpromptz - #635

Open
huangjeff5 wants to merge 1 commit into
google:mainfrom
huangjeff5:py/trim-dotpromptz-deps
Open

huangjeff5 wants to merge 1 commit into
google:mainfrom
huangjeff5:py/trim-dotpromptz-deps

Conversation

@huangjeff5

Copy link
Copy Markdown
Collaborator

Trims the dotpromptz runtime dependency set. Motivated by reducing the genkit Python install footprint, which pulls dotpromptz transitively.

Main Changes

  • Drop pydantic[email] extra: Previously dotpromptz depended on pydantic[email], which pulled email-validator and dnspython (~1.5 MB) into every install. We depend on plain pydantic because nothing in python/dotpromptz/src uses EmailStr, NameEmail, or email_validator.
  • Move type stubs out of runtime deps: Previously types-aiofiles and types-pyyaml were runtime dependencies, so they were installed into every user's environment. We moved types-aiofiles into the workspace dev group next to the existing types-pyyaml, ty, and pyrefly, because stub packages are only read by type checkers. Also dropped them from the dotpromptz Bazel py_library deps; they stay resolvable via requirements.txt.

Measured install footprint

Clean uv venv on Python 3.12, uv pip install python/handlebars python/dotpromptz:

  • Before (main): 21 packages, 13 MB site-packages (13164 KB)
  • After: 17 packages, 11 MB site-packages (11400 KB)
  • Removed: email-validator, dnspython, types-aiofiles, types-pyyaml (1764 KB)

Verification

  • uv lock --check and scripts/export_requirements produce no diff
  • ruff format --check --preview, ruff check --select I, ty check, pyrefly check: pass
  • pytest in python/: 835 passed, 1 skipped
  • scripts/build_dists and scripts/run_python_security_checks: pass

…m dotpromptz

pydantic[email] pulled email-validator and dnspython into every install
even though dotpromptz never uses EmailStr or NameEmail. types-aiofiles
and types-pyyaml are type-checker-only stubs; move them to the workspace
dev group next to the other type-checking tools.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the email extra from the pydantic dependency in the dotpromptz package, resulting in the removal of dnspython and email-validator from the project's dependencies. It also moves the static type stubs types-aiofiles and types-pyyaml from the runtime dependencies of dotpromptz to the development dependencies of the Python workspace. There are no review comments to evaluate, and I have no feedback to provide.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant