Skip to content

Commit

Permalink
Switch to uv from poetry (#373)
Browse files Browse the repository at this point in the history
* Switch from Poetry to UV for dependency management and update GitHub Actions

* Transition from Poetry to UV for dependency management

* Implement official GitHub Action for UV setup across workflows

* Switch from Poetry to UV for dependency management and update GitHub Actions

* Update change list with latest modifications

* Delete poetry.lock

* Fix deps in pyproject.toml

* Upgrade ruff and ignore some errors

* Change 3.12 -> 3.10 in .python-version

* Add docs and examples deps

* Remove change_list.txt

* Use setup-uv v2 github action

* Fix uv commands in github actions

* Add dependency groups for docs, examples

* Turn on ruff docstring-code-format

* Remove 4.0 python version upper limit

* uv lock --upgrade

* ruff lint fix

* Include optional and docs deps in uv sync

* Remove pip dependabot updates

* Add pyright venv config

* Fix mypy error

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
  • Loading branch information
jackmpcollins and devin-ai-integration[bot] authored Nov 14, 2024
1 parent 5986060 commit 046ae4d
Show file tree
Hide file tree
Showing 15 changed files with 3,553 additions and 4,611 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,3 @@ updates:
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
- package-ecosystem: "pip"
directory: "/"
reviewers:
- "jackmpcollins"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
12 changes: 7 additions & 5 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v2
with:
python-version: "3.10"
cache: "poetry"
- run: poetry install
- run: poetry run mkdocs build
uv-version: latest
- name: Install dependencies
run: uv sync
- name: Build documentation
run: uv run mkdocs build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ jobs:
id-token: write # Required for trusted publishing to PyPI
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v2
with:
python-version: "3.10"
cache: "poetry"
- run: poetry install
- run: poetry build
uv-version: latest
- name: Install dependencies
run: uv sync
- name: Build package
run: uv build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
27 changes: 13 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,37 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- run: poetry install --all-extras
- run: poetry run ruff check --output-format=github .
- run: poetry run ruff format --check .
- run: poetry run mypy .
- run: poetry run pytest -vv tests/
- name: Set up uv
uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: uv sync
- run: uv run ruff check --output-format=github .
- run: uv run ruff format --check .
- run: uv run mypy .
- run: uv run pytest -vv tests/
# Do not use `github.event.inputs` because it converts booleans to strings
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
- if: inputs.anthropic
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: poetry run pytest -vv tests/ -m 'anthropic'
run: uv run pytest -vv tests/ -m 'anthropic'
- if: inputs.litellm_anthropic
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: poetry run pytest -vv tests/ -m 'litellm_anthropic'
run: uv run pytest -vv tests/ -m 'litellm_anthropic'
- if: inputs.litellm_openai
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ORG_ID: ${{ secrets.OPENAI_ORG_ID }}
run: poetry run pytest -vv tests/ -m 'litellm_openai'
run: uv run pytest -vv tests/ -m 'litellm_openai'
- if: inputs.mistral
env:
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
run: poetry run pytest -vv tests/ -m 'mistral'
run: uv run pytest -vv tests/ -m 'mistral'
- if: inputs.openai
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ORG_ID: ${{ secrets.OPENAI_ORG_ID }}
run: poetry run pytest -vv tests/ -m 'openai'
run: uv run pytest -vv tests/ -m 'openai'
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
rev: v0.7.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.18.0"
rev: "1.19.1"
hooks:
- id: blacken-docs
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Easily integrate Large Language Models into your Python code. Simply use the `@p
pip install magentic
```

or using poetry
or using uv

```sh
poetry add magentic
uv add magentic
```

Configure your OpenAI API key by setting the `OPENAI_API_KEY` environment variable. To configure a different LLM provider see [Configuration] for more.
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Easily integrate Large Language Models into your Python code. Simply use the `@p
pip install magentic
```

or using poetry
or using uv

```sh
poetry add magentic
uv add magentic
```

Configure your OpenAI API key by setting the `OPENAI_API_KEY` environment variable. To configure a different LLM provider see [Configuration] for more.
Expand Down
Loading

0 comments on commit 046ae4d

Please sign in to comment.