#cargo

build rustpython-doc

Python __doc__ database

1 unstable release

0.3.0 Aug 30, 2023

#490 in #cargo

Download history 258/week @ 2024-06-10 183/week @ 2024-06-17 302/week @ 2024-06-24 220/week @ 2024-07-01 331/week @ 2024-07-08 424/week @ 2024-07-15 539/week @ 2024-07-22 444/week @ 2024-07-29 497/week @ 2024-08-05 401/week @ 2024-08-12 257/week @ 2024-08-19 330/week @ 2024-08-26 376/week @ 2024-09-02 294/week @ 2024-09-09 244/week @ 2024-09-16 519/week @ 2024-09-23

1,461 downloads per month
Used in 10 crates (via rustpython-derive-impl)

Custom license

425KB
2K SLoC

__doc__ for RustPython

This is the __doc__ attributes generator for objects written in RustPython.

It's composed of two parts of:

  • the generate_docs.py script that extracts the __doc__ attributes from CPython to docs.inc.rs
  • the rustpython-doc rust crate that uses the docs.inc.rs file to create a documentation Database.

This documentation database is then used by macros pymodule and pyclass macros of the rustpython-derive crate to automatically add the __doc__ attribute.

The docs.inc.rs database file can be generated with

$ python -m venv gendocs
$ source gendocs/bin/activate
$ python -I generate_docs.py <path_to_RustPython> docs.inc.rs
$ deactivate

or using docker

$ docker pull python:slim
$ docker run python:slim python --version
Python 3.10.8
$ ls
__doc__  RustPython
$ docker run -v $(pwd):/RustPython -w /RustPython/__doc__ python:slim python generate_docs.py ../RustPython docs.inc.rs

and do not forget to update cargo before the test

$ cargo update

Why the __doc__ is not changed?

Check the old documentation implemented with remarks are still exist

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.

Contributing

Contributions are more than welcome, and in many cases we are happy to guide contributors through PRs or on gitter. Please refer to the development guide as well for tips on developments.

License

This project is licensed under the MIT license. Please see the LICENSE file for more details.

The project logo is licensed under the CC-BY-4.0 license. Please see the LICENSE-logo file for more details.

Dependencies