Skip to content

Commit ca843f7

Browse files
committed
rename to pyrogramv1
1 parent 4998221 commit ca843f7

File tree

443 files changed

+1798
-5630
lines changed

Some content is hidden

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

443 files changed

+1798
-5630
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

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
1-
name: Pyrogram
1+
name: PyrogramV1
22

33
on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ${{ matrix.os }}
98
strategy:
109
matrix:
11-
os: [ubuntu-latest, macos-latest, windows-latest]
12-
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
13-
10+
os: [ubuntu-latest, macos-latest]
11+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1412
steps:
15-
- uses: actions/checkout@v2
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: |
29-
python setup.py generate --api
30-
24+
make venv
25+
make api
3126
- name: Run tests
3227
run: |
33-
tox
28+
tox

.gitignore

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ main.py
55
unknown_errors.txt
66

77
# Pyrogram generated code
8-
pyrogram/errors/exceptions/
9-
pyrogram/raw/functions/
10-
pyrogram/raw/types/
11-
pyrogram/raw/base/
12-
pyrogram/raw/all.py
8+
pyrogramv1/errors/exceptions/
9+
pyrogramv1/raw/functions/
10+
pyrogramv1/raw/types/
11+
pyrogramv1/raw/base/
12+
pyrogramv1/raw/all.py
1313
docs/source/telegram
1414
docs/source/api/methods/
1515
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 pyrogramv1/errors/exceptions
8+
prune pyrogramv1/raw/functions
9+
prune pyrogramv1/raw/types
10+
prune pyrogramv1/raw/base
11+
exclude pyrogramv1/raw/all.py

Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
VENV := venv
2+
PYTHON := $(VENV)/bin/python
3+
HOST = $(shell ifconfig | grep "inet " | tail -1 | cut -d\ -f2)
4+
TAG = v$(shell grep -E '__version__ = ".*"' pyrogramv1/__init__.py | cut -d\" -f2)
5+
6+
RM := rm -rf
7+
8+
.PHONY: venv clean-build clean-api clean api build
9+
10+
venv:
11+
$(RM) $(VENV)
12+
python3 -m venv $(VENV)
13+
$(PYTHON) -m pip install -U pip wheel setuptools
14+
$(PYTHON) -m pip install -U -e .
15+
@echo "Created venv with $$($(PYTHON) --version)"
16+
17+
clean-build:
18+
$(RM) *.egg-info build dist
19+
20+
clean-api:
21+
$(RM) pyrogramv1/errors/exceptions pyrogramv1/raw/all.py pyrogramv1/raw/base pyrogramv1/raw/functions pyrogramv1/raw/types
22+
23+
clean:
24+
make clean-build
25+
make clean-api
26+
27+
api:
28+
cd compiler/api && ../../$(PYTHON) compiler.py
29+
cd compiler/errors && ../../$(PYTHON) compiler.py
30+
31+
build:
32+
make clean
33+
$(PYTHON) setup.py sdist
34+
$(PYTHON) setup.py bdist_wheel
35+
36+
tag:
37+
git tag $(TAG)
38+
git push origin $(TAG)
39+
40+
dtag:
41+
git tag -d $(TAG)
42+
git push origin -d $(TAG)

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
</a>
1919
</p>
2020

21-
## Pyrogram
21+
## PyrogramV1
2222

2323
> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
2424
2525
``` python
26-
from pyrogram import Client, filters
26+
from pyrogramv1 import Client, filters
2727

2828
app = Client("my_account")
2929

@@ -61,7 +61,7 @@ If you'd like to support Pyrogram, you can consider:
6161
### Installing
6262

6363
``` bash
64-
pip3 install pyrogram
64+
pip3 install pyrogramv1
6565
```
6666

6767
### Resources

compiler/api/compiler.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# from black import format_str, FileMode
2828

2929
HOME_PATH = Path("compiler/api")
30-
DESTINATION_PATH = Path("pyrogram/raw")
30+
DESTINATION_PATH = Path("pyrogramv1/raw")
3131
NOTICE_PATH = "NOTICE"
3232

3333
SECTION_RE = re.compile(r"---(\w+)---")
@@ -149,7 +149,7 @@ def remove_whitespaces(source: str) -> str:
149149
return "\n".join(lines)
150150

151151

152-
def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool = False):
152+
def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogramv1_type: bool = False):
153153
if t in CORE_TYPES:
154154
if t == "long":
155155
return "``int`` ``64-bit``"
@@ -165,13 +165,13 @@ def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool
165165
else:
166166
return f"``{t.lower()}``"
167167
elif t == "TLObject" or t == "X":
168-
return "Any object from :obj:`~pyrogram.raw.types`"
168+
return "Any object from :obj:`~pyrogramv1.raw.types`"
169169
elif t == "!X":
170-
return "Any method from :obj:`~pyrogram.raw.functions`"
170+
return "Any method from :obj:`~pyrogramv1.raw.functions`"
171171
elif t.lower().startswith("vector"):
172172
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1], True)
173173
else:
174-
return f":obj:`{t} <pyrogram.raw.base.{t}>`"
174+
return f":obj:`{t} <pyrogramv1.raw.base.{t}>`"
175175

176176

177177
def get_references(t: str, kind: str):
@@ -184,7 +184,7 @@ def get_references(t: str, kind: str):
184184

185185
if t:
186186
return "\n ".join(
187-
f"- :obj:`{i} <pyrogram.raw.functions.{i}>`"
187+
f"- :obj:`{i} <pyrogramv1.raw.functions.{i}>`"
188188
for i in t
189189
), len(t)
190190

@@ -315,7 +315,7 @@ def start(format: bool = False):
315315

316316
constructors = sorted(types_to_constructors[qualtype])
317317
constr_count = len(constructors)
318-
items = "\n ".join([f"- :obj:`{c} <pyrogram.raw.types.{c}>`" for c in constructors])
318+
items = "\n ".join([f"- :obj:`{c} <pyrogramv1.raw.types.{c}>`" for c in constructors])
319319

320320
docstring = f"This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n"
321321
docstring += f" Constructors:\n .. hlist::\n :columns: 2\n\n {items}"
@@ -369,12 +369,12 @@ def start(format: bool = False):
369369
"{}{}: {}".format(
370370
arg_name,
371371
" (optional)".format(flag_number) if is_optional else "",
372-
get_docstring_arg_type(arg_type, is_pyrogram_type=c.namespace == "pyrogram")
372+
get_docstring_arg_type(arg_type, is_pyrogramv1_type=c.namespace == "pyrogramv1")
373373
)
374374
)
375375

376376
if c.section == "types":
377-
docstring += f"This object is a constructor of the base type :obj:`~pyrogram.raw.base.{c.qualtype}`.\n\n"
377+
docstring += f"This object is a constructor of the base type :obj:`~pyrogramv1.raw.base.{c.qualtype}`.\n\n"
378378
else:
379379
docstring += f"Telegram API method.\n\n"
380380

@@ -580,23 +580,23 @@ def start(format: bool = False):
580580
f.write("objects = {")
581581

582582
for c in combinators:
583-
f.write(f'\n {c.id}: "pyrogram.raw.{c.section}.{c.qualname}",')
583+
f.write(f'\n {c.id}: "pyrogramv1.raw.{c.section}.{c.qualname}",')
584584

585-
f.write('\n 0xbc799737: "pyrogram.raw.core.BoolFalse",')
586-
f.write('\n 0x997275b5: "pyrogram.raw.core.BoolTrue",')
587-
f.write('\n 0x1cb5c415: "pyrogram.raw.core.Vector",')
588-
f.write('\n 0x73f1f8dc: "pyrogram.raw.core.MsgContainer",')
589-
f.write('\n 0xae500895: "pyrogram.raw.core.FutureSalts",')
590-
f.write('\n 0x0949d9dc: "pyrogram.raw.core.FutureSalt",')
591-
f.write('\n 0x3072cfa1: "pyrogram.raw.core.GzipPacked",')
592-
f.write('\n 0x5bb8e511: "pyrogram.raw.core.Message",')
585+
f.write('\n 0xbc799737: "pyrogramv1.raw.core.BoolFalse",')
586+
f.write('\n 0x997275b5: "pyrogramv1.raw.core.BoolTrue",')
587+
f.write('\n 0x1cb5c415: "pyrogramv1.raw.core.Vector",')
588+
f.write('\n 0x73f1f8dc: "pyrogramv1.raw.core.MsgContainer",')
589+
f.write('\n 0xae500895: "pyrogramv1.raw.core.FutureSalts",')
590+
f.write('\n 0x0949d9dc: "pyrogramv1.raw.core.FutureSalt",')
591+
f.write('\n 0x3072cfa1: "pyrogramv1.raw.core.GzipPacked",')
592+
f.write('\n 0x5bb8e511: "pyrogramv1.raw.core.Message",')
593593

594594
f.write("\n}\n")
595595

596596

597597
if "__main__" == __name__:
598598
HOME_PATH = Path(".")
599-
DESTINATION_PATH = Path("../../pyrogram/raw")
599+
DESTINATION_PATH = Path("../../pyrogramv1/raw")
600600
NOTICE_PATH = Path("../../NOTICE")
601601

602602
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 pyrogramv1.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
6+
from pyrogramv1.raw.core import TLObject
7+
from pyrogramv1 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 pyrogramv1 import raw
7+
from pyrogramv1.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 = "pyrogramv1.raw.base.{qualname}"
1818

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

0 commit comments

Comments
 (0)