Skip to content

Commit

Permalink
ref: size-optimize the relay python library
Browse files Browse the repository at this point in the history
on linux this reduces the installed library size from 240MB to 14MB
  • Loading branch information
asottile-sentry committed May 16, 2024
1 parent db7bbf5 commit 9116167
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ debug = false
# panic and error stack traces to Sentry.
debug = true

[profile.release-cabi]
inherits = "release"
lto = true
debug = false
strip = true

[workspace.lints.clippy]
dbg_macro = "warn"

Expand Down
1 change: 1 addition & 0 deletions py/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Remove publishing of x86 wheels. [#3596](https://github.com/getsentry/relay/pull/3596)
- Require minimum macos 14.x for wheels [#3611](https://github.com/getsentry/relay/pull/3611)
- Significantly reduce size of published wheels [#3610](https://github.com/getsentry/relay/pull/3610)

## 0.8.64

Expand Down
4 changes: 2 additions & 2 deletions py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def run(self):
def build_native(spec):
cmd = ["cargo", "build", "-p", "relay-cabi"]
if not DEBUG_BUILD:
cmd.append("--release")
target = "release"
cmd.extend(("--profile", "release-cabi"))
target = "release-cabi"
else:
target = "debug"

Expand Down
2 changes: 1 addition & 1 deletion scripts/docker-manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ docker run \
-e $TARGET_LINKER \
-e CARGO_BUILD_TARGET \
${BUILDER_NAME} \
bash -c 'cargo build -p relay-cabi --release'
bash -c 'cargo build -p relay-cabi --profile release-cabi'

# create a wheel for the correct architecture
docker run \
Expand Down

0 comments on commit 9116167

Please sign in to comment.