diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dad0aca..05656dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,24 +32,24 @@ jobs: - name: Set up Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }} - name: Install the project - run: uv sync --all-extras --dev + run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/" - name: Run tests # For example, using `pytest` run: uv run just coverage - # - name: Upload Coverage to Codecov - # uses: codecov/codecov-action@v4 - # with: - # files: coverage.xml # optional - # fail_ci_if_error: true # optional (default = false) - # verbose: true # optional (default = false) - # token: ${{ secrets.CODECOV_TOKEN }} # required - # - name: Archive code coverage results - # if: matrix.python-version == '3.12' - # uses: actions/upload-artifact@v4 - # with: - # name: code-coverage-report - # path: coverage.xml - # retention-days: 2 + # - name: Upload Coverage to Codecov + # uses: codecov/codecov-action@v4 + # with: + # files: coverage.xml # optional + # fail_ci_if_error: true # optional (default = false) + # verbose: true # optional (default = false) + # token: ${{ secrets.CODECOV_TOKEN }} # required + # - name: Archive code coverage results + # if: matrix.python-version == '3.12' + # uses: actions/upload-artifact@v4 + # with: + # name: code-coverage-report + # path: coverage.xml + # retention-days: 2 # post: # runs-on: ubuntu-latest # needs: build diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml deleted file mode 100644 index c2a8a1d..0000000 --- a/.github/workflows/isort.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Run isort -on: - pull_request: - push: - branches: - - main -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: isort/isort-action@v1 - with: - sortPaths: "src" # only sort files in the src directory diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8b6e6b3..b4e0612 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,6 +9,13 @@ concurrency: cancel-in-progress: true jobs: + isort: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: isort/isort-action@v1 + with: + sortPaths: "src" # only sort files in the src directory ruff: runs-on: ubuntu-latest steps: @@ -19,3 +26,20 @@ jobs: steps: - uses: actions/checkout@v4 - uses: psf/black@stable + pyright: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + # Install a specific version of uv. + version: "0.6.14" + enable-cache: true + cache-dependency-glob: "uv.lock" + - name: Install the project + run: uv sync --all-extras --dev --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/kirin/simple/" --index="https://${{ secrets.JFROG_USER}}:${{ secrets.JFROG_TOKEN }}@quera.jfrog.io/artifactory/api/pypi/quera-pypi-algo/simple/" + - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH + - uses: jakebailey/pyright-action@v2 + with: + pylance-version: latest-release diff --git a/src/bloqade/geometry/dialects/grid/concrete.py b/src/bloqade/geometry/dialects/grid/concrete.py index 3363408..4346062 100644 --- a/src/bloqade/geometry/dialects/grid/concrete.py +++ b/src/bloqade/geometry/dialects/grid/concrete.py @@ -80,7 +80,7 @@ def shape( frame: Frame, stmt: stmts.Shape, ): - return (frame.get_typed(stmt.zone, Grid).shape,) + return (frame.get_casted(stmt.zone, Grid).shape,) @impl(stmts.Get) def get( @@ -89,9 +89,9 @@ def get( frame: Frame, stmt: stmts.Get, ): - idx = frame.get_typed(stmt.idx, tuple) + idx = frame.get_casted(stmt.idx, tuple) - return (frame.get_typed(stmt.zone, Grid).get(idx),) + return (frame.get_casted(stmt.zone, Grid).get(idx),) @impl(stmts.GetXPos) def get_x_pos( @@ -100,7 +100,7 @@ def get_x_pos( frame: Frame, stmt: stmts.GetXPos, ): - return (frame.get_typed(stmt.zone, Grid).x_positions,) + return (frame.get_casted(stmt.zone, Grid).x_positions,) @impl(stmts.GetYPos) def get_y_pos( @@ -109,7 +109,7 @@ def get_y_pos( frame: Frame, stmt: stmts.GetYPos, ): - return (frame.get_typed(stmt.zone, Grid).y_positions,) + return (frame.get_casted(stmt.zone, Grid).y_positions,) @impl(stmts.GetSubGrid) def get_view( @@ -118,10 +118,10 @@ def get_view( frame: Frame, stmt: stmts.GetSubGrid, ): - x_indices = frame.get_typed(stmt.x_indices, ilist.IList) - y_indices = frame.get_typed(stmt.y_indices, ilist.IList) + x_indices = frame.get_casted(stmt.x_indices, ilist.IList) + y_indices = frame.get_casted(stmt.y_indices, ilist.IList) - return (frame.get_typed(stmt.zone, Grid).get_view(x_indices, y_indices),) + return (frame.get_casted(stmt.zone, Grid).get_view(x_indices, y_indices),) @impl(stmts.GetXBounds) def get_x_bounds( @@ -130,7 +130,7 @@ def get_x_bounds( frame: Frame, stmt: stmts.GetXBounds, ): - return (frame.get_typed(stmt.zone, Grid).x_bounds(),) + return (frame.get_casted(stmt.zone, Grid).x_bounds(),) @impl(stmts.GetYBounds) def get_y_bounds( @@ -139,7 +139,7 @@ def get_y_bounds( frame: Frame, stmt: stmts.GetYBounds, ): - return (frame.get_typed(stmt.zone, Grid).y_bounds(),) + return (frame.get_casted(stmt.zone, Grid).y_bounds(),) @impl(stmts.Shift) def shift( @@ -148,9 +148,9 @@ def shift( frame: Frame, stmt: stmts.Shift, ): - grid = frame.get_typed(stmt.zone, Grid) - x_shift = frame.get_typed(stmt.x_shift, float) - y_shift = frame.get_typed(stmt.y_shift, float) + grid = frame.get_casted(stmt.zone, Grid) + x_shift = frame.get_casted(stmt.x_shift, float) + y_shift = frame.get_casted(stmt.y_shift, float) return (grid.shift(x_shift, y_shift),) @@ -161,9 +161,9 @@ def scale( frame: Frame, stmt: stmts.Scale, ): - grid = frame.get_typed(stmt.zone, Grid) - x_scale = frame.get_typed(stmt.x_scale, float) - y_scale = frame.get_typed(stmt.y_scale, float) + grid = frame.get_casted(stmt.zone, Grid) + x_scale = frame.get_casted(stmt.x_scale, float) + y_scale = frame.get_casted(stmt.y_scale, float) return (grid.scale(x_scale, y_scale),) @@ -174,10 +174,10 @@ def repeat( frame: Frame, stmt: stmts.Repeat, ): - grid = frame.get_typed(stmt.zone, Grid) - x_times = frame.get_typed(stmt.x_times, int) - y_times = frame.get_typed(stmt.y_times, int) - x_gap = frame.get_typed(stmt.x_gap, float) - y_gap = frame.get_typed(stmt.y_gap, float) + grid = frame.get_casted(stmt.zone, Grid) + x_times = frame.get_casted(stmt.x_times, int) + y_times = frame.get_casted(stmt.y_times, int) + x_gap = frame.get_casted(stmt.x_gap, float) + y_gap = frame.get_casted(stmt.y_gap, float) return (grid.repeat(x_times, y_times, x_gap, y_gap),)