-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: devenv #1778
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
Open
joshuarli
wants to merge
5
commits into
main
Choose a base branch
from
localdev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: devenv #1778
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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,16 @@ | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,38 @@ jobs: | |
| pre-commit: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-python@v4 | ||
| - 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: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6 | ||
| with: | ||
| version: '0.8.2' | ||
| # we just cache the venv-dir directly in action-setup-venv | ||
| enable-cache: false | ||
|
|
||
| - uses: getsentry/[email protected] | ||
| with: | ||
| python-version: '3.11' | ||
| - uses: pre-commit/[email protected] | ||
| cache-dependency-path: uv.lock | ||
| install-cmd: uv sync --frozen --active | ||
|
|
||
| - 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: pre-commit install-hooks | ||
|
|
||
| - name: Run pre-commit | ||
| run: | | ||
| jq '.[]' --raw-output <<< '${{steps.changes.outputs.all_files}}' | | ||
| # Run pre-commit to lint and format check files that were changed (but not deleted) | ||
| 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
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.13.3 |
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,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,26 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from devenv import constants | ||
| from devenv.lib import config | ||
| from devenv.lib import proc | ||
| from devenv.lib import 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(("uv", "sync", "--frozen", "--quiet")) | ||
|
|
||
| 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,27 @@ | ||
| [project] | ||
| name = "pypi" | ||
| version = "0.0.0" | ||
|
|
||
| [dependency-groups] | ||
| # Currently we're just doing this much to get `devenv sync` to be able to | ||
| # run tox and packaging for local python -m add_pkg. | ||
| # Not sure it would be worth the effort right now to move everything to pure pytest | ||
| # and run pytest on 3 different python versions in ci by swapping out .python-version. | ||
| # Tox remains the most ergonomic solution to test on multiple pythons. | ||
| dev = [ | ||
| "black>=22.10.0", | ||
| "flake8>=7.3.0", | ||
| "mypy>=1.18.2", | ||
| "packaging==21.3", | ||
| "pre-commit==4.2.0", | ||
| "pyupgrade>=3.19.1", | ||
| "sentry-devenv>=1.25.0", | ||
| "tox==3.25.1", | ||
| ] | ||
|
|
||
| [tool.uv] | ||
| environments = ["sys_platform == 'darwin' or sys_platform == 'linux'"] | ||
|
|
||
| [[tool.uv.index]] | ||
| url = "https://pypi.devinfra.sentry.io/simple" | ||
| default = true |
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 |
|---|---|---|
|
|
@@ -18,3 +18,6 @@ warn_unused_ignores = true | |
|
|
||
| [mypy-tests.*] | ||
| disallow_untyped_defs = false | ||
|
|
||
| [mypy-devenv.*] | ||
| follow_imports = skip | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo replace with https://github.com/getsentry/action-pre-commit, i'll do this on monday