Skip to content

Commit

Permalink
Rewrite README in markdown (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
francium authored Jun 2, 2024
1 parent a1a8d3a commit bd7117d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 57 deletions.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Maybe

[![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)
[![Coverage](https://codecov.io/gh/rustedpy/maybe/branch/master/graph/badge.svg)](https://codecov.io/gh/rustedpy/maybe)

A simple Maybe (Option) type for Python 3 [inspired by Rust](
https://doc.rust-lang.org/std/option/), fully type annotated.

## Installation

Latest release:

```sh
$ pip install rustedpy-maybe
```


Latest GitHub `master` branch version:

```sh
$ pip install git+https://github.com/rustedpy/maybe
```

## Summary

**Experimental. API subject to change.**

The idea is that a possible value can be either `Some(value)` or `Nothing()`,
with a way to differentiate between the two. `Some` and `Nothing` are both
classes encapsulating a possible value.

Example usage,

```python
from maybe import Nothing, Some

o = Some('yay')
n = Nothing()
assert o.unwrap_or_else(str.upper) == 'yay'
assert n.unwrap_or_else(lambda: 'default') == 'default'
```

## Contributing

These steps should work on any Unix-based system (Linux, macOS, etc) with Python
and `make` installed. On Windows, you will need to refer to the Python
documentation (linked below) and reference the `Makefile` for commands to run
from the non-unix shell you're using on Windows.

1. Setup and activate a virtual environment. See [Python docs][pydocs-venv] for more
information about virtual environments and setup.
2. Run `make install` to install dependencies
3. Switch to a new git branch and make your changes
4. Test your changes:
- `make test`
- `make lint`
- You can also start a Python REPL and import `maybe`
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

## License

MIT License
56 changes: 0 additions & 56 deletions README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = rustedpy-maybe
version = attr: maybe.__version__
description = A Rust-like option type for Python
long_description = file: README.rst
long_description = file: README.md
keywords = rust, option, maybe, enum
author = francium
author_email = [email protected]
Expand Down

0 comments on commit bd7117d

Please sign in to comment.