Skip to content

Commit c3eaca4

Browse files
committed
(refactor): Migrate documentation to separate repository
1 parent 189c850 commit c3eaca4

106 files changed

Lines changed: 206 additions & 7198 deletions

File tree

Some content is hidden

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

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
required: true
1111
- label: I have searched in the issue tracker for similar bug reports, including closed ones
1212
required: true
13-
- label: I ran `pip3 install https://github.com/TelegramPlayground/pyrogram/archive/dev.zip --force-reinstall` and reproduced the issue using the latest development version
13+
- label: I ran `pip3 install https://github.com/TelegramPlayground/PyroTGFork/archive/dev.zip --force-reinstall` and reproduced the issue using the latest development version
1414
required: true
1515

1616
- type: textarea

.github/workflows/build-docs.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ jobs:
1414
- uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 1
17+
18+
- uses: actions/checkout@v6
19+
with:
20+
repository: TelegramPlayground/pyrogram
21+
ref: master
22+
path: docs
23+
fetch-depth: 1
24+
1725
- name: Set up Python
1826
uses: actions/setup-python@v6
1927
with:
@@ -28,9 +36,18 @@ jobs:
2836
make
2937
cd ./docs/build/html && rm -rf .doctrees && cd ./../../..
3038
39+
- name: Generate GitHub App Token
40+
id: generate-token
41+
uses: actions/create-github-app-token@v1
42+
with:
43+
app-id: ${{ secrets.ORG_APP_ID }}
44+
private-key: ${{ secrets.ORG_APP_PRIVATE_KEY }}
45+
owner: TelegramPlayground
46+
3147
- uses: peaceiris/actions-gh-pages@v4
3248
with:
33-
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
personal_token: ${{ steps.generate-token.outputs.token }}
50+
external_repository: TelegramPlayground/pyrogram
3451
publish_dir: ./docs/build/html
3552
publish_branch: gh-pages
3653
user_name: 'github-actions[bot]'

