Skip to content

Commit

Permalink
docs: Generate docs (#168)
Browse files Browse the repository at this point in the history
Closes #153
  • Loading branch information
francium authored Dec 23, 2023
1 parent 63b36b7 commit 4218d17
Show file tree
Hide file tree
Showing 6 changed files with 805 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ lint-mypy: phony

test: phony
pytest

docs: phony
lazydocs \
--overview-file README.md \
--src-base-url https://github.com/rustedpy/result/blob/master/ \
./src/result
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ exceptions.

## API

Auto generated API docs are also available at
[./docs/README.md](./docs/README.md).

Creating an instance:

``` python
Expand Down Expand Up @@ -434,7 +437,11 @@ from the non-unix shell you're using on Windows.
- `make test`
- `make lint`
- You can also start a Python REPL and import `result`
5. Git commit and create a new PR.
5. Update documentation
- Edit any relevant docstrings, markdown files
- Run `make docs`
6. Add an entry to the [changelog](./CHANGELOG.md)
5. Git commit all your changes and create a new PR.

[pydocs-venv]: https://docs.python.org/3/library/venv.html

Expand Down
4 changes: 4 additions & 0 deletions docs/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: API Reference
nav:
- Overview: README.md
- ...
28 changes: 28 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- markdownlint-disable -->

# API Overview

## Modules

- [`result`](./result.md#module-result)

## Classes

- [`result.DoException`](./result.md#class-doexception): This is used to signal to `do()` that the result is an `Err`,
- [`result.Err`](./result.md#class-err): A value that signifies failure and which stores arbitrary data for the error.
- [`result.Ok`](./result.md#class-ok): A value that indicates success and which stores arbitrary data for the return value.
- [`result.UnwrapError`](./result.md#class-unwraperror): Exception raised from ``.unwrap_<...>`` and ``.expect_<...>`` calls.

## Functions

- [`result.as_async_result`](./result.md#function-as_async_result): Make a decorator to turn an async function into one that returns a ``Result``.
- [`result.as_result`](./result.md#function-as_result): Make a decorator to turn a function into one that returns a ``Result``.
- [`result.do`](./result.md#function-do): Do notation for Result (syntactic sugar for sequence of `and_then()` calls).
- [`result.do_async`](./result.md#function-do_async): Async version of do. Example:
- [`result.is_err`](./result.md#function-is_err): A typeguard to check if a result is an Err
- [`result.is_ok`](./result.md#function-is_ok): A typeguard to check if a result is an Ok


---

_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._
Loading

0 comments on commit 4218d17

Please sign in to comment.