Skip to content

Commit f35ce32

Browse files
Merge branch 'master' of github.com:RomanMIzulin/returns into gatherlike
2 parents e959624 + 6cca5d9 commit f35ce32

190 files changed

Lines changed: 5190 additions & 4465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: ['3.9', '3.10', '3.11', '3.12']
23+
python-version: ['3.10', '3.11', '3.12', '3.13']
2424

2525
steps:
2626
- uses: actions/checkout@v4
27+
with:
28+
persist-credentials: false
2729

2830
- name: Set up Python ${{ matrix.python-version }}
2931
uses: actions/setup-python@v5
@@ -56,29 +58,31 @@ jobs:
5658
# Different python versions are covered differently:
5759
poetry run pytest returns docs/pages tests
5860
59-
poetry run doc8 -q docs
6061
poetry run codespell returns tests docs typesafety README.md CONTRIBUTING.md CHANGELOG.md
6162
62-
poetry run poetry check
63+
# TODO: re-enable after all problems are fixed
64+
# poetry run poetry check
6365
poetry run pip check
6466
poetry run python -m slotscheck returns --verbose
6567
6668
- name: Upload coverage to Codecov
6769
if: matrix.python-version == 3.11
6870
uses: codecov/codecov-action@v5
6971
with:
70-
file: ./coverage.xml
72+
files: ./coverage.xml
7173

7274
typesafety-tests:
7375
runs-on: ubuntu-latest
7476
strategy:
7577
fail-fast: false
7678
matrix:
77-
python-version: ['3.9', '3.10', '3.11', '3.12']
79+
python-version: ['3.10', '3.11', '3.12', '3.13']
7880
shard: [0, 1, 2, 3]
7981

8082
steps:
8183
- uses: actions/checkout@v4
84+
with:
85+
persist-credentials: false
8286

8387
- name: Set up Python ${{ matrix.python-version }}
8488
uses: actions/setup-python@v5

.github/zizmor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
"*": ref-pin

.pre-commit-config.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-toml
9+
- id: check-merge-conflict
10+
- id: mixed-line-ending
11+
args: [--fix=lf]
12+
- id: check-case-conflict
13+
- repo: https://github.com/python-jsonschema/check-jsonschema
14+
rev: 0.33.0
15+
hooks:
16+
- id: check-dependabot
17+
- id: check-readthedocs
18+
- id: check-github-workflows
19+
- repo: https://github.com/rhysd/actionlint
20+
rev: v1.7.7
21+
hooks:
22+
- id: actionlint
23+
- repo: https://github.com/woodruffw/zizmor-pre-commit
24+
rev: v1.6.0
25+
hooks:
26+
- id: zizmor
27+
- repo: https://github.com/shellcheck-py/shellcheck-py
28+
rev: v0.10.0.1
29+
hooks:
30+
- id: shellcheck
31+
- repo: https://github.com/tox-dev/pyproject-fmt
32+
rev: v2.5.1
33+
hooks:
34+
- id: pyproject-fmt
35+
- repo: https://github.com/astral-sh/ruff-pre-commit
36+
rev: v0.11.7
37+
hooks:
38+
- id: ruff
39+
args: ["--exit-non-zero-on-fix"]
40+
- id: ruff-format
41+
- repo: https://github.com/sphinx-contrib/sphinx-lint
42+
rev: v1.0.0
43+
hooks:
44+
- id: sphinx-lint
45+
args: [--enable=default-role]
46+
files: ^docs/
47+
48+
# Should be the last:
49+
- repo: meta
50+
hooks:
51+
- id: check-useless-excludes
52+
53+
ci:
54+
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
55+
autofix_prs: true
56+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
57+
autoupdate_schedule: weekly
58+
submodules: false

.readthedocs.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ version: 2
44
# Set the version of Python and other tools you might need
55
build:
66
os: ubuntu-lts-latest
7-
tools: {python: "3.11"}
7+
tools: {python: "3.12"}
88
jobs:
99
pre_create_environment:
1010
- asdf plugin add poetry
1111
- asdf install poetry latest
1212
- asdf global poetry latest
1313
- poetry config virtualenvs.create false
1414
- poetry self add poetry-plugin-export
15-
- poetry export --only main --only docs --extras check_laws --format=requirements.txt --output=requirements.txt
15+
- poetry export
16+
--only main --only docs
17+
--extras check_laws --extras compatible_mypy
18+
--format=requirements.txt
19+
--output=requirements.txt
1620

1721
python:
1822
install:

