Skip to content

Module documentation doesn't show up #1894

@teenjuna

Description

@teenjuna

🌍 Environment

  • Your operating system and version: MacOS 11.5.2
  • Your python version: 3.9.7
  • How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: using brew
  • Your Rust version (rustc --version): rustc 1.54.0 (a178d0322 2021-07-26)
  • Your PyO3 version: 0.14.5
  • Have you tried using latest PyO3 main (replace version = "0.x.y" with git = "https://github.com/PyO3/pyo3")?: yes

💥 Reproducing

Repo containing minimal working example: https://github.com/teenjuna/pyo3-doc-bug

❯ cat src/lib.rs
use pyo3::prelude::*;

/// Formats the sum of two numbers as string.
#[pyfunction]
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
    Ok((a + b).to_string())
}

/// This comment should appear in module docs but it doesn't!
#[pymodule]
fn pyo3_doc_bug(_py: Python, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
    Ok(())
}

❯ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at python
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s

❯ python
Python 3.9.7 (default, Sep  3 2021, 04:31:11)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyo3_doc_bug
>>> print(pyo3_doc_bug.__doc__)
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions