Skip to content

Commit

Permalink
Use rye for Python CI (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer authored Feb 28, 2024
1 parent 168842a commit 7e3b04a
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 18 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/python-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Python format

on: [push, pull_request]

jobs:
format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: eifinger/setup-rye@v1
- name: Rye fmt
run: rye fmt --check
14 changes: 14 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Python lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: eifinger/setup-rye@v1
- name: Rye lint
run: rye lint
1 change: 0 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ idna==3.4
# via anyio
# via httpx
# via requests
isort==5.13.2
jinja2==3.1.2
# via mkdocs
# via mkdocs-material
Expand Down
4 changes: 1 addition & 3 deletions rye-devtools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"isort>=5.13.2",
]
dev-dependencies = []

[tool.hatch.metadata]
allow-direct-references = true
Expand Down
2 changes: 0 additions & 2 deletions rye-devtools/src/rye_devtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
from . import find_downloads
from . import find_uv_downloads
3 changes: 1 addition & 2 deletions rye-devtools/src/rye_devtools/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Self
import itertools
import sys
import time
from datetime import datetime, timezone
from typing import NamedTuple
from typing import NamedTuple, Self

import httpx

Expand Down
2 changes: 1 addition & 1 deletion rye-devtools/src/rye_devtools/find_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import httpx
from httpx import HTTPStatusError

from .common import Version, fetch, PlatformTriple
from .common import PlatformTriple, Version, fetch


def log(*args, **kwargs):
Expand Down
13 changes: 7 additions & 6 deletions rye-devtools/src/rye_devtools/find_uv_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
It finds the latest UV releases and generates rust code that can be included
into rye at build time.
"""
from .common import Version, PlatformTriple, fetch, log

import re
from typing import AsyncIterator
import asyncio
import os
import httpx
import re
import sys
from dataclasses import dataclass
from typing import AsyncIterator

import httpx

from .common import PlatformTriple, Version, fetch, log


@dataclass
Expand Down Expand Up @@ -62,7 +63,7 @@ async def most_recent_downloads(
url = asset["browser_download_url"]
if (triple := self.parse_triple(url)) is not None:
sha_resp = await fetch(self.client, url + ".sha256")
sha256 = sha_resp.text.split(' ')[0].strip()
sha256 = sha_resp.text.split(" ")[0].strip()
yield UvDownload(
triple=triple,
version=version,
Expand Down
2 changes: 1 addition & 1 deletion scripts/sha256.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
import hashlib
import sys

h = hashlib.sha256()

Expand Down
3 changes: 1 addition & 2 deletions scripts/summarize-release.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import os
import sys
import json


version = sys.argv[1]
base = sys.argv[2]
Expand Down

0 comments on commit 7e3b04a

Please sign in to comment.