-
-
Notifications
You must be signed in to change notification settings - Fork 60
feat: devenv, uv, pre-commit #1770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d44454a
init
joshuarli 503daa7
getsentry/action-setup-venv
joshuarli d08cbec
rustfmt in pre-commit
joshuarli b330f6e
Revert "rustfmt in pre-commit"
joshuarli b309746
py 3.13.5
joshuarli 21060e9
no rustfmt
joshuarli af517c6
[skip ci] prep for internal pypi
joshuarli bfe732b
resync
joshuarli bd8328b
Merge remote-tracking branch 'origin' into feat-devenv-pre-commit-dev…
joshuarli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/not/executable/bash | ||
|
|
||
| if [[ -f "${PWD}/.env" ]]; then | ||
| dotenv | ||
| fi | ||
|
|
||
| PATH_add "${HOME}/.local/share/sentry-devenv/bin" | ||
|
|
||
| if ! command -v devenv >/dev/null; then | ||
| echo "install devenv: https://github.com/getsentry/devenv#install" | ||
| return 1 | ||
| fi | ||
|
|
||
| PATH_add "${PWD}/.devenv/bin" | ||
|
|
||
| export VIRTUAL_ENV="${PWD}/.venv" | ||
| PATH_add "${PWD}/.venv/bin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: pre-commit | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
|
|
||
| # Cancel in progress workflows on pull_requests. | ||
| # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| # the default default is: | ||
| # bash --noprofile --norc -eo pipefail {0} | ||
| shell: bash --noprofile --norc -eo pipefail -ux {0} | ||
|
|
||
| jobs: | ||
| pre-commit: | ||
| name: pre-commit | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Get changed files | ||
| id: changes | ||
| uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0 | ||
| with: | ||
| list-files: json | ||
| filters: | | ||
| all: | ||
| - added|modified: '**/*' | ||
|
|
||
| - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 | ||
|
|
||
| - uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6 | ||
| with: | ||
| version: '0.8.2' | ||
|
|
||
| - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
| with: | ||
| path: ~/.cache/pre-commit | ||
| key: cache-epoch-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }} | ||
|
|
||
| - name: Install pre-commit | ||
| run: | | ||
| uv export --only-dev --no-hashes --no-annotate --no-header | grep 'pre-commit' | sed -E 's/ ;.*//' | xargs uv pip install | ||
| pre-commit install-hooks | ||
|
|
||
| - name: Run pre-commit | ||
| run: | | ||
| jq '.[]' --raw-output <<< '${{steps.changes.outputs.all_files}}' | | ||
| xargs pre-commit run --files | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: check-case-conflict | ||
| - id: check-executables-have-shebangs | ||
| - id: check-merge-conflict | ||
| - id: check-symlinks | ||
| - id: end-of-file-fixer | ||
| exclude_types: [svg] | ||
| - id: trailing-whitespace | ||
| exclude_types: [svg] | ||
| - id: check-added-large-files | ||
| args: ['--maxkb=1024'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.11.11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [devenv] | ||
| minimum_version = 1.22.1 | ||
|
|
||
| [uv] | ||
| darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-apple-darwin.tar.gz | ||
| darwin_arm64_sha256 = 954d24634d5f37fa26c7af75eb79893d11623fc81b4de4b82d60d1ade4bfca22 | ||
| darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-apple-darwin.tar.gz | ||
| darwin_x86_64_sha256 = ae755df53c8c2c1f3dfbee6e3d2e00be0dfbc9c9b4bdffdb040b96f43678b7ce | ||
| linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-unknown-linux-gnu.tar.gz | ||
| linux_arm64_sha256 = 27da35ef54e9131c2e305de67dd59a07c19257882c6b1f3cf4d8d5fbb8eaf4ca | ||
| linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-unknown-linux-gnu.tar.gz | ||
| linux_x86_64_sha256 = 6dcb28a541868a455aefb2e8d4a1283dd6bf888605a2db710f0530cec888b0ad | ||
| # used for autoupdate | ||
| version = 0.8.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| from devenv import constants | ||
| from devenv.lib import config, proc, uv | ||
|
|
||
|
|
||
| def main(context: dict[str, str]) -> int: | ||
| reporoot = context["reporoot"] | ||
| cfg = config.get_repo(reporoot) | ||
|
|
||
| uv.install( | ||
| cfg["uv"]["version"], | ||
| cfg["uv"][constants.SYSTEM_MACHINE], | ||
| cfg["uv"][f"{constants.SYSTEM_MACHINE}_sha256"], | ||
| reporoot, | ||
| ) | ||
|
|
||
| print("syncing .venv ...") | ||
| proc.run( | ||
| (f"{reporoot}/.devenv/bin/uv", "sync", "--frozen", "--quiet", "--active"), | ||
| ) | ||
|
|
||
| print("installing pre-commit hooks ...") | ||
| proc.run((f"{reporoot}/.venv/bin/pre-commit", "install", "--install-hooks")) | ||
|
|
||
| return 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| [project] | ||
| name = "symbolicator" | ||
| # we only have this here to make uv happy | ||
| # we use uv for dependency management, not packaging | ||
| version = "0.0.0" | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "devservices>=1.2.1", | ||
| "mkdocs>=1.6.1", | ||
| "mkdocs-material>=9.6.17", | ||
| "pre-commit>=4.3.0", | ||
| "pygments>=2.19.2", | ||
| ] | ||
|
|
||
| [tool.uv] | ||
| environments = ["sys_platform == 'darwin' or sys_platform == 'linux'"] | ||
|
|
||
| # TODO pypi deps | ||
joshuarli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #[[tool.uv.index]] | ||
| #url = "https://pypi.devinfra.sentry.io/simple" | ||
| #default = true | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.