Skip to content

Commit

Permalink
feat: switching from poetry to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
chartotu19 committed Jan 4, 2025
1 parent cd99301 commit 36ab191
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 65 deletions.
52 changes: 22 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,25 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install uv
run: |
pip install uv
- name: Load cached venv
id: cached-poetry-dependencies
- name: Load cached dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}

- name: Install project
run: poetry install --no-interaction
run: |
uv venv
uv pip install -e ".[dev]"
- name: Run tests
run: poetry run pytest -v --cov=docs_actions --cov-report=xml

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# fail_ci_if_error: true
run: |
source .venv/bin/activate
pytest -v --cov=docs_actions --cov-report=xml
lint:
name: Lint
Expand All @@ -64,26 +57,25 @@ jobs:
python-version: "3.12"
cache: "pip"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install uv
run: |
pip install uv
- name: Load cached venv
id: cached-poetry-dependencies
- name: Load cached dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-lint-${{ hashFiles('**/poetry.lock') }}
key: venv-${{ runner.os }}-lint-${{ hashFiles('**/requirements.txt') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
run: |
uv venv
uv pip install -e ".[dev]"
- name: Run pre-commit
run: poetry run pre-commit run --all-files
run: |
source .venv/bin/activate
pre-commit run --all-files
security:
name: Security Checks
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ jobs:
python-version: "3.12"
cache: "pip"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check for updates
run: poetry show --outdated
run: uv pip list --outdated

- name: Run safety check
run: |
pip install safety
uv pip install safety
safety check
16 changes: 8 additions & 8 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ jobs:
python-version: "3.12"
cache: "pip"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Update version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
poetry version $VERSION
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION
- name: Build package
run: poetry build
run: |
uv sync
uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
24 changes: 11 additions & 13 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ jobs:
python-version: "3.12"
cache: "pip"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install --no-interaction
pip install mkdocs
pip install sphinx sphinx-sitemap
uv venv
uv pip install -e .
uv pip install mkdocs sphinx sphinx-sitemap
- name: mkdocs - Build docs
run: |
Expand All @@ -39,7 +37,7 @@ jobs:
- name: mkdocs - Run llms-txt
run: |
cd tests/test_mkdocs
poetry run llms-txt --docs-dir site/
uv run llms-txt --docs-dir site/
- name: mkdocs - Check generated files
run: |
Expand All @@ -64,7 +62,7 @@ jobs:
MODEL_API_KEY: ${{ secrets.MODEL_API_KEY }}
run: |
cd tests/test_mkdocs
poetry run llms-txt --docs-dir site/
uv run llms-txt --docs-dir site/
- name: mkdocs - Check generated files
run: |
Expand All @@ -86,7 +84,7 @@ jobs:
- name: sphinx - Run llms-txt
run: |
cd tests/test_sphinx
poetry run llms-txt --docs-dir build/html/
uv run llms-txt --docs-dir build/html/
- name: sphinx - Check generated files
run: |
Expand All @@ -111,7 +109,7 @@ jobs:
MODEL_API_KEY: ${{ secrets.MODEL_API_KEY }}
run: |
cd tests/test_sphinx
poetry run llms-txt --docs-dir build/html/
uv run llms-txt --docs-dir build/html/
- name: sphinx - Check generated files
run: |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ llms-txt --docs-dir site/

```bash
# clone the repo
poetry install
uv sync
```

1. Run the crawler:

```bash
poetry run python -m "llms_txt_action.entrypoint" --docs-dir site/
uv run python -m "llms_txt_action.entrypoint" --docs-dir site/
```

## Examples
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "llms-txt-action"
version = "0.1.1"
version = "0.0.0"
description = "GitHub Action to make documentation more accessible to LLMs."
authors = [
{name = "DemoDrive AI", email = "founders@demodrive.tech"}
Expand Down Expand Up @@ -47,8 +47,8 @@ dev = [
]

[build-system]
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.ruff]
line-length = 88
Expand Down Expand Up @@ -83,7 +83,6 @@ select = [
"SLF", # self
"SIM", # simplify
"TID", # tidy-imports
"TCH", # type-checking
"ARG", # unused-arguments
"PTH", # use-pathlib
"ERA", # eradicate
Expand Down

0 comments on commit 36ab191

Please sign in to comment.