Skip to content

chore(layer): drop C sources and type stubs from all packages - #902

Merged
purple4reina merged 1 commit into
mainfrom
dilly/layer-strip-sources-stubs
Dec 4, 2026
Merged

purple4reina merged 1 commit into
mainfrom
dilly/layer-strip-sources-stubs

Conversation

@astuyve

@astuyve astuyve commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Runs the C/C++/Cython source and .pyi cleanup over all of site-packages instead of only ddtrace/, adds *.pxd, merges the seven find layers into one, and removes the directories it leaves empty.

Motivation

Other packages in the layer ship build sources and type stubs that nothing imports at runtime:

file size
wrapt/_wrappers.c 150 kB
wrapt-stubs/__init__.pyi 30 kB
ujson-stubs/__init__.pyi 1.6 kB

Results (Python 3.15, amd64)

ddtrace main this PR
PyPI 4.17.2 (published layer) 25,202 kB 25,021 kB (−181 kB)
dd-trace-py main pipeline 157654945 (ddtrace_serverless 4.18.0rc1) 25,466 kB 25,285 kB (−181 kB)

Together with #901, the dd-trace-py main build goes from 25,466 kB to 24,565 kB (−901 kB).

Testing Guidelines

  • Built both variants locally with ./scripts/build_layers.sh and ran check_layer_size.sh (numbers above).
  • Smoke-tested in public.ecr.aws/sam/build-python3.15:1: wrapt's C extension still loads, integrations patch, and datadog_lambda.handler emits aws.lambda and sqlite.query spans.

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

🤖 Generated with Claude Code

The source and .pyi cleanup only ran under ddtrace/. Other packages ship
them too: wrapt/_wrappers.c (~150 kB), wrapt-stubs and ujson-stubs (~32 kB).
None are imported at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@astuyve
astuyve requested review from a team as code owners December 4, 2026 01:34
@astuyve
astuyve requested a review from lym953 December 4, 2026 01:34

@datadog-datadog-us1-prod datadog-datadog-us1-prod 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.

Bits Code Review: PASS

More details

The deletion patterns preserve runtime Python modules and native shared libraries. Static review identified no actionable defect; layer builds and runtime smoke tests were not independently rerun.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 4c21337

@purple4reina
purple4reina merged commit 734f790 into main Dec 4, 2026
120 checks passed
@purple4reina
purple4reina deleted the dilly/layer-strip-sources-stubs branch December 4, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants