Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3fb24d2
feat: attempt to swtich pruna from poetry to uv
johnrachwan123 Jun 18, 2025
9ce7bb0
fix: uv installation
johnrachwan123 May 29, 2025
d08c275
refactor: remove requirements.txt
johnrachwan123 May 30, 2025
63a6e1c
tests: update package build to uv
johnrachwan123 May 30, 2025
d97c284
docs: update the how to contribute docs
johnrachwan123 Jun 10, 2025
150c697
docs: expand how to contribute
johnrachwan123 Jun 10, 2025
e0b5ec6
fix: ctranslate2 and ws2t versions
johnrachwan123 Jun 11, 2025
d036175
feat: switch pruna from poetry to uv (#165)
johnrachwan123 Jun 11, 2025
c9050ab
fix: pin hqq version
johnrachwan123 Jun 11, 2025
6bb200a
fix: handle pr comments
johnrachwan123 Jun 18, 2025
099f14a
fix: typo in installation.yaml
johnrachwan123 Jun 18, 2025
3cc28fe
fix: typos in yaml files
johnrachwan123 Jun 18, 2025
5ecb4e4
fix: use uv add
johnrachwan123 Jun 18, 2025
3004511
fix: add --system to pip install
johnrachwan123 Jun 18, 2025
7718cd4
fix: add uv venv
johnrachwan123 Jun 18, 2025
d4a29b5
fix: keep one extra index in toml file
johnrachwan123 Jun 18, 2025
7f90e0a
fix: attempt to make pruna pypi server secondary
johnrachwan123 Jun 18, 2025
8abe524
fix: add uv venv to documentation.yaml
johnrachwan123 Jun 18, 2025
3dc750e
fix: attempt to fix problematic gptqmodel dependency
johnrachwan123 Jun 18, 2025
3889a1e
fix: remove cache for sanity check
johnrachwan123 Jun 18, 2025
d1b7a12
fix: remove duplicate line
johnrachwan123 Jun 18, 2025
349de97
fix: remove extra index
johnrachwan123 Jun 18, 2025
bcd76e5
fix: use_cache=True
johnrachwan123 Jun 18, 2025
422db7c
fix: remove uv from doc build
johnrachwan123 Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions .github/workflows/cpu_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,15 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: abatilo/actions-poetry@v4

- name: Update Poetry lock file
run: poetry lock

- name: Cache Poetry virtualenv
uses: actions/cache@v4
- uses: astral-sh/setup-uv@v6
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-${{ matrix.python-version }}

- name: Install dependencies using Poetry
run: poetry install --extras tests
enable-cache: true
- name: Install dependencies
run: |
uv sync --extra tests
Comment thread
johannaSommer marked this conversation as resolved.
Outdated

- name: Run tests
run: |
poetry run pytest -m "cpu and not slow and not high_cpu"
uv run pytest -m "cpu and not slow and not high_cpu"


19 changes: 8 additions & 11 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ jobs:

strategy:
matrix:
python-version: ["3.10"]
python-version: ["3.11"]


steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -28,22 +27,20 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "${HOME}/.local/bin" >> $GITHUB_PATH

- name: Configure Poetry to not create virtual environments
run: poetry config virtualenvs.create false
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Install dependencies
run: pip install -e .[cpu]
run: |
Comment thread
johannaSommer marked this conversation as resolved.
Outdated
pip install -e .[cpu]

- name: Remove .so files
run: find . -name "*.so" -delete

- name: Run generation script
run: python docs/utils/gen_docs.py
run: uv run docs/utils/gen_docs.py

- name: Verify generated file exists
run: |
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]


steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -29,17 +28,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry on Windows
if: runner.os == 'Windows'
run: |
powershell -Command "(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - --version 1.8.5"
echo "$(python -m site --user-base)\Scripts" >> $env:GITHUB_PATH

Comment thread
johannaSommer marked this conversation as resolved.
Outdated
- name: Install Poetry on Unix
if: runner.os != 'Windows'
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 -
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Install dependencies
run: pip install -e .
run: |
uv venv
uv pip install -e .
Comment on lines -45 to +39
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this or you can also say activate-environment: true in with block of the install uv step; I wanted to do this later after you merge this PR, to create a common github action file and put the whole installation logic with activate-environment: true there which means we don't need to prefix every command with uv

27 changes: 9 additions & 18 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: abatilo/actions-poetry@v4
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Update Poetry lock file
run: poetry lock

- name: Cache Poetry virtualenv
uses: actions/cache@v4
- uses: astral-sh/setup-uv@v6
Comment thread
johnrachwan123 marked this conversation as resolved.
Outdated
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-${{ matrix.python-version }}

- name: Install dependencies using Poetry
run: poetry install --extras tests
enable-cache: true

- name: Remove .so files
run: find . -name "*.so" -delete
- name: Install dependencies
Comment thread
johannaSommer marked this conversation as resolved.
Outdated
run: |
uv sync --extra tests

- name: Run ruff on Pruna code
uses: astral-sh/ruff-action@v3
with:
version: "latest"

- name: Run mypy on Pruna code
run: poetry run mypy --show-traceback src/pruna
run: uv run mypy --show-traceback src/pruna

- name: Run docstring checks with pytest
run: poetry run pytest -m "style"
run: uv run pytest -m "style"
23 changes: 8 additions & 15 deletions .github/workflows/package_build.yaml
Comment thread
johnrachwan123 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install build and conversion dependencies
run: |
python -m pip install setuptools wheel

- name: Install Poetry on Unix
if: runner.os != 'Windows'
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 -
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Build Wheel
- name: Build
run: |
poetry build
uv build

- name: Get wheel filename
id: get_wheel
Expand All @@ -50,4 +42,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ steps.get_wheel.outputs.wheel_name }}
path: dist/*.whl
path: dist/*.whl
retention-days: 7
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
Expand Down
41 changes: 36 additions & 5 deletions docs/contributions/how_to_contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Please make sure to review and adhere to the `Pruna Code of Conduct <https://git
Any violations will be handled accordingly and result in a ban from the Pruna community and associated platforms.
Contributions that do not adhere to the code of conduct will be ignored.

If you don't have uv installed, you can install it by following the instructions on the `uv website <https://docs.astral.sh/uv/getting-started/installation/>`_.

There are various ways you can contribute:

- Have a question? Discuss with us on `Discord <https://discord.gg/Tun8YgzxZ9>`_ or check out the :doc:`/resources/faq`
Expand Down Expand Up @@ -57,22 +59,35 @@ Always work on a new branch rather than the main branch. You can create a new br
2. Installation
^^^^^^^^^^^^^^^^^^^^^^

You can now set up a virtual environment of your choice and install the dependencies by running the following command:
You have two options for installing dependencies:

**Option A: Using uv with its own virtual environment (recommended)**

.. code-block:: bash

uv sync --extra dev --extra tests --extra stable-fast --extra gptq

This creates a virtual environment in ``.venv/`` and installs all dependencies there, including pruna itself in editable mode. **Important**: This does NOT install into your current conda environment! You'll need to use ``uv run`` for all commands.

**Option B: Installing into your current environment (conda/pip)**

If you want to install directly into your current conda environment or use pip:

.. code-block:: bash

pip install -e .
pip install -e .[dev]
pip install -e .[tests]

This installs dependencies directly in your current environment.

You can then also install the pre-commit hooks with

.. code-block:: bash

pre-commit install


3. Develop your contribution
1. Develop your contribution
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You are now ready to work on your contribution. Check out a branch on your forked repository and start coding!
Expand All @@ -94,18 +109,34 @@ We will do our best to have your contribution integrated and maintained into |pr
We have a comprehensive test suite that is designed to catch potential issues before they are merged into |pruna|.
When you make a contribution, it is highly recommended to not only run the existing tests but also to add new tests that cover your contribution.

You can run the tests by running the following command:
You can run the tests depending on which installation option you chose:

**If you used Option A (uv):**

.. code-block:: bash

uv run pytest
Comment thread
johannaSommer marked this conversation as resolved.
Outdated

For specific test markers:

.. code-block:: bash

uv run pytest -m "cpu and not slow"

**If you used Option B (pip/conda):**

.. code-block:: bash

pytest

If you want to run only the tests with a specific marker, e.g. fast CPU tests, you can do so by running:
For specific test markers:

.. code-block:: bash

pytest -m "cpu and not slow"

Note: ``uv run`` automatically uses uv's virtual environment in ``.venv/``, not your conda environment.


5. Create a Pull Request
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading