Skip to content

Commit 8f98dc4

Browse files
committed
rename to pyrogramv2
1 parent efac171 commit 8f98dc4

File tree

422 files changed

+2216
-2190
lines changed

Some content is hidden

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

422 files changed

+2216
-2190
lines changed

.github/FUNDING.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
github: delivrance
2-
liberapay: delivrance
3-
open_collective: pyrogram
1+
github: [illvart]
2+
custom: ["https://linktr.ee/illvart"]

.github/workflows/publish.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Upload Python Package
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -e ".[dev]"
23+
- name: Build package
24+
run: hatch build
25+
- name: Publish package
26+
env:
27+
HATCH_INDEX_USER: __token__
28+
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}
29+
run: |
30+
hatch publish

.github/workflows/python.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
1-
name: Pyrogram
1+
name: PyrogramV2
22

33
on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ${{ matrix.os }}
98
strategy:
109
matrix:
1110
os: [ubuntu-latest, macos-latest]
12-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
13-
11+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1412
steps:
15-
- uses: actions/checkout@v3
16-
13+
- uses: actions/checkout@v4
1714
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
15+
uses: actions/setup-python@v5
1916
with:
2017
python-version: ${{ matrix.python-version }}
21-
2218
- name: Install dependencies
2319
run: |
2420
python -m pip install --upgrade pip
2521
pip install tox
26-
2722
- name: Generate API
2823
run: |
2924
make venv
3025
make api
31-
3226
- name: Run tests
3327
run: |
3428
tox

.gitignore

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ unknown_errors.txt
77
.DS_Store
88

99
# Pyrogram generated code
10-
pyrogram/errors/exceptions/
11-
pyrogram/raw/functions/
12-
pyrogram/raw/types/
13-
pyrogram/raw/base/
14-
pyrogram/raw/all.py
10+
pyrogramv2/errors/exceptions/
11+
pyrogramv2/raw/functions/
12+
pyrogramv2/raw/types/
13+
pyrogramv2/raw/base/
14+
pyrogramv2/raw/all.py
1515
docs/source/telegram
1616
docs/source/api/methods/
1717
docs/source/api/bound-methods/

MANIFEST.in

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## Include
2-
include README.md COPYING COPYING.lesser NOTICE requirements.txt
2+
include README.md COPYING COPYING.lesser NOTICE
33
recursive-include compiler *.py *.tl *.tsv *.txt
44
recursive-include tests *.py
55

