mirror of
https://github.com/malmeloo/FindMy.py.git
synced 2026-04-17 21:53:57 +02:00
chore: migrate from poetry to uv
This commit is contained in:
47
.github/actions/setup-project/action.yml
vendored
47
.github/actions/setup-project/action.yml
vendored
@@ -1,48 +1,25 @@
|
|||||||
name: Common Python + Poetry Setup
|
name: Common Python + UV Setup
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
dependency-groups:
|
|
||||||
description: 'A comma-separated list of dependency groups to install'
|
|
||||||
default: 'main'
|
|
||||||
python-version:
|
python-version:
|
||||||
description: 'The Python version to use'
|
description: 'The Python version to install'
|
||||||
default: '3.10'
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
if: ${{ inputs.python-version != '' }}
|
||||||
with:
|
|
||||||
python-version: ${{ inputs.python-version }}
|
|
||||||
|
|
||||||
- name: Install poetry
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: uv python install
|
||||||
python -m pip install poetry
|
|
||||||
poetry config virtualenvs.in-project true
|
|
||||||
|
|
||||||
- name: Get cache key
|
|
||||||
id: cache-key
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
key=$(echo "${{ inputs.dependency-groups }}" | sed 's/,/+/')
|
|
||||||
echo "key=$key" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Get full Python version
|
|
||||||
id: full-python-version
|
|
||||||
shell: bash
|
|
||||||
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Load cached venv
|
|
||||||
id: cache-dependencies
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .venv
|
|
||||||
key: venv-${{ runner.os }}-py${{ steps.full-python-version.outputs.version }}-grp${{ steps.cache-key.outputs.key }}-${{ hashFiles('**/poetry.lock') }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: steps.cache-dependencies.outputs.cache-hit != 'true'
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: poetry install --with ${{ inputs.dependency-groups }}
|
run: uv sync --all-extras --dev
|
||||||
|
|||||||
7
.github/workflows/docs.yml
vendored
7
.github/workflows/docs.yml
vendored
@@ -17,14 +17,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: './.github/actions/setup-project'
|
- name: Install uv and set the python version
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
dependency-groups: 'docs'
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Build documentation
|
- name: Build documentation
|
||||||
run: |
|
run: |
|
||||||
cd docs
|
cd docs
|
||||||
poetry run make html
|
uv run make html
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
|
|||||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -14,8 +14,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: './.github/actions/setup-project'
|
- uses: './.github/actions/setup-project'
|
||||||
with:
|
|
||||||
dependency-groups: 'dev,test'
|
|
||||||
|
|
||||||
- uses: pre-commit/action@v3.0.1
|
- uses: pre-commit/action@v3.0.1
|
||||||
|
|
||||||
|
|||||||
7
.github/workflows/publish.yml
vendored
7
.github/workflows/publish.yml
vendored
@@ -17,19 +17,16 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: './.github/actions/setup-project'
|
- uses: './.github/actions/setup-project'
|
||||||
with:
|
|
||||||
dependency-groups: 'dev'
|
|
||||||
|
|
||||||
- name: Prepare README
|
- name: Prepare README
|
||||||
run: ./scripts/refactor_readme.py README.md
|
run: ./scripts/refactor_readme.py README.md
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: poetry build
|
run: uv build
|
||||||
|
|
||||||
- name: Publish package
|
- name: Publish package
|
||||||
run: |
|
run: |
|
||||||
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
|
uv publish --token ${{ secrets.PYPI_API_TOKEN }}
|
||||||
poetry publish
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
|
|||||||
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@@ -17,14 +17,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: './.github/actions/setup-project'
|
- uses: './.github/actions/setup-project'
|
||||||
with:
|
|
||||||
dependency-groups: 'dev'
|
|
||||||
|
|
||||||
- id: supported-versions
|
- id: supported-versions
|
||||||
name: Get supported versions
|
name: Get supported versions
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
echo "py-versions=$(poetry run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT"
|
echo "py-versions=$(uv run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -40,10 +38,9 @@ jobs:
|
|||||||
- uses: './.github/actions/setup-project'
|
- uses: './.github/actions/setup-project'
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.py-version }}
|
python-version: ${{ matrix.py-version }}
|
||||||
dependency-groups: 'test'
|
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: poetry run pytest
|
run: uv run pytest
|
||||||
|
|
||||||
results:
|
results:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ Before opening a pull request, please ensure that your code adheres to these rul
|
|||||||
There are pre-commit hooks included to help you with this, which you can set up as follows:
|
There are pre-commit hooks included to help you with this, which you can set up as follows:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install poetry
|
pip install uv
|
||||||
poetry install --with dev # this installs pre-commit into your environment
|
uv sync # this installs ruff & pre-commit into your environment
|
||||||
pre-commit install
|
pre-commit install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
2068
poetry.lock
generated
2068
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,42 +1,36 @@
|
|||||||
[tool.poetry]
|
[project]
|
||||||
name = "FindMy"
|
name = "FindMy"
|
||||||
version = "v0.7.6"
|
version = "v0.7.6"
|
||||||
description = "Everything you need to work with Apple's Find My network!"
|
description = "Everything you need to work with Apple's Find My network!"
|
||||||
authors = ["Mike Almeloo <git@mikealmel.ooo>"]
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [{ include = "findmy" }]
|
authors = [
|
||||||
|
{name = "Mike Almeloo", email = "git@mikealmel.ooo"},
|
||||||
|
]
|
||||||
|
requires-python = ">=3.9,<3.14"
|
||||||
|
dependencies = [
|
||||||
|
"srp>=1.0.21,<2.0.0",
|
||||||
|
"cryptography>=42.0.0,<45.0.0",
|
||||||
|
"beautifulsoup4>=4.12.3,<5.0.0",
|
||||||
|
"aiohttp>=3.9.5,<4.0.0",
|
||||||
|
"bleak>=0.22.2,<1.0.0",
|
||||||
|
"typing-extensions>=4.12.2,<5.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[dependency-groups]
|
||||||
python = ">=3.9,<3.14"
|
dev = [
|
||||||
srp = "^1.0.21"
|
"pre-commit>=3.8.0,<4.0.0",
|
||||||
cryptography = ">=42.0.0,<45.0.0"
|
"pyright>=1.1.391,<2.0.0",
|
||||||
beautifulsoup4 = "^4.12.3"
|
"ruff>=0.8.4,<1.0.0",
|
||||||
aiohttp = "^3.9.5"
|
"tomli>=2.0.1,<3.0.0",
|
||||||
bleak = "^0.22.2"
|
"packaging>=24.1,<25.0",
|
||||||
typing-extensions = "^4.12.2"
|
]
|
||||||
|
test = [
|
||||||
[tool.poetry.group.dev]
|
"pytest>=8.3.2,<9.0.0",
|
||||||
optional = true
|
]
|
||||||
|
docs = [
|
||||||
[tool.poetry.group.dev.dependencies]
|
"sphinx>=7.2.6,<8.0.0",
|
||||||
pre-commit = "^3.8.0"
|
"sphinx-autoapi==3.4.0",
|
||||||
pyright = "^1.1.391"
|
]
|
||||||
ruff = "^0.8.4"
|
|
||||||
tomli = "^2.0.1"
|
|
||||||
packaging = "^24.1"
|
|
||||||
|
|
||||||
[tool.poetry.group.test]
|
|
||||||
optional = true
|
|
||||||
|
|
||||||
[tool.poetry.group.test.dependencies]
|
|
||||||
pytest = "^8.3.2"
|
|
||||||
|
|
||||||
[tool.poetry.group.docs]
|
|
||||||
optional = true
|
|
||||||
|
|
||||||
[tool.poetry.group.docs.dependencies]
|
|
||||||
sphinx = "^7.2.6"
|
|
||||||
sphinx-autoapi = "3.4.0"
|
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
venvPath = "."
|
venvPath = "."
|
||||||
@@ -91,6 +85,9 @@ ignore = [
|
|||||||
"D", # documentation
|
"D", # documentation
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
license-files = []
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["setuptools", "setuptools-scm"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
from collections.abc import Generator
|
||||||
from itertools import count
|
from itertools import count
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Generator
|
|
||||||
|
|
||||||
import tomli
|
import tomli
|
||||||
from packaging.specifiers import SpecifierSet
|
from packaging.specifiers import SpecifierSet
|
||||||
@@ -15,7 +15,7 @@ def get_python_versions() -> Generator[str, None, None]:
|
|||||||
with Path("pyproject.toml").open("rb") as f:
|
with Path("pyproject.toml").open("rb") as f:
|
||||||
pyproject_data = tomli.load(f)
|
pyproject_data = tomli.load(f)
|
||||||
|
|
||||||
specifier = SpecifierSet(pyproject_data["tool"]["poetry"]["dependencies"]["python"])
|
specifier = SpecifierSet(pyproject_data["project"]["requires-python"])
|
||||||
|
|
||||||
below_spec = True
|
below_spec = True
|
||||||
for v_minor in count():
|
for v_minor in count():
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let
|
||||||
|
unstable = import (fetchTarball https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz) { };
|
||||||
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
python312
|
python312
|
||||||
poetry
|
unstable.uv
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user