Skip to content

Commit

Permalink
433 use uv instead of pip (#434)
Browse files Browse the repository at this point in the history
* Switched to UV, updated workflows

* Update python

* Specify 3.13

* Update docs

* Fixed docs build
  • Loading branch information
kjy5 authored Feb 7, 2025
1 parent 4d03f59 commit 531934b
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 53 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/build-docs.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ jobs:
ref: ${{ github.head_ref }}
token: ${{ secrets.WORKFLOW_COMMIT }}

- name: 🔭 Install UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install
Expand Down
49 changes: 42 additions & 7 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Deploy Documentation

on:
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
workflow_dispatch:
Expand All @@ -16,20 +18,53 @@ concurrency:

jobs:

build:
name: Build
uses: ./.github/workflows/build-docs.yml
build-docs:
name: Build Documentation

runs-on: ubuntu-latest

steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: 🔭 Install UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: 📦 Install Hatch
uses: pypa/hatch@install

- name: 🔨 Build Documentation
run: hatch -e docs run build

# Upload artifact on main.
- name: ⬆️ Upload Artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: "site"

deploy:
name: Deploy Documentation

needs: build

runs-on: ubuntu-latest

if: github.ref == 'refs/heads/main'

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
needs: build-docs

steps:

Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: 🔭 Install UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install
Expand All @@ -52,11 +57,16 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: 🔭 Install UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"

- name: 📦 Install Hatch
uses: pypa/hatch@install
Expand Down
8 changes: 5 additions & 3 deletions docs/development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ This section describes:
## Installing for Development

1. Clone the repository.
2. Install [Hatch](https://hatch.pypa.io/latest/install/)
3. In a terminal, navigate to the repository's root directory and run
2. Install [UV](https://docs.astral.sh/uv/#installation)
3. Install [Hatch](https://hatch.pypa.io/latest/install/)
4. In a terminal, navigate to the repository's root directory and run

```bash
hatch shell
```

This will create a virtual environment, install Python 13 (if not found), and install the package in editable mode.
This will create a virtual environment, install the latest Python for this project (if not found), and install the
package in editable mode.

If you encounter any dependency issues (particularly with `aiohttp`), try installing the latest Microsoft Visual C++
(MSVC v143+ x86/64) and the Windows SDK (10/11)
Expand Down
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ path = "src/ephys_link/__about__.py"
exclude = ["/.github", "/.idea", "/docs"]

[tool.hatch.envs.default]
python = "3.13.1"
installer = "uv"
python = "3.13"
dependencies = [
"pyinstaller==6.11.1",
"basedpyright==1.23.1",
Expand All @@ -71,11 +72,12 @@ check = "basedpyright"
check-watched = "basedpyright --watch"

[tool.hatch.envs.docs]
python = "3.13.1"
installer = "uv"
python = "3.13"
skip-install = true
dependencies = [
"mkdocs-material==9.5.49",
"mkdocstrings-python==1.13.0",
"mkdocs-material==9.6.3",
"mkdocstrings-python==1.14.6",
"mkdocs-gen-files==0.5.0",
"mkdocs-literate-nav==0.6.1",
"mkdocs-section-index==0.3.9"
Expand Down

0 comments on commit 531934b

Please sign in to comment.