Skip to content

Commit 8612f15

Browse files
authored
feat: switch rye to uv.
--------- Signed-off-by: 5hojib <[email protected]>
1 parent 87f4f36 commit 8612f15

File tree

351 files changed

+2244
-1261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

351 files changed

+2244
-1261
lines changed

.github/workflows/docs_gen.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ on:
77

88
jobs:
99
build:
10-
11-
runs-on: ubuntu-22.04
12-
10+
runs-on: ubuntu-latest
1311
steps:
1412
- uses: actions/checkout@v4
1513
- name: Build

.github/workflows/error_scrape.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44

55
jobs:
66
build:
7+
permissions:
8+
id-token: write
79
name: scrape-errors
810
runs-on: ubuntu-latest
911
steps:

.github/workflows/format_and_test.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Format and Test Code with Rye
1+
name: Format and test code with uv
22

33
on:
44
push:
@@ -20,20 +20,24 @@ jobs:
2020
with:
2121
python-version: "3.13"
2222

23-
- name: Install the latest version of rye
24-
uses: eifinger/setup-rye@v4
23+
- name: Install the latest version of uv
24+
uses: astral-sh/setup-uv@v3
2525
with:
26-
version: 'latest'
26+
version: "latest"
2727

2828
- name: Install dependencies
2929
run: |
30-
rye pin 3.12
31-
rye sync
30+
uv python install 3.13
31+
uv run -m ensurepip --upgrade
32+
uv run -m pip install --upgrade pip
33+
uv tool install pytest
34+
uv run -m pip install pytest
35+
uv lock --upgrade
3236
3337
- name: Run ruff to lint and format code
3438
run: |
35-
rye run ruff check . --exit-zero
36-
rye fmt
39+
uv tool run ruff check . --exit-zero
40+
uv tool run ruff format .
3741
git add -u
3842
3943
- name: Commit and push changes
@@ -49,8 +53,5 @@ jobs:
4953
env:
5054
GITHUB_TOKEN: ${{ secrets.GX_TOKEN }}
5155

52-
- name: Generate API
53-
run: rye run api
54-
5556
- name: Run tests
56-
run: rye run python -m pytest
57+
run: uv run -m pytest

.github/workflows/tag_and_publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ jobs:
5252
release_name: Release ${{ env.VERSION }}
5353
body_path: ./release_notes.txt
5454

55-
- name: Build
55+
- name: Build and publish
5656
if: env.RELEASE_EXISTS == 'false'
5757
run: |
5858
python -m pip install --upgrade pip
5959
pip install -e '.[dev]'
6060
hatch build
61-
62-
- name: Publish
63-
if: env.RELEASE_EXISTS == 'false'
64-
uses: pypa/gh-action-pypi-publish@release/v1
61+
hatch publish
62+
env:
63+
HATCH_INDEX_USER: __token__
64+
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ This repository is a personal clone of Pyrogram, created specifically for my pro
33
Please understand that any issues, modifications, or deviations from the original project are solely my responsibility. Do not hold me accountable for any problems or discrepancies that may arise from using this repository.
44

55
Thank you for your understanding.
6+
7+
8+
## Recent activity [![Time period](https://images.repography.com/58464391/AeonOrg/Electrogram/recent-activity/gf9SHLZa6sqXRpReIT2U07ZtsB7JysNRXMyhy4b2tgE/9c16LtrRR82Ubh9Kw6CMclKpbhDemGuBCxkZUuGJjts_badge.svg)](https://repography.com)
9+
[![Timeline graph](https://images.repography.com/58464391/AeonOrg/Electrogram/recent-activity/gf9SHLZa6sqXRpReIT2U07ZtsB7JysNRXMyhy4b2tgE/9c16LtrRR82Ubh9Kw6CMclKpbhDemGuBCxkZUuGJjts_timeline.svg)](https://github.com/AeonOrg/Electrogram/commits)

compiler/api/compiler.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
SECTION_RE = re.compile(r"---(\w+)---")
1717
LAYER_RE = re.compile(r"//\sLAYER\s(\d+)")
1818
COMBINATOR_RE = re.compile(
19-
r"^([\w.]+)#([0-9a-f]+)\s(?:.*)=\s([\w<>.]+);$", re.MULTILINE
19+
r"^([\w.]+)#([0-9a-f]+)\s(?:.*)=\s([\w<>.]+);$",
20+
re.MULTILINE,
2021
)
2122
ARGS_RE = re.compile(r"[^{](\w+):([\w?!.<>#]+)")
2223
FLAGS_RE = re.compile(r"flags(\d?)\.(\d+)\?")
@@ -183,7 +184,7 @@ def get_references(t: str, kind: str):
183184
return ("\n ".join(items), len(items)) if items else (None, 0)
184185

185186

186-
def start() -> None:
187+
def start() -> None: # noqa: C901
187188
shutil.rmtree(DESTINATION_PATH / "types", ignore_errors=True)
188189
shutil.rmtree(DESTINATION_PATH / "functions", ignore_errors=True)
189190
shutil.rmtree(DESTINATION_PATH / "base", ignore_errors=True)
@@ -327,7 +328,7 @@ def start() -> None:
327328
qualname=qualtype,
328329
types=", ".join([f'"raw.types.{c}"' for c in constructors]),
329330
doc_name=snake(type).replace("_", "-"),
330-
)
331+
),
331332
)
332333