66
## Exclude
7-
prune pyrogram/errors/exceptions
8-
prune pyrogram/raw/functions
9-
prune pyrogram/raw/types
10-
prune pyrogram/raw/base
11-
exclude pyrogram/raw/all.py
7+
prune pyrogramv2/errors/exceptions
8+
prune pyrogramv2/raw/functions
9+
prune pyrogramv2/raw/types
10+
prune pyrogramv2/raw/base
11+
exclude pyrogramv2/raw/all.py

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VENV := venv
22
PYTHON := $(VENV)/bin/python
33
HOST = $(shell ifconfig | grep "inet " | tail -1 | cut -d\ -f2)
4-
TAG = v$(shell grep -E '__version__ = ".*"' pyrogram/__init__.py | cut -d\" -f2)
4+
TAG = v$(shell grep -E '__version__ = ".*"' pyrogramv2/__init__.py | cut -d\" -f2)
55

66
RM := rm -rf
77

@@ -11,14 +11,14 @@ venv:
1111
$(RM) $(VENV)
1212
python3 -m venv $(VENV)
1313
$(PYTHON) -m pip install -U pip wheel setuptools
14-
$(PYTHON) -m pip install -U -r requirements.txt -r dev-requirements.txt
14+
$(PYTHON) -m pip install -U -e .
1515
@echo "Created venv with $$($(PYTHON) --version)"
1616

1717
clean-build:
1818
$(RM) *.egg-info build dist
1919

2020
clean-api:
21-
$(RM) pyrogram/errors/exceptions pyrogram/raw/all.py pyrogram/raw/base pyrogram/raw/functions pyrogram/raw/types
21+
$(RM) pyrogramv2/errors/exceptions pyrogramv2/raw/all.py pyrogramv2/raw/base pyrogramv2/raw/functions pyrogramv2/raw/types
2222

2323
clean:
2424
make clean-build

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
</a>
2323
</p>
2424

25-
## Pyrogram
25+
## PyrogramV2
2626

2727
> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
2828
2929
``` python
30-
from pyrogram import Client, filters
30+
from pyrogramv2 import Client, filters
3131

3232
app = Client("my_account")
3333

@@ -65,7 +65,7 @@ If you'd like to support Pyrogram, you can consider:
6565
### Installing
6666

6767
``` bash
68-
pip3 install pyrogram
68+
pip3 install pyrogramv2
6969
```
7070

7171
### Resources

compiler/api/compiler.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# from black import format_str, FileMode
2929

3030
HOME_PATH = Path("compiler/api")
31-
DESTINATION_PATH = Path("pyrogram/raw")
31+
DESTINATION_PATH = Path("pyrogramv2/raw")
3232
NOTICE_PATH = "NOTICE"
3333

3434
SECTION_RE = re.compile(r"---(\w+)---")
@@ -176,13 +176,13 @@ def get_docstring_arg_type(t: str):
176176
else:
177177
return f"``{t.lower()}``"
178178
elif t == "TLObject" or t == "X":
179-
return "Any object from :obj:`~pyrogram.raw.types`"
179+
return "Any object from :obj:`~pyrogramv2.raw.types`"
180180
elif t == "!X":
181-
return "Any function from :obj:`~pyrogram.raw.functions`"
181+
return "Any function from :obj:`~pyrogramv2.raw.functions`"
182182
elif t.lower().startswith("vector"):
183183
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1])
184184
else:
185-
return f":obj:`{t} <pyrogram.raw.base.{t}>`"
185+
return f":obj:`{t} <pyrogramv2.raw.base.{t}>`"
186186

187187

188188
def get_references(t: str, kind: str):
@@ -336,7 +336,7 @@ def start(format: bool = False):
336336

337337
docstring += f"\n\n Constructors:\n" \
338338
f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n" \
339-
f" .. currentmodule:: pyrogram.raw.types\n\n" \
339+
f" .. currentmodule:: pyrogramv2.raw.types\n\n" \
340340
f" .. autosummary::\n" \
341341
f" :nosignatures:\n\n" \
342342
f" {items}"
@@ -346,7 +346,7 @@ def start(format: bool = False):
346346
if references:
347347
docstring += f"\n\n Functions:\n This object can be returned by " \
348348
f"{ref_count} function{'s' if ref_count > 1 else ''}.\n\n" \
349-
f" .. currentmodule:: pyrogram.raw.functions\n\n" \
349+
f" .. currentmodule:: pyrogramv2.raw.functions\n\n" \
350350
f" .. autosummary::\n" \
351351
f" :nosignatures:\n\n" \
352352
f" " + references
@@ -419,7 +419,7 @@ def start(format: bool = False):
419419
constructor_docs = "Telegram API type."
420420

421421
docstring += constructor_docs + "\n"
422-
docstring += f"\n Constructor of :obj:`~pyrogram.raw.base.{c.qualtype}`."
422+
docstring += f"\n Constructor of :obj:`~pyrogramv2.raw.base.{c.qualtype}`."
423423
else:
424424
function_docs = docs["method"].get(c.qualname, None)
425425

@@ -440,7 +440,7 @@ def start(format: bool = False):
440440
if references:
441441
docstring += f"\n Functions:\n This object can be returned by " \
442442
f"{count} function{'s' if count > 1 else ''}.\n\n" \
443-
f" .. currentmodule:: pyrogram.raw.functions\n\n" \
443+
f" .. currentmodule:: pyrogramv2.raw.functions\n\n" \
444444
f" .. autosummary::\n" \
445445
f" :nosignatures:\n\n" \
446446
f" " + references
@@ -630,23 +630,23 @@ def start(format: bool = False):
630630
f.write("objects = {")
631631

632632
for c in combinators:
633-
f.write(f'\n {c.id}: "pyrogram.raw.{c.section}.{c.qualname}",')
633+
f.write(f'\n {c.id}: "pyrogramv2.raw.{c.section}.{c.qualname}",')
634634

635-
f.write('\n 0xbc799737: "pyrogram.raw.core.BoolFalse",')
636-
f.write('\n 0x997275b5: "pyrogram.raw.core.BoolTrue",')
637-
f.write('\n 0x1cb5c415: "pyrogram.raw.core.Vector",')
638-
f.write('\n 0x73f1f8dc: "pyrogram.raw.core.MsgContainer",')
639-
f.write('\n 0xae500895: "pyrogram.raw.core.FutureSalts",')
640-
f.write('\n 0x0949d9dc: "pyrogram.raw.core.FutureSalt",')
641-
f.write('\n 0x3072cfa1: "pyrogram.raw.core.GzipPacked",')
642-
f.write('\n 0x5bb8e511: "pyrogram.raw.core.Message",')
635+
f.write('\n 0xbc799737: "pyrogramv2.raw.core.BoolFalse",')
636+
f.write('\n 0x997275b5: "pyrogramv2.raw.core.BoolTrue",')
637+
f.write('\n 0x1cb5c415: "pyrogramv2.raw.core.Vector",')
638+
f.write('\n 0x73f1f8dc: "pyrogramv2.raw.core.MsgContainer",')
639+
f.write('\n 0xae500895: "pyrogramv2.raw.core.FutureSalts",')
640+
f.write('\n 0x0949d9dc: "pyrogramv2.raw.core.FutureSalt",')
641+
f.write('\n 0x3072cfa1: "pyrogramv2.raw.core.GzipPacked",')
642+
f.write('\n 0x5bb8e511: "pyrogramv2.raw.core.Message",')
643643

644644
f.write("\n}\n")
645645

646646

647647
if "__main__" == __name__:
648648
HOME_PATH = Path(".")
649-
DESTINATION_PATH = Path("../../pyrogram/raw")
649+
DESTINATION_PATH = Path("../../pyrogramv2/raw")
650650
NOTICE_PATH = Path("../../NOTICE")
651651

652652
start(format=False)

compiler/api/template/combinator.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from io import BytesIO
44

5-
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
6-
from pyrogram.raw.core import TLObject
7-
from pyrogram import raw
5+
from pyrogramv2.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
6+
from pyrogramv2.raw.core import TLObject
7+
from pyrogramv2 import raw
88
from typing import List, Optional, Any
99

1010
{warning}

compiler/api/template/type.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{warning}
44

55
from typing import Union
6-
from pyrogram import raw
7-
from pyrogram.raw.core import TLObject
6+
from pyrogramv2 import raw
7+
from pyrogramv2.raw.core import TLObject
88

99
{name} = Union[{types}]
1010

@@ -14,7 +14,7 @@ class {name}: # type: ignore
1414
"""{docstring}
1515
"""
1616

17-
QUALNAME = "pyrogram.raw.base.{qualname}"
17+
QUALNAME = "pyrogramv2.raw.base.{qualname}"
1818

1919
def __init__(self):
2020
raise TypeError("Base types can only be used for type checking purposes: "

compiler/docs/compiler.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
DESTINATION = "docs/source/telegram"
2626
PYROGRAM_API_DEST = "docs/source/api"
2727

28-
FUNCTIONS_PATH = "pyrogram/raw/functions"
29-
TYPES_PATH = "pyrogram/raw/types"
30-
BASE_PATH = "pyrogram/raw/base"
28+
FUNCTIONS_PATH = "pyrogramv2/raw/functions"
29+
TYPES_PATH = "pyrogramv2/raw/types"
30+
BASE_PATH = "pyrogramv2/raw/base"
3131

3232
FUNCTIONS_BASE = "functions"
3333
TYPES_BASE = "types"
@@ -78,7 +78,7 @@ def build(path, level=0):
7878
page_template.format(
7979
title=full_name,
8080
title_markup="=" * len(full_name),
81-
full_class_path="pyrogram.raw.{}".format(
81+
full_class_path="pyrogramv2.raw.{}".format(
8282
".".join(full_path.split("/")[:-1]) + "." + name
8383
)
8484
)
@@ -100,14 +100,14 @@ def build(path, level=0):
100100

101101
if k != base:
102102
inner_path = base + "/" + k + "/index" + ".rst"
103-
module = "pyrogram.raw.{}.{}".format(base, k)
103+
module = "pyrogramv2.raw.{}.{}".format(base, k)
104104
else:
105105
for i in sorted(list(all_entities), reverse=True):
106106
if i != base:
107107
entities.insert(0, "{0}/index".format(i))
108108

109109
inner_path = base + "/index" + ".rst"
110-
module = "pyrogram.raw.{}".format(base)
110+
module = "pyrogramv2.raw.{}".format(base)
111111

112112
with open(DESTINATION + "/" + inner_path, "w", encoding="utf-8") as f:
113113
if k == base:
@@ -126,7 +126,7 @@ def build(path, level=0):
126126
f.write("\n")
127127

128128

129-
def pyrogram_api():
129+
def pyrogramv2_api():
130130
def get_title_list(s: str) -> list:
131131
return [i.strip() for i in [j.strip() for j in s.split("\n") if j] if i]
132132

@@ -353,7 +353,7 @@ def get_title_list(s: str) -> list:
353353
title = "{}()".format(method)
354354

355355
f2.write(title + "\n" + "=" * len(title) + "\n\n")
356-
f2.write(".. automethod:: pyrogram.Client.{}()".format(method))
356+
f2.write(".. automethod:: pyrogramv2.Client.{}()".format(method))
357357

358358
functions = ["idle", "compose"]
359359

@@ -362,7 +362,7 @@ def get_title_list(s: str) -> list:
362362
title = "{}()".format(func)
363363

364364
f2.write(title + "\n" + "=" * len(title) + "\n\n")
365-
f2.write(".. autofunction:: pyrogram.{}()".format(func))
365+
f2.write(".. autofunction:: pyrogramv2.{}()".format(func))
366366

367367
f.write(template.format(**fmt_keys))
368368

@@ -517,7 +517,7 @@ def get_title_list(s: str) -> list:
517517
title = "{}".format(type)
518518

519519
f2.write(title + "\n" + "=" * len(title) + "\n\n")
520-
f2.write(".. autoclass:: pyrogram.types.{}()\n".format(type))
520+
f2.write(".. autoclass:: pyrogramv2.types.{}()\n".format(type))
521521

522522
f.write(template.format(**fmt_keys))
523523

@@ -631,7 +631,7 @@ def get_title_list(s: str) -> list:
631631
title = "{}()".format(bm)
632632

633633
f2.write(title + "\n" + "=" * len(title) + "\n\n")
634-
f2.write(".. automethod:: pyrogram.types.{}()".format(bm))
634+
f2.write(".. automethod:: pyrogramv2.types.{}()".format(bm))
635635

636636
f.write(template.format(**fmt_keys))
637637

@@ -651,13 +651,13 @@ def start():
651651
generate(TYPES_PATH, TYPES_BASE)
652652
generate(FUNCTIONS_PATH, FUNCTIONS_BASE)
653653
generate(BASE_PATH, BASE_BASE)
654-
pyrogram_api()
654+
pyrogramv2_api()
655655

656656

657657
if "__main__" == __name__:
658-
FUNCTIONS_PATH = "../../pyrogram/raw/functions"
659-
TYPES_PATH = "../../pyrogram/raw/types"
660-
BASE_PATH = "../../pyrogram/raw/base"
658+
FUNCTIONS_PATH = "../../pyrogramv2/raw/functions"
659+
TYPES_PATH = "../../pyrogramv2/raw/types"
660+
BASE_PATH = "../../pyrogramv2/raw/base"
661661
HOME = "."
662662
DESTINATION = "../../docs/source/telegram"
663663
PYROGRAM_API_DEST = "../../docs/source/api"

0 commit comments

Comments
 (0)