Skip to content

Commit

Permalink
🚀 Begin upgrade to uv packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
daquintero committed Aug 21, 2024
1 parent 220576f commit 056ab4b
Show file tree
Hide file tree
Showing 8 changed files with 5,469 additions and 8,362 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,25 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.10"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true

- name: Set up uv
# Install a specific uv version using the installer
run: curl -LsSf https://astral.sh/uv/0.3.0/install.sh | sh

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: poetry install -E dev
run: uv pip install -e .[dev]

#----------------------------------------------
# add matrix specifics and run test suite
#----------------------------------------------
- name: Run tests
run: |
source $VENV
coverage run -m pytest -rA tests
coverage report -m
uv run coverage run -m pytest -rA tests
uv run coverage report -m
echo "total=$(coverage report --format=total)" >> $GITHUB_ENV
echo '### Total coverage: ${{ env.total }}%'
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,9 @@ jobs:
steps:
- uses: actions/checkout@v4

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: Set up uv
# Install a specific uv version using the installer
run: curl -LsSf https://astral.sh/uv/0.3.0/install.sh | sh

#----------------------------------------------
# install your root project, if required
Expand All @@ -56,14 +50,15 @@ jobs:
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
poetry --version
poetry install -E dev
uv --version
uv venv --python=python${{ matrix.python-version }} venv
source venv/bin/activate
uv pip install -e .[dev]
#----------------------------------------------
# add matrix specifics and run test suite
#----------------------------------------------
- name: Run tests
run: |
# poetry run black . --check --diff
# poetry run ruff check piel --fix --exit-non-zero-on-fix
poetry run pytest -rA tests
source venv/bin/activate
uv run pytest -rA tests
9 changes: 5 additions & 4 deletions piel/cli/develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ def develop():
@develop.command(name="build-docs", help="Builds the sphinx documentation.")
def build_documentation(args=None):
"""Verifies and builds the documentation."""
# Runs the documentation build from the poetry environment
# TODO fix this so it runs from poetry.
# Runs the documentation build from the uv environment
# TODO fix this so it runs from uv.
echo_and_check_subprocess(["python", "-m", "sphinx", "docs/", "_docs/"])
return 0


# TODO migrate to uv
@develop.command(
name="generate-poetry2nix-flake", help="Generates the poetry2nix flake."
)
Expand Down Expand Up @@ -52,7 +53,7 @@ def generate_poetry2nix_flake(args=None):
else:
raise Exception(
"Failed to generate the poetry2nix flake and none was found in the root directory.s"
)
) from None


@develop.command(
Expand All @@ -75,7 +76,7 @@ def build_piel_cachix_command(args=None):
)
elif platform.system() == "Linux":
# cachix use openlane
# create_and_activate_venv() # Currently unused, TODO future poetry integration
# create_and_activate_venv() # Currently unused, TODO future uv integration
nix_shell_directory = get_python_install_directory() / "environment" / "nix"
# nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
echo_and_check_subprocess(
Expand Down
Loading

0 comments on commit 056ab4b

Please sign in to comment.