333334
for c in combinators:
@@ -341,7 +342,7 @@ def start() -> None:
341342

342343
fields = (
343344
"\n ".join(
344-
[f"self.{i[0]} = {i[0]} # {i[1]}" for i in sorted_args]
345+
[f"self.{i[0]} = {i[0]} # {i[1]}" for i in sorted_args],
345346
)
346347
if sorted_args
347348
else "pass"
@@ -364,7 +365,7 @@ def start() -> None:
364365
arg_docs = arg_docs["params"].get(arg_name, "N/A") if arg_docs else "N/A"
365366

366367
docstring_args.append(
367-
f'{arg_name} ({get_docstring_arg_type(arg_type)}{", *optional*" if is_optional else ""}):\n {arg_docs}\n'
368+
f'{arg_name} ({get_docstring_arg_type(arg_type)}{", *optional*" if is_optional else ""}):\n {arg_docs}\n',
368369
)
369370

370371
if c.section == "types":
@@ -393,7 +394,7 @@ def start() -> None:
393394

394395
if c.section == "functions":
395396
docstring += "\n Returns:\n " + get_docstring_arg_type(
396-
c.qualtype
397+
c.qualtype,
397398
)
398399
else:
399400
references, count = get_references(c.qualname, "constructors")
@@ -417,22 +418,22 @@ def start() -> None:
417418
continue
418419

419420
if flag.group(3) == "true" or flag.group(3).startswith(
420-
"Vector"
421+
"Vector",
421422
):
422423
write_flags.append(
423-
f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} else 0"
424+
f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} else 0",
424425
)
425426
else:
426427
write_flags.append(
427-
f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0"
428+
f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0",
428429
)
429430

430431
write_flags = "\n ".join(
431432
[
432433
f"{arg_name} = 0",
433434
"\n ".join(write_flags),
434435
f"b.write(Int({arg_name}))\n ",
435-
]
436+
],
436437
)
437438

438439
write_types += write_flags
@@ -555,7 +556,7 @@ def start() -> None:
555556

556557
if not namespace:
557558
f.write(
558-
f"from . import {', '.join(filter(bool, namespaces_to_types))}"
559+
f"from . import {', '.join(filter(bool, namespaces_to_types))}",
559560
)
560561

561562
all.extend(filter(bool, namespaces_to_types))
@@ -583,7 +584,7 @@ def start() -> None:
583584

584585
if not namespace:
585586
f.write(
586-
f"from . import {', '.join(filter(bool, namespaces_to_constructors))}\n"
587+
f"from . import {', '.join(filter(bool, namespaces_to_constructors))}\n",
587588
)
588589

589590
all.extend(filter(bool, namespaces_to_constructors))
@@ -595,7 +596,8 @@ def start() -> None:
595596

596597
for namespace, types in namespaces_to_functions.items():
597598
with open(
598-
DESTINATION_PATH / "functions" / namespace / "__init__.py", "w"
599+
DESTINATION_PATH / "functions" / namespace / "__init__.py",
600+
"w",
599601
) as f:
600602
f.write(f"{WARNING}\n\n")
601603

@@ -613,7 +615,7 @@ def start() -> None:
613615

614616
if not namespace:
615617
f.write(
616-
f"from . import {', '.join(filter(bool, namespaces_to_functions))}"
618+
f"from . import {', '.join(filter(bool, namespaces_to_functions))}",
617619
)
618620

619621
all.extend(filter(bool, namespaces_to_functions))

0 commit comments

Comments
 (0)