CHANGELOG.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,48 @@ incremental in minor, bugfixes only are patches.
66
See [0Ver](https://0ver.org/).
77

88

9-
## 0.24.0 WIP
9+
## 0.25.0
1010

1111
### Features
1212

13-
- Add picky exceptions to `future_safe` decorator like `safe` has.
13+
- A lot of new features added to our `hypothesis` plugins.
14+
It now allows to create custom strategies, better instantiate containers,
15+
docouple it from built-in ones, check laws from user-defined interfaces
16+
17+
### Bugfixes
18+
19+
- Fixes that `UnwrapFailedError` was not picklable
20+
21+
22+
## 0.24.0
23+
24+
### Features
25+
26+
- Drop `python3.9` support
27+
- Add `python3.13` support
28+
- Add support for `mypy>=1.12`
29+
- Add picky exceptions to `future_safe` decorator like `safe` has
1430
- Improve inference of `ResultLike` objects when exception catching
1531
decorator is applied with explicit exception types
1632
- Add picky exceptions to `impure_safe` decorator like `safe` has. Issue #1543
17-
- Add `partition` function to methods module. Issue #1905
18-
- Adds `default_error` parameter to `returns.converters.maybe_to_result`,
33+
- Add partition function to result module. Issue #1905
34+
- Add `default_error` parameter to `returns.converters.maybe_to_result`,
1935
which provides a default error value for `Failure`
2036
- Add `returns.methods.gather` utility method
2137

2238

23-
### Misc
39+
## 0.24.1
40+
41+
### Features
42+
43+
- Make `hypothesis` plugin test laws from user-defined interfaces too
44+
- Make `hypothesis` plugin accept user-defined strategies
45+
- Allow users to override the `hypothesis` plugin's strategies for types, such
46+
as `TypeVar` and `Callable`.
47+
48+
### Bugfixes
2449

25-
- Now requires `mypy>=1.11`
50+
- Add pickling support for `UnwrapFailedError` exception
2651

2752

2853
## 0.23.0

CONTRIBUTING.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ To install them you would need to run the `install` command:
3030
poetry install
3131
```
3232

33-
To activate your `virtualenv` run `poetry shell`.
33+
To install extra dependencies for working on the `hypothesis` or `mypy` plugin:
34+
35+
```bash
36+
poetry install --extras check-laws
37+
poetry install --extras compatible-mypy
38+
```
39+
40+
To activate your `virtualenv` run `eval $(poetry env activate)`.
3441

3542

3643
## Tests
@@ -117,8 +124,7 @@ Before submitting your code please do the following steps:
117124
6. Run `pytest` again to make sure it is still working
118125
7. Run `mypy` to ensure that types are correct
119126
8. Run `flake8` to ensure that style is correct
120-
9. Run `doc8` to ensure that docs are correct
121-
10. Run `slotscheck` to ensure that slots are correct
127+
9. Run `slotscheck` to ensure that slots are correct
122128

123129

124130
## Other help

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
-----
44

5-
[![Build Status](https://github.com/dry-python/returns/workflows/test/badge.svg?branch=master&event=push)](https://github.com/dry-python/returns/actions?query=workflow%3Atest)
5+
[![test](https://github.com/dry-python/returns/actions/workflows/test.yml/badge.svg?branch=master&event=push)](https://github.com/dry-python/returns/actions/workflows/test.yml)
66
[![codecov](https://codecov.io/gh/dry-python/returns/branch/master/graph/badge.svg)](https://codecov.io/gh/dry-python/returns)
77
[![Documentation Status](https://readthedocs.org/projects/returns/badge/?version=latest)](https://returns.readthedocs.io/en/latest/?badge=latest)
88
[![Python Version](https://img.shields.io/pypi/pyversions/returns.svg)](https://pypi.org/project/returns/)
@@ -59,7 +59,7 @@ or:
5959
plugins = ["returns.contrib.mypy.returns_plugin"]
6060
```
6161

62-
We also recommend to use the same `mypy` settings [we use](https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/mypy.toml).
62+
We also recommend to use the same `mypy` settings we use, which you'll find in the `[tool.mypy]` sections in our [pyproject.toml](https://github.com/wemake-services/wemake-python-styleguide/blob/master/pyproject.toml) file.
6363

6464
Make sure you know how to get started, [check out our docs](https://returns.readthedocs.io/en/latest/)!
6565
[Try our demo](https://repl.it/@sobolevn/returns#ex.py).
@@ -204,7 +204,7 @@ from words_app.logic import calculate_points
204204

205205
def view(request: HttpRequest) -> HttpResponse:
206206
user_word: str = request.POST['word'] # just an example
207-
points = calculate_points(user_words)(settings) # passing the dependencies
207+
points = calculate_points(user_word)(settings) # passing the dependencies
208208
... # later you show the result to user somehow
209209

210210
# Somewhere in your `words_app/logic.py`:

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS =
5+
SPHINXOPTS = -W
66
SPHINXBUILD = sphinx-build
77
SPHINXPROJ = returns
88
SOURCEDIR = .

docs/conf.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212

13-
import os
13+
import pathlib
1414
import sys
1515

1616
import tomli
1717

18-
sys.path.insert(0, os.path.abspath('..'))
18+
sys.path.insert(0, str(pathlib.Path('..').resolve()))
1919

2020

2121
# -- Project information -----------------------------------------------------
2222

23+
2324
def _get_project_meta():
24-
with open('../pyproject.toml', mode='rb') as pyproject:
25+
with pathlib.Path('../pyproject.toml').open(mode='rb') as pyproject:
2526
return tomli.load(pyproject)['tool']['poetry']
2627

2728

2829
pkg_meta = _get_project_meta()
2930
project = str(pkg_meta['name'])
30-
copyright = '2019, dry-python team' # noqa: WPS125
31+
copyright = '2019, dry-python team' # noqa: A001
3132
author = 'dry-python team'
3233

3334
# The short X.Y version
@@ -49,13 +50,10 @@ def _get_project_meta():
4950
'sphinx.ext.viewcode',
5051
'sphinx.ext.autosummary',
5152
'sphinx.ext.napoleon',
52-
5353
# Used to include .md files:
54-
'm2r2',
55-
54+
'myst_parser',
5655
# Used to insert typehints into the final docs:
5756
'sphinx_autodoc_typehints',
58-
5957
# Used to build graphs:
6058
'sphinxcontrib.mermaid',
6159
]
@@ -71,6 +69,11 @@ def _get_project_meta():
7169
'show-inheritance': True,
7270
}
7371

72+
suppress_warnings = [
73+
'myst.header',
74+
'myst.xref_missing',
75+
]
76+
7477
# https://pypi.org/project/sphinx-autodoc-typehints/
7578
always_document_param_types = True
7679

docs/index.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
.. mdinclude:: ../README.md
1+
returns
2+
=======
3+
4+
.. include:: ../README.md
5+
:parser: myst_parser.sphinx_
26

37
Contents
48
--------

0 commit comments

Comments
 (0)