Skip to content

Commit c92537e

Browse files
committed
Initial commit
0 parents  commit c92537e

19 files changed

+1516
-0
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Check http://editorconfig.org for more information
2+
# This is the main config file for this project:
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
end_of_line = lf
9+
indent_style = space
10+
insert_final_newline = true
11+
indent_size = 2
12+
13+
[*.py]
14+
indent_size = 4

.gitignore

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
#### joe made this: http://goel.io/joe
2+
#### python ####
3+
# Byte-compiled / optimized / DLL files
4+
.pytest_cache
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
*.egg-info/
27+
.installed.cfg
28+
*.egg
29+
pip-wheel-metadata/
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
.hypothesis/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
60+
# Flask stuff:
61+
instance/
62+
.webassets-cache
63+
64+
# Scrapy stuff:
65+
.scrapy
66+
67+
# Sphinx documentation
68+
docs/_build/
69+
70+
# PyBuilder
71+
target/
72+
73+
# Jupyter Notebook
74+
.ipynb_checkpoints
75+
76+
# pyenv
77+
.python-version
78+
79+
# celery beat schedule file
80+
celerybeat-schedule
81+
82+
# SageMath parsed files
83+
*.sage.py
84+
85+
# Environments
86+
.env
87+
.venv
88+
env/
89+
venv/
90+
ENV/
91+
92+
# Spyder project settings
93+
.spyderproject
94+
.spyproject
95+
96+
# Rope project settings
97+
.ropeproject
98+
99+
# mkdocs documentation
100+
/site
101+
102+
# mypy
103+
.mypy_cache/
104+
#### macos ####
105+
# General
106+
*.DS_Store
107+
.AppleDouble
108+
.LSOverride
109+
110+
# Icon must end with two \r
111+
Icon
112+
113+
114+
# Thumbnails
115+
._*
116+
117+
# Files that might appear in the root of a volume
118+
.DocumentRevisions-V100
119+
.fseventsd
120+
.Spotlight-V100
121+
.TemporaryItems
122+
.Trashes
123+
.VolumeIcon.icns
124+
.com.apple.timemachine.donotpresent
125+
126+
# Directories potentially created on remote AFP share
127+
.AppleDB
128+
.AppleDesktop
129+
Network Trash Folder
130+
Temporary Items
131+
.apdisk
132+
#### windows ####
133+
# Windows thumbnail cache files
134+
Thumbs.db
135+
ehthumbs.db
136+
ehthumbs_vista.db
137+
138+
# Dump file
139+
*.stackdump
140+
141+
# Folder config file
142+
Desktop.ini
143+
144+
# Recycle Bin used on file shares
145+
$RECYCLE.BIN/
146+
147+
# Windows Installer files
148+
*.cab
149+
*.msi
150+
*.msm
151+
*.msp
152+
153+
# Windows shortcuts
154+
*.lnk
155+
#### linux ####
156+
*~
157+
158+
# temporary files which can be created if a process still has a handle open of a deleted file
159+
.fuse_hidden*
160+
161+
# KDE directory preferences
162+
.directory
163+
164+
# Linux trash folder which might appear on any partition or disk
165+
.Trash-*
166+
167+
# .nfs files are created when an open file is removed but is still being accessed
168+
.nfs*
169+
#### jetbrains ####
170+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
171+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
172+
173+
# User-specific stuff:
174+
.idea/
175+
176+
## File-based project format:
177+
*.iws
178+
179+
## Plugin-specific files:
180+
181+
# IntelliJ
182+
/out/
183+
184+
# mpeltonen/sbt-idea plugin
185+
.idea_modules/
186+
187+
# JIRA plugin
188+
atlassian-ide-plugin.xml
189+
190+
# Cursive Clojure plugin
191+
.idea/replstate.xml
192+
193+
# Crashlytics plugin (for Android Studio and IntelliJ)
194+
com_crashlytics_export_strings.xml
195+
crashlytics.properties
196+
crashlytics-build.properties
197+
fabric.properties

.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
language: python
2+
3+
matrix:
4+
fast_finish: true
5+
include:
6+
- python: 3.6
7+
- python: 3.7
8+
dist: xenial
9+
sudo: true
10+
11+
12+
before_install:
13+
- curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
14+
- source "$HOME/.poetry/env"
15+
16+
install:
17+
- poetry install
18+
19+
script:
20+
- poetry run flake8 dry_monads tests docs
21+
- poetry run mypy dry_monads
22+
- poetry run pytest
23+
# TODO: add docs and enable
24+
# - poetry run doc8 -q docs
25+
- poetry check
26+
- pip check
27+
- safety check --bare --full-report
28+
29+
after_success:
30+
- pip install coveralls
31+
- coveralls
32+
33+
notifications:
34+
email:
35+
on_success: never
36+
on_failure: change

CONTRIBUTING.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# How to contribute
2+
3+
## Tutorials
4+
5+
If you want to start working on this project,
6+
you will need to get familiar with these concepts:
7+
8+
- http://learnyouahaskell.com/functors-applicative-functors-and-monoids
9+
10+
Here are some practical examples of what we are doing here:
11+
12+
- https://medium.com/@rnesytov/using-either-monad-in-python-b6eac698dff5
13+
- https://www.morozov.is/2018/09/08/monad-laws-in-ruby.html
14+
15+
16+
## Dependencies
17+
18+
We use [`poetry`](https://github.com/sdispater/poetry) to manage the dependencies.
19+
20+
To install them you would need to run `install` command:
21+
22+
```bash
23+
poetry install
24+
```
25+
26+
To activate your `virtualenv` run `poetry shell`.
27+
28+
29+
## Tests
30+
31+
We use `pytest` and `flake8` for quality control.
32+
We also use `wemake_python_styleguide` to enforce the code quality.
33+
34+
To run all tests:
35+
36+
```bash
37+
pytest
38+
```
39+
40+
To run linting:
41+
42+
```bash
43+
flake8 dry_monads tests docs
44+
```
45+
46+
These steps are mandatory during the CI.
47+
48+
49+
## Type checks
50+
51+
We use `mypy` to run type checks on our code.
52+
To use it:
53+
54+
```bash
55+
mypy dry_monads
56+
```
57+
58+
This step is mandatory during the CI.
59+
60+
61+
## Submitting your code
62+
63+
We use [trunk based](https://trunkbaseddevelopment.com/)
64+
development (we also sometimes call it `wemake-git-flow`).
65+
66+
What the point of this method?
67+
68+
1. We use protected `master` branch,
69+
so the only way to push your code is via pull request
70+
2. We use issue branches: to implement a new feature or to fix a bug
71+
create a new branch named `issue-$TASKNUMBER`
72+
3. Then create a pull request to `master` branch
73+
4. We use `git tag`s to make releases, so we can track what has changed
74+
since the latest release
75+
76+
So, this way we achieve an easy and scalable development process
77+
which frees us from merging hell and long-living branches.
78+
79+
In this method, the latest version of the app is always in the `master` branch.
80+
81+
### Before submitting
82+
83+
Before submitting your code please do the following steps:
84+
85+
1. Run `pytest` to make sure everything was working before
86+
2. Add any changes you want
87+
3. Add tests for the new changes
88+
4. Edit documentation if you have changed something significant
89+
5. Update `CHANGELOG.md` with a quick summary of your changes
90+
6. Run `pytest` again to make sure it is still working
91+
7. Run `mypy` to ensure that types are correct
92+
8. Run `flake8` to ensure that style is correct
93+
9. Run `doc8` to ensure that docs are correct
94+
95+
96+
## Other help
97+
98+
You can contribute by spreading a word about this library.
99+
It would also be a huge contribution to write
100+
a short article on how you are using this project.
101+
You can also share your best practices with us.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 wemake.services
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# dry-monads
2+
3+
Monads for `python` made simple and safe.
4+
5+
6+
## Features
7+
8+
- Provides primitives to write declarative business logic
9+
- Fully typed with annotations and checked with `mypy`,
10+
making your code type-safe as well
11+
12+
13+
## Inspirations
14+
15+
This module is heavily based on:
16+
17+
- https://github.com/dry-rb/dry-monads
18+
- https://github.com/dbrattli/OSlash
19+
- https://bitbucket.org/jason_delaat/pymonad
20+
21+
22+
## License
23+
24+
MIT

0 commit comments

Comments
 (0)