Skip to content

Commit 4083cad

Browse files
authored
Merge branch 'main' into add-readme
2 parents 21e9e57 + 49c74bc commit 4083cad

File tree

3 files changed

+229
-1073
lines changed

3 files changed

+229
-1073
lines changed

README.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,53 @@
11
<img src="./logo.png" width="125" height="125" align="right" />
22

3-
# rustpython-doc
3+
# `__doc__` for [RustPython](https://rustpython.github.io/)
44

5-
This `rustpython-doc` package contains all `__doc__` database in forms of `docs.inc.rs`.
5+
This is the `__doc__` attributes generator for objects written in RustPython.
66

7-
## How to update `__doc__` in RustPython
7+
It's composed of two parts of:
88

9-
Adding a remake in front of `[pyclass]` of `[pyfunction]` will simply make the documentation to themselves, however, we do not manually add docs anymore.
9+
- the `generate_docs.py` script that extracts the `__doc__` attributes from CPython to `docs.inc.rs`
10+
- the `rustpython-doc` rust crate that uses the `docs.inc.rs` file to create a documentation Database.
1011

11-
> But we don't manually add docs anymore. We have an auto-generated document db.
12-
>
13-
> The db is generated by scripts/generate_docs.py and applied to each object and functions by rustpython-doc::Database (search for crate::doc::Database::shared() in source code)
14-
>
15-
> *- Originally posted by @youknowone in [RustPython#4205 (comment)](https://github.com/RustPython/RustPython/pull/4205)*
12+
This documentation database is then used by macros `pymodule` and `pyclass` macros of the rustpython-derive crate to automatically add the `__doc__` attribute.
1613

17-
Therefore you must update `docs.in.rs`, if it is unnecessary to different from cpython's `__doc__`
14+
The `docs.inc.rs` database file can be generated with
1815

19-
## How to update `docs.in.rs`
16+
$ python -m venv gendocs
17+
$ source gendocs/bin/activate
18+
$ python -I generate_docs.py <path_to_RustPython> docs.inc.rs
19+
$ deactivate
2020

21-
To update `__doc__` for newer python version:
21+
or using docker
2222

23-
```
24-
$ python generate_docs.py {RustPython PATH} ./docs.inc.rs
25-
```
26-
This will iterate all stdlib modules to inspect their `__doc__`, updating your local `docs.in.rs` file. Since RustPython is only able to access the database in this online package, the changes must be merged into this branch.
23+
$ docker pull python:slim
24+
$ docker run python:slim python --version
25+
Python 3.10.8
26+
$ ls
27+
__doc__ RustPython
28+
$ docker run -v $(pwd):/RustPython -w /RustPython/__doc__ python:slim python generate_docs.py ../RustPython docs.inc.rs
2729

28-
After that, update cargo:
30+
31+
and do not forget to update cargo before the test
2932
```
3033
$ cargo update
3134
```
3235
## Why the `__doc__` is not changed?
3336

34-
### Check if it is related to the unclosed issue
35-
There is still some issue with `generate_docs.py`
36-
- https://github.com/RustPython/RustPython/issues/3973
37+
### Check the old documentation implemented with remarks are still exist
38+
RustPython prioritizes the user define documentation. Check if the old remarks are remaining in the source code. If it is, simply removing them could solve the issue.
39+
40+
## Contributing
3741

42+
Contributions are more than welcome, and in many cases we are happy to guide
43+
contributors through PRs or on gitter. Please refer to the
44+
[development guide](https://github.com/RustPython/RustPython/DEVELOPMENT.md) as well for tips on developments.
3845

46+
## License
3947

40-
### Check if the old remark documentation are not removed yet
48+
This project is licensed under the MIT license. Please see the
49+
[LICENSE](https://github.com/RustPython/RustPython/LICENSE) file for more details.
4150

42-
RustPython prioritizes the user define documentation first. Check if old remarks remaining in the source code, and remove them.
51+
The [project logo](https://github.com/RustPython/RustPython/logo.png) is licensed under the CC-BY-4.0
52+
license. Please see the [LICENSE-logo](https://github.com/RustPython/RustPython/LICENSE-logo) file
53+
for more details.

0 commit comments

Comments
 (0)