Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: migrate to uv #43

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
106 changes: 44 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install 3.8

- name: Install Pre-Commit
run: python -m pip install pre-commit && pre-commit install
- name: Create virtual environment
run: uv sync --all-extras --dev

- name: Install Pre-Commit hooks
run: uv run pre-commit install

- name: Load cached Pre-Commit Dependencies
id: cached-pre-commit-dependencies
Expand All @@ -27,76 +32,58 @@ jobs:
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Execute Pre-Commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
with:
python-version: "3.8"
cache: true
cache-dependency-path: |
./pdm.lock
- name: Set up Python
run: uv python install 3.8

- name: Install dependencies
run: pdm install -G:all
run: uv sync --all-extras --dev

- name: Run mypy
run: pdm run mypy
run: uv run mypy

pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
with:
python-version: "3.8"
cache: true
cache-dependency-path: |
./pdm.lock
- name: Set up Python
run: uv python install 3.8

- name: Install dependencies
run: pdm install -G:all
run: uv sync --all-extras --dev

- name: Run pyright
run: pdm run pyright
run: uv run pyright

slotscheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v4
name: Set up PDM
with:
python-version: "3.8"
cache: true
cache-dependency-path: |
./pdm.lock
- name: Set up Python
run: uv python install 3.8

- name: Install dependencies
run: pdm install -G:all
run: uv sync --all-extras --dev

- name: Run slotscheck
run: pdm run slotscheck type_lens
run: uv run slotscheck type_lens

test:
runs-on: ubuntu-latest
Expand All @@ -112,18 +99,17 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
allow-python-prereleases: true
python-version: ${{ matrix.python-version }}
cache: true
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: pdm install
run: uv sync --all-extras --dev

- name: Test
run: pdm run pytest -m ""
run: uv run pytest -m ""

build-docs:
needs:
Expand All @@ -134,31 +120,27 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
cache: true
- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: pdm install -G:docs
run: uv sync --all-extras --dev

- name: Build docs
run: pdm run make docs
run: uv run make docs

- name: Save PR number
run: |
echo "${{ github.event.number }}" > .pr_number

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs-preview
path: |
docs/_build/html
.pr_number
include-hidden-files: true
16 changes: 3 additions & 13 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ on:

jobs:
deploy:

if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}

runs-on: ubuntu-latest
permissions:
issues: write
Expand All @@ -20,12 +18,10 @@ jobs:
uses: actions/checkout@v4

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v6
with:
workflow_conclusion: success

run_id: ${{ github.event.workflow_run.id }}

path: docs-preview
name: docs-preview

Expand All @@ -42,21 +38,15 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs-preview/docs/_build/html

ssh-key: ${{ secrets.DOCS_PREVIEW_DEPLOY_KEY }}

token: ${{ secrets.DOCS_PREVIEW_DEPLOY_KEY }}
repository-name: litestar-org/type-lens-docs-preview
clean: false

target-folder: ${{ env.PR_NUMBER }}

branch: gh-pages

- uses: actions/github-script@v6
- uses: actions/github-script@v7
env:

PR_NUMBER: ${{ env.PR_NUMBER }}

with:
script: |
const issue_number = process.env.PR_NUMBER
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
cache: true
- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: pdm install -G:docs
run: uv sync --all-extras --dev

- name: Fetch gh pages
run: git fetch origin gh-pages --depth=1

- name: Build release docs
run: pdm run python tools/build_docs.py docs-build
run: uv run python tools/build_docs.py docs-build
if: github.event_name == 'release'

- name: Build dev docs
run: pdm run python tools/build_docs.py docs-build
run: uv run python tools/build_docs.py docs-build
if: github.event_name == 'push'

- name: Deploy
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
cache: true
- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --all-extras

- name: Build package
run: pdm build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 0 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# folders
__pycache__/
.auto_pytabs_cache/
.hypothesis/
.idea/
.mypy_cache/
.pytest_cache/
.scannerwork/
.venv/
.vscode/
*.egg-info/
build/
dist/
node_modules/
results/
site/
target/
Expand All @@ -21,16 +17,10 @@ target/
**/*.sqlite
**/*.sqlite*
*.iml
.DS_Store
.coverage
.dmypy.json
.python-version
.ruff_cache
/docs/_build/
coverage.*
setup.py

# pdm
.pdm.toml
.pdm-python
.pdm-build/
13 changes: 2 additions & 11 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ Contribution guide
Setting up the environment
--------------------------

1. Install `Pizza Delivery Man <https://pdm.fming.dev/latest/>`_
2. Run ``pdm install -G:all`` to create a `virtual environment <https://docs.python.org/3/tutorial/venv.html>`_ and install
the dependencies
3. If you're working on the documentation and need to build it locally, install the extra dependencies with ``pdm install -G:docs``
4. Install `pre-commit <https://pre-commit.com/>`_
5. Run ``pre-commit install`` to install pre-commit hooks
1. Run ``make install`` to install `uv <https://docs.astral.sh/uv/>`_, all dependencies, and pre-commit hooks

Code contributions
------------------
Expand Down Expand Up @@ -57,11 +52,7 @@ The documentation is located in the ``/docs`` directory and is `ReST <https://do
Running the docs locally
++++++++++++++++++++++++

To run or build the docs locally, you need to first install the required dependencies:

``pdm install -G:docs``

Then you can serve the documentation with ``make docs-serve``, or build them with ``make docs``.
You can serve the documentation with ``make docs-serve``, or build them with ``make docs``.

Creating a new release
----------------------
Expand Down
Loading
Loading