Voltage Park migration -- set up workflows and pre-commit#39
Conversation
0a3b459 to
54649a3
Compare
1f36a79 to
ec4cb30
Compare
Steps 3 & 4: drop all 17 nvidia-*-cu12 packages (transitive from torch==2.8.0 cu126 build) and ~85 other transitive packages that uv resolves automatically. Direct dependencies only remain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| @@ -0,0 +1,39 @@ | |||
| name: Build | |||
There was a problem hiding this comment.
Have you tested this yet? I'm not sure this package will build on the standard GitHub runners (in fact, I'm pretty sure it won't, since there are CUDA requirements like torch-geometric, but I could be wrong). We want to do this kind of testing (I have a similar file for sampleworks waiting in the wings) but we need our own runners first. Moody has this in the works, and it should be ready next week AFAIK.
There was a problem hiding this comment.
build with the existing pyproject.toml actually ran fine? Technically the torch related packages can be installed with cpu kernels and the current tests don't seem to require gpu. But yes I am aware that the current workflow won't work for gpu explicit test. look forward to our own runner.
| - name: Run tests | ||
| env: | ||
| TEST_DATA_DIR: ${{ github.workspace }}/tests/test_files | ||
| run: uv run pytest |
There was a problem hiding this comment.
Might be good to make sure we have a certain test coverage too. Can be added later, if so please add an issue.
There was a problem hiding this comment.
addressed in build workflow
| run: uv sync --group dev | ||
|
|
||
| - name: Run mypy | ||
| run: uv run mypy src/ |
There was a problem hiding this comment.
You might look at astral's new ty package. It is really fast.
There was a problem hiding this comment.
wow this is fast. replacing mypy with ty now.
This PR changes the `tests` to prepare for PR #39 that sets up build workflow and helps clean up dependencies. Changes are minimal. Functionally, the main change is replacing a hard-coded data file path with a relative one. This involves moving the `test_files` folder inside `test`. A `conftest.py` script is added to reduce some boiler plates on fixture.
Small PR that adds graph creation constants to `constants.py` and makes changes to `utils.py` to use those constants (as well slightly improving the tqdm logging utility function. Also makes formatting changes to util plotting functions. Style changes (organizing import order) should be addressed after merging PR #39 and #45 where pre-commit hooks run to check and fix these things (address issue #27 ).
|
@vratins can you take a look (mostly at the pre-commit hook and lint.yml)? If you run other kinds of lint/format and type checks or have specific configurations feel free to edit (and update dependencies as needed in your README PR) |
vratins
left a comment
There was a problem hiding this comment.
It LGTM, there are dependencies missing in the documentation/READme PR toml file (like ruff), I'll change that. Also I use mypy and not ty but I can update to ty.
There was a problem hiding this comment.
Pull request overview
This PR adds CI infrastructure and pre-commit configuration to support migration of the repo to Voltage Park and future collaborative development. It addresses Issue #27 (add pre-commit checks) and adds GitHub Actions workflows for linting/type-checking and building/testing.
Changes:
- Added
.pre-commit-config.yamlwith hooks forruff(linting + formatting) andty(type checking) - Added
.github/workflows/lint.ymlto run ruff auto-fixes andtytype checking on push/PR to main - Added
.github/workflows/build.ymlto run pytest with coverage (currently only triggered manually viaworkflow_dispatch)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
.pre-commit-config.yaml |
Configures ruff and ty pre-commit hooks for local developer use |
.github/workflows/lint.yml |
CI workflow: auto-fix and commit ruff formatting, then run ty type checker |
.github/workflows/build.yml |
CI workflow: run pytest with coverage (currently disabled for push/PR triggers) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: ty check | ||
| # Use uv if replacing mypy with ty in dev dependency group | ||
| entry: uvx ty check | ||
| language: python No newline at end of file |
There was a problem hiding this comment.
The pre-commit hook for ty is missing the pass_filenames: false setting. By default, pre-commit passes the list of changed files as arguments to the entry command. Since uvx ty check is designed to check a whole project rather than individual files, having filenames passed as arguments may cause unexpected behavior or errors. Adding pass_filenames: false ensures the command is invoked without file arguments, letting ty check the full project context.
| language: python | |
| language: python | |
| pass_filenames: false |
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.head_ref }} |
There was a problem hiding this comment.
The github.head_ref context variable is only populated for pull_request events, not for push events. Since this workflow triggers on both push and pull_request (lines 4–7), when a push to main occurs, github.head_ref will be an empty string. Passing an empty string as the ref parameter to actions/checkout may cause unexpected behavior (checking out an empty ref or failing). Consider using a conditional such as ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} to handle both trigger types correctly.
| ref: ${{ github.head_ref }} | |
| ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} |
| with: | ||
| commit_message: "Auto-commit ruff fixes [skip ci]" | ||
| commit_username: "Autoformatter" | ||
| commit_email: "Autoformatter <actions@github.com>" |
There was a problem hiding this comment.
The commit_email field for stefanzweifel/git-auto-commit-action expects a plain email address, not a "Name " formatted string. Passing "Autoformatter <actions@github.com>" in this field will likely result in a malformed git commit with an invalid email. The commit_username field should hold the name (which is already correctly set on line 33), and commit_email should hold only the email address (e.g., "actions@github.com").
| commit_email: "Autoformatter <actions@github.com>" | |
| commit_email: "actions@github.com" |
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| version: "0.10.6" | ||
| python: ${{ matrix.python-version }} |
There was a problem hiding this comment.
The astral-sh/setup-uv action uses python-version as the input parameter name for specifying the Python version, not python. Using the incorrect parameter name means the Python version will not be set, and the action will use its default. This same issue exists in lint.yml line 46. Please rename python to python-version in both workflow files.
| python: ${{ matrix.python-version }} | |
| python-version: ${{ matrix.python-version }} |
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| version: "0.10.6" | ||
| python: "3.12" |
There was a problem hiding this comment.
Same as build.yml: the astral-sh/setup-uv action uses python-version as the input parameter name, not python. The Python version specified here will be silently ignored, and the action will use its default Python version instead.
| python: "3.12" | |
| python-version: "3.12" |
| # push: | ||
| # branches: [main] | ||
| # pull_request: | ||
| # branches: [main] | ||
| workflow_dispatch: |
There was a problem hiding this comment.
The push and pull_request triggers for the Build workflow are commented out, meaning this workflow is only triggered manually via workflow_dispatch. The PR description explicitly states the goal is to "force all pushes and PR on the main branch to pass the pytests." With the current configuration, the build/test step will never run automatically on pushes or pull requests. The trigger section should be uncommented to achieve the stated goal.
This PR is intended for auxiliary changes to facilitate migration the repo development to Voltage Park and future collaborative development. Changes should not interfere with parallel work on ESM embedding.
Issues I would like to address include:
Clean up dependencies, once we have a working pytest and build workflow. This addresses issue Clean up dependencies in pyproject.toml #26This is already covered in PR README.md updated with instructions to run code, cleaning up toml file #45