Skip to content

Conversation

joshuarli
Copy link
Member

@joshuarli joshuarli commented Aug 21, 2025

This introduces uv, and also aligns this repository with these repo standards:
https://www.notion.so/sentry/Standard-Spec-devenv-2238b10e4b5d8072a992d8b67d94be22
https://www.notion.so/sentry/Standard-Spec-python-uv-2248b10e4b5d8045b8fff30f8b8b67ca
https://www.notion.so/sentry/Standard-Spec-pre-commit-2238b10e4b5d8019aa1fe1158e39c38e

The ability to run devenv sync and get a dev environment in any repo is the DX i'm aiming for,
and these standards provide a foundation from which later we can easily push updates to all repos.

You should be able to checkout this branch, run direnv allow and devenv sync (might be prompted to run ~/.local/share/sentry-devenv/bin/devenv update first), which will set up everything needed for development (except cargo).

make watch-rust-snuba will work the same as before, except now it works using uvx and rust_snuba as a workspace dep.

@joshuarli joshuarli mentioned this pull request Aug 21, 2025
@@ -6,54 +6,69 @@ exclude: >
)

repos:
- repo: https://github.com/psf/black
rev: 22.3.0
- repo: local
Copy link
Member Author

Choose a reason for hiding this comment

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

I've moved all these python tool hooks to local so that we have a single source of truth which is in the uv lockfile

@@ -41,31 +40,13 @@ tests: test
api-tests:
SNUBA_SETTINGS=test pytest -vv tests/*_api.py

backend-typing:
Copy link
Member Author

Choose a reason for hiding this comment

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

this and the previous backend typing ci job has been rolled up into pre-commit!

line_length = 100
lines_between_sections = 1

[tool.mypy]
Copy link
Member Author

Choose a reason for hiding this comment

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

i also took the liberty of combining the previous mypy.ini and backend-typing flags into here in an improved more compact format!

VERSION = "25.9.0.dev0"


def get_requirements() -> Sequence[str]:
Copy link
Member Author

Choose a reason for hiding this comment

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

afaict sdists and wheels are not being built for snuba so deleting this altogether

COPY ./rust_snuba/ ./rust_snuba/
COPY --from=build_rust_snuba_deps /usr/src/snuba/rust_snuba/target/ ./rust_snuba/target/
COPY --from=build_rust_snuba_deps /root/.cargo/ /root/.cargo/
RUN set -ex; \
cd ./rust_snuba/; \
rustup show active-toolchain || rustup toolchain install; \
Copy link
Member Author

Choose a reason for hiding this comment

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

this was being duplicated in build_rust_snuba_base so removed!

@@ -96,38 +106,26 @@ jobs:
run: |
make lint-rust format-rust-ci

typing:
Copy link
Member Author

Choose a reason for hiding this comment

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

as noted elsewhere this has been rolled up into pre-commit!

@joshuarli joshuarli marked this pull request as ready for review August 21, 2025 23:13
@joshuarli joshuarli requested review from a team as code owners August 21, 2025 23:13

- uses: getsentry/action-setup-venv@3a832a9604b3e1a4202ae559248f26867b467cc7 # v2.1.1
with:
python-version: 3.11.11
Copy link
Member

Choose a reason for hiding this comment

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

Can we read this value from .python-version so this stays in sync with that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@volokluev volokluev left a comment

Choose a reason for hiding this comment

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

Thanks Josh! Great work here!

@joshuarli joshuarli requested a review from a team September 3, 2025 18:56
@joshuarli joshuarli merged commit 64c5fa3 into master Sep 3, 2025
34 checks passed
@joshuarli joshuarli deleted the feat-uv branch September 3, 2025 20:14
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.

4 participants