CONTRIBUTING.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Contributing to this Pyrogram Fork
2+
3+
Welcome, and thank you for your interest in contributing to this Pyrogram Fork!
4+
5+
Pyrogram was (and hopefully should continue to be) an open source project that depends on the generous help of contributors who volunteer their time and skills. We appreciate your involvement and support.
6+
7+
You can contribute in many ways, not only by writing code. This document aims to give you a high-level overview of how you can get involved.
8+
9+
## What Can I Do?
10+
11+
In short: anything you find useful!
12+
13+
If you’re unsure whether your changes are welcome, open an issue on GitHub or preferably ask in the [Telegram chat](https://t.me/pyrotgfork/2).
14+
15+
In case you’d like to get some inspiration what we're working on, we have a [long list of issues across all repositories](https://github.com/issues?q=is%3Aissue%20is%3Aopen%20(repo%3ATelegramPlayground%2FPyroTGFork%20OR%20repo%3ATelegramPlayground%2Fpyrogram%20OR%20repo%3ATelegramPlayground%2Fpyrogram-tgcrypto)%20sort%3Acreated-desc) and there is usually also a [pinned issue](https://github.com/TelegramPlayground/PyroTGFork/issues) which tells you which issues need help.
16+
17+
## Asking Questions
18+
19+
If you have a question, please use the [Telegram Chat](https://t.me/pyrotgfork/2) instead of opening an issue. Simply start a message in the correct topic and our community will gladly answer.
20+
21+
## Providing Feedback
22+
23+
Feedback from the community is very important to us as the maintainers of this Pyrogram fork. If you have any suggestions, ideas, or concerns, please share them with us. You can use the [Telegram Chat](https://t.me/pyrotgfork/2) to start a conversation.
24+
25+
You might be wondering about the difference between asking questions, providing feedback, and making feature requests. Asking questions is about seeking help or clarification. Providing feedback involves sharing your thoughts and opinions on the existing features and the project as a whole. Feature requests, on the other hand, are about suggesting new features or improvements. See the next section for more details on feature requests.
26+
27+
## Creating Issues
28+
29+
Have you identified a reproducible problem in this Pyrogram fork? Do you have a feature request? Here is how you can report your issue as efficiently as possible.
30+
31+
### Look For an Existing Issue
32+
33+
Before creating a new issue, check the open issues to see if someone else has already reported the same problem or requested the same feature.
34+
35+
If you find an existing issue that is relevant to yours, you can comment on it and express your support or disagreement with a reaction:
36+
37+
- upvote 👍
38+
- downvote 👎
39+
40+
If none of the open issues match your case, then create a new issue following the guidelines below.
41+
42+
### How to Write a Bug Report
43+
44+
A bug report should contain the following information:
45+
46+
- A clear and descriptive title that summarizes the problem.
47+
- A brief description of what you were doing when the bug occurred, and what you expected to happen.
48+
- A detailed description of the actual behavior and how it differs from the expected behavior.
49+
- [Steps to reproduce the bug](https://stackoverflow.com/help/minimal-reproducible-example), preferably in as much detail as possible in text format.
50+
- The version of Pyrogram and the operating system you are using. Kindly refrain from reporting issues noticed incase you are unable to reproduce it consistently with this Pyrogram fork.
51+
- Any relevant error messages or logs.
52+
53+
### How to Write a Feature Request
54+
55+
A feature request should contain the following information:
56+
57+
- A clear and descriptive title that summarizes the feature.
58+
- A brief explanation of why you need this feature and how it would benefit the project and the community.
59+
- A detailed description of how the feature should work and what it should look like, preferably with examples.
60+
- Optionally any relevant links or references to similar features in other projects or applications.
61+
62+
## Creating a Pull Request
63+
64+
To contribute code to this Pyrogram fork, simply open a pull request by following the guide below.
65+
66+
You can read more about pull requests in the [GitHub docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
67+
68+
### Setting Up Development Environment
69+
70+
1. Fork this Pyrogram repository to your GitHub account.
71+
2. Clone your forked repository of Pyrogram to your computer:
72+
73+
```bash
74+
git clone https://github.com/<your username>/pyrogram
75+
cd pyrogram
76+
```
77+
78+
4. Add a track to the original repository:
79+
80+
```bash
81+
git remote add upstream https://github.com/TelegramPlayGround/PyroTGFork
82+
```
83+
84+
5. Install dependencies:
85+
86+
```bash
87+
pip install --force-reinstall .[dev]
88+
```
89+
90+
### Run tests
91+
92+
All changes should be tested:
93+
94+
```bash
95+
pytest tests
96+
```
97+
98+
Remember to write tests for your new features or modify the existing tests to cover your code changes. Testing is essential to ensure the quality and reliability of your code.
99+
100+
### Docs
101+
102+
We use Sphinx to generate documentation in the [docs](https://github.com/TelegramPlayground/pyrogram) repository. You can edit the sources and preview the changes using a live-preview server with:
103+
104+
```bash
105+
make docs-live
106+
```
107+
108+
### Commit Messages
109+
110+
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), which provide a standardized and structured format for commit messages. This helps ensure clear and consistent communication about the changes made in each commit. The commit messages should have the following structure:
111+
112+
```
113+
<type>[optional scope]: <description>
114+
115+
[optional body]
116+
117+
[optional footer(s)]
118+
```
119+
120+
where:
121+
122+
- `<type>`: This is a keyword that indicates the kind of change that the commit introduces. It can be one of the following values: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, or `revert`.
123+
- `[optional scope]`: This is an optional identifier that specifies the scope of the change. It can be a module, a component, a file, or any other logical unit of the project.
124+
- `<description>`: This is a short and concise summary of the change in the present tense and imperative mood. It should not end with a period.
125+
- `[optional body]`: This is an optional section that provides more details and context about the change. It should be separated from the summary by a blank line and wrapped at 72 characters.
126+
- `[optional footer(s)]`: This is an optional section that provides additional information such as references to issues, breaking changes, or acknowledgments. It should be separated from the body by a blank line and follow the format `<key>: <value>`.
127+
128+
For example:
129+
130+
```
131+
feat(storage): support multiple database using orm
132+
133+
This commit adds support for multiple databases using the tortoise-orm. It also updates the configuration file to allow the user to specify the database type and connection string.
134+
135+
BREAKING CHANGE: The database configuration has changed. The user must update the configuration file to specify the database type and connection string.
136+
137+
Closes #123
138+
```
139+
140+
### Describing Changes
141+
142+
Write a concise summary of your changes in one or more sentences, so that bot developers can see what's new or updated in the library.
143+
144+
## Thank You
145+
146+
Your contributions to open source, large or small, make great projects like this possible. Thank you for taking the time to contribute.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ api:
3838
docs-live:
3939
make clean-docs
4040
make api
41-
cd compiler/docs && ../../$(PYTHON) compiler.py
41+
cd docs/compiler && ../../$(PYTHON) compiler.py
4242
$(VENV)/bin/sphinx-autobuild \
4343
--watch pyrogram --watch docs/resources \
4444
-b html "docs/source" "docs/build/html" -j auto
4545

4646
docs:
4747
make clean-docs
48-
cd compiler/docs && ../../$(PYTHON) compiler.py
48+
cd docs/compiler && ../../$(PYTHON) compiler.py
4949
$(VENV)/bin/sphinx-build \
5050
-b html "docs/source" "docs/build/html" -j auto
5151

compiler/api/compiler.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,19 @@ def get_references(t: str, kind: str):
216216
return None, 0
217217

218218

219+
def indent_desc(desc: str, indent: str = " ") -> str:
220+
lines = desc.splitlines()
221+
222+
if len(lines) <= 1:
223+
return desc
224+
225+
first, *rest = lines
226+
227+
return first + "\n" + "\n".join(
228+
(indent + line if line.strip() else "") for line in rest
229+
)
230+
231+
219232
# noinspection PyShadowingBuiltins
220233
def start(format: bool = False):
221234
shutil.rmtree(DESTINATION_PATH / "types", ignore_errors=True)
@@ -352,7 +365,7 @@ def start(format: bool = False):
352365
else:
353366
type_docs = "Telegram API base type."
354367

355-
docstring = type_docs
368+
docstring = indent_desc(type_docs)
356369

357370
docstring += f"\n\n Constructors:\n" \
358371
f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n" \
@@ -417,7 +430,7 @@ def start(format: bool = False):
417430
arg_docs = combinator_docs.get(c.qualname, None)
418431

419432
if arg_docs:
420-
arg_docs = arg_docs["params"].get(arg_name, "N/A")
433+
arg_docs = indent_desc(arg_docs["params"].get(arg_name, "N/A"), indent=" ")
421434
else:
422435
arg_docs = "N/A"
423436

@@ -438,16 +451,22 @@ def start(format: bool = False):
438451
else:
439452
constructor_docs = "Telegram API type."
440453

441-
docstring += constructor_docs + "\n"
454+
docstring += indent_desc(constructor_docs) + "\n"
442455
docstring += f"\n Constructor of :obj:`~pyrogram.raw.base.{c.qualtype}`."
443456
else:
444457
function_docs = docs["method"].get(c.qualname, None)
445458

446459
if function_docs:
447-
docstring += function_docs.get("desc", "").strip() + "\n"
460+
docstring += indent_desc(function_docs.get("desc", "").strip()) + "\n"
448461

449462
if function_docs.get("usable-by", "") != "":
450463
docstring += "\n .. include:: /_includes/usable-by/" + function_docs["usable-by"] + ".rst\n "
464+
465+
if function_docs.get("can_use_without_auth"):
466+
docstring += "\n\n .. note::\n\n " + "This method may be used by not yet logged in connections."
467+
468+
if function_docs.get("can_use_business_connection"):
469+
docstring += "\n\n .. note::\n\n " + "This method may be invoked over a `business connection » <https://corefork.telegram.org/api/bots/connected-business-bots>`__"
451470
else:
452471
docstring += f"Telegram API function."
453472

compiler/docs/__init__.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)