Skip to content

Commit

Permalink
fully embrace uv
Browse files Browse the repository at this point in the history
  • Loading branch information
karmacoma-eth committed Dec 4, 2024
1 parent 86c2553 commit 67fb3db
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 33 deletions.
3 changes: 1 addition & 2 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .
python -m pip install -r requirements-dev.txt
python -m pip install -e .[dev]
pre-commit install
pre-commit run --all-files

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ jobs:
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
# Install a specific version of uv.
version: "0.5.6"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- name: Set up python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install halmos
run: python -m pip install -e .
- name: Install halmos and its dependencies
run: |
uv sync --extra dev
- name: Run pytest
run: pytest -v -k "not long and not ffi" --ignore=tests/lib --halmos-options="-st --disable-gc --solver-threads 1 --storage-layout ${{ matrix.storage-layout }} ${{ matrix.cache-solver }} --solver-timeout-assertion 0 ${{ inputs.halmos-options }}" ${{ inputs.pytest-options }}
run: uv run pytest -v -k "not long and not ffi" --ignore=tests/lib --halmos-options="-st --disable-gc --solver-threads 1 --storage-layout ${{ matrix.storage-layout }} ${{ matrix.cache-solver }} --solver-timeout-assertion 0 ${{ inputs.halmos-options }}" ${{ inputs.pytest-options }}
9 changes: 0 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
repos:
# - repo: https://github.com/psf/black
# rev: 23.7.0
# hooks:
# - id: black
# # It is recommended to specify the latest version of Python
# # supported by your project here, or alternatively use
# # pre-commit's default_language_version, see
# # https://pre-commit.com/#top_level-default_language_version
# language_version: python3.12

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
Expand Down
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ Alternatively, you can manage the python version and the virtual environment man
python3.12 -m venv .venv && source .venv/bin/activate

# install halmos and its runtime dependencies in editable mode
python -m pip install -e .

# install the dev dependencies
python -m pip install -r requirements-dev.txt
python -m pip install -e ".[dev]"

# install and run the pre-commit hooks
pre-commit install
Expand Down
6 changes: 2 additions & 4 deletions packages/halmos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ ENV VIRTUAL_ENV='/halmos/.venv'
# Install halmos, assuming it is checked out in the context directory
WORKDIR /halmos
RUN --mount=type=bind,source=../..,target=/src,readonly=false \
uv venv && \
uv pip install --no-cache /src && \
uv pip install --no-cache -r /src/requirements-dev.txt
uv sync --frozen

# Set a nicer prompt
ENV IMAGE_NAME=halmos
RUN echo 'PS1="($IMAGE_NAME) \[\033[1;32m\]\u@\h \[\033[1;35m\]\w \$\[\033[0m\] "' >> /root/.bashrc

WORKDIR /workspace
CMD ["halmos"]
CMD ["uv", "run", "halmos"]
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ halmos = "halmos.__main__:main"
# pip install -e ".[dev]"
# (see CONTRIBUTING.md for more details)
[project.optional-dependencies]
dev = ["ruff", "pre-commit", "pytest"]
dev = [
"pre-commit>=4.0.1",
"pytest>=8.3.4",
"ruff>=0.8.1",
]

[tool.pytest.ini_options]
# TODO: re-add test_traces.py when we have a better way to support it in CI
Expand Down
3 changes: 0 additions & 3 deletions requirements-dev.txt

This file was deleted.

277 changes: 277 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit 67fb3db

Please sign in to comment.