diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d2ddc8 --- /dev/null +++ b/README.md @@ -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 diff --git a/README.rst b/README.rst deleted file mode 100644 index 18f5d2c..0000000 --- a/README.rst +++ /dev/null @@ -1,56 +0,0 @@ -====== -Maybe -====== - -.. image:: https://img.shields.io/github/actions/workflow/status/rustedpy/maybe/ci.yml?branch=master - :alt: GitHub Workflow Status (branch) - :target: https://github.com/rustedpy/maybe/actions/workflows/ci.yml?query=branch%3Amaster - -.. image:: https://codecov.io/gh/rustedpy/maybe/branch/master/graph/badge.svg - :alt: Coverage - :target: https://codecov.io/gh/rustedpy/maybe - -A simple Maybe (Option) type for Python 3 `inspired by Rust -`__, fully type annotated. - -Installation -============ - -Latest release: - -.. sourcecode:: sh - - $ pip install rustedpy-maybe - - -Latest GitHub ``master`` branch version: - -.. sourcecode:: 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, - -.. sourcecode:: 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' - - -License -======= - -MIT License diff --git a/setup.cfg b/setup.cfg index 2c010d6..0c8bb7f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 = francium@francium.cc