Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Functions need docstrings #45

Open
bast opened this issue Jan 4, 2021 · 2 comments
Open

API Functions need docstrings #45

bast opened this issue Jan 4, 2021 · 2 comments
Assignees

Comments

@bast
Copy link
Member

bast commented Jan 4, 2021

No description provided.

@olemb
Copy link

olemb commented Jan 5, 2021

I've been testing a bit. (More since my email earlier.)

You can add a doc string to the module here:

/// Numgrid is a library that produces numerical integration
/// grid for molecules based on atom coordinates, atom types,
/// and basis set information. This library provides Rust and
/// Python bindings.
#[pymodule]
fn numgrid(_py: Python, m: &PyModule) -> PyResult<()> {

and a function doc string:

/// angular_grid(num_points)
/// --
///
/// Returns angular grid points or something like that.
#[pyfunction]
pub fn angular_grid(num_points: usize) -> (Vec<(f64, f64, f64)>, Vec<f64>) {

pydoc numgrid will now show:

NAME
    numgrid

DESCRIPTION
    Numgrid is a library that produces numerical integration
    grid for molecules based on atom coordinates, atom types,
    and basis set information. This library provides Rust and
    Python bindings.

FUNCTIONS
    angular_grid(num_points)
        Returns angular grid points or something like that.
    atom_grid(...)
    atom_grid_bse(...)    
    radial_grid(...)

I would be nice if the function Pyo3 picked up the function signatures automatically. There also seems to be no way to use type annotation and to annotate return values but I suppose this can be described in the doc string if needed.

@bast
Copy link
Member Author

bast commented Jan 5, 2021

Thanks for testing this!

@bast bast self-assigned this Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants