Skip to content

Commit bd7117d

Browse files
authored
Rewrite README in markdown (#6)
1 parent a1a8d3a commit bd7117d

File tree

3 files changed

+69
-57
lines changed

3 files changed

+69
-57
lines changed

README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Maybe
2+
3+
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/rustedpy/maybe/ci.yml?branch=master)](https://github.com/rustedpy/maybe/actions/workflows/ci.yml?query=branch%3Amaster)
4+
[![Coverage](https://codecov.io/gh/rustedpy/maybe/branch/master/graph/badge.svg)](https://codecov.io/gh/rustedpy/maybe)
5+
6+
A simple Maybe (Option) type for Python 3 [inspired by Rust](
7+
https://doc.rust-lang.org/std/option/), fully type annotated.
8+
9+
## Installation
10+
11+
Latest release:
12+
13+
```sh
14+
$ pip install rustedpy-maybe
15+
```
16+
17+
18+
Latest GitHub `master` branch version:
19+
20+
```sh
21+
$ pip install git+https://github.com/rustedpy/maybe
22+
```
23+
24+
## Summary
25+
26+
**Experimental. API subject to change.**
27+
28+
The idea is that a possible value can be either `Some(value)` or `Nothing()`,
29+
with a way to differentiate between the two. `Some` and `Nothing` are both
30+
classes encapsulating a possible value.
31+
32+
Example usage,
33+
34+
```python
35+
from maybe import Nothing, Some
36+
37+
o = Some('yay')
38+
n = Nothing()
39+
assert o.unwrap_or_else(str.upper) == 'yay'
40+
assert n.unwrap_or_else(lambda: 'default') == 'default'
41+
```
42+
43+
## Contributing
44+
45+
These steps should work on any Unix-based system (Linux, macOS, etc) with Python
46+
and `make` installed. On Windows, you will need to refer to the Python
47+
documentation (linked below) and reference the `Makefile` for commands to run
48+
from the non-unix shell you're using on Windows.
49+
50+
1. Setup and activate a virtual environment. See [Python docs][pydocs-venv] for more
51+
information about virtual environments and setup.
52+
2. Run `make install` to install dependencies
53+
3. Switch to a new git branch and make your changes
54+
4. Test your changes:
55+
- `make test`
56+
- `make lint`
57+
- You can also start a Python REPL and import `maybe`
58+
5. Update documentation
59+
- Edit any relevant docstrings, markdown files
60+
- Run `make docs`
61+
6. Add an entry to the [changelog](./CHANGELOG.md)
62+
5. Git commit all your changes and create a new PR.
63+
64+
[pydocs-venv]: https://docs.python.org/3/library/venv.html
65+
66+
## License
67+
68+
MIT License

README.rst

-56
This file was deleted.

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = rustedpy-maybe
33
version = attr: maybe.__version__
44
description = A Rust-like option type for Python
5-
long_description = file: README.rst
5+
long_description = file: README.md
66
keywords = rust, option, maybe, enum
77
author = francium
88
author_email = [email protected]

0 commit comments

Comments
 (0)