Skip to content

Commit

Permalink
Drop python3.9, m2r2, use myst-parser (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Dec 1, 2024
1 parent 0602e5e commit 28f14f8
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 269 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -56,7 +56,6 @@ jobs:
# Different python versions are covered differently:
poetry run pytest returns docs/pages tests
poetry run doc8 -q docs
poetry run codespell returns tests docs typesafety README.md CONTRIBUTING.md CHANGELOG.md
poetry run poetry check
Expand Down
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ incremental in minor, bugfixes only are patches.
See [0Ver](https://0ver.org/).


## 0.24.0 WIP
## 0.24.0

### Features

- Drop `python3.9` support
- Add `python3.13` support
- Add support for `mypy>=1.12`
- Add picky exceptions to `future_safe` decorator like `safe` has.
- Improve inference of `ResultLike` objects when exception catching
decorator is applied with explicit exception types
- Add picky exceptions to `impure_safe` decorator like `safe` has. Issue #1543
- Add partition function to result module. Issue #1905
- Adds `default_error` parameter to `returns.converters.maybe_to_result`,
- Add `default_error` parameter to `returns.converters.maybe_to_result`,
which provides a default error value for `Failure`


Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ Before submitting your code please do the following steps:
6. Run `pytest` again to make sure it is still working
7. Run `mypy` to ensure that types are correct
8. Run `flake8` to ensure that style is correct
9. Run `doc8` to ensure that docs are correct
10. Run `slotscheck` to ensure that slots are correct
9. Run `slotscheck` to ensure that slots are correct


## Other help
Expand Down
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_project_meta():
'sphinx.ext.napoleon',

# Used to include .md files:
'm2r2',
'myst_parser',

# Used to insert typehints into the final docs:
'sphinx_autodoc_typehints',
Expand All @@ -71,6 +71,11 @@ def _get_project_meta():
'show-inheritance': True,
}

suppress_warnings = [
'myst.header',
'myst.xref_missing',
]

# https://pypi.org/project/sphinx-autodoc-typehints/
always_document_param_types = True

Expand Down
6 changes: 5 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.. mdinclude:: ../README.md
returns
=======

.. include:: ../README.md
:parser: myst_parser.sphinx_

Contents
--------
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/changelog.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.. mdinclude:: ../../CHANGELOG.md
.. include:: ../../CHANGELOG.md
:parser: myst_parser.sphinx_
291 changes: 124 additions & 167 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ _ = "returns.contrib.hypothesis._entrypoint:_setup_hook"


[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"

typing-extensions = ">=4.0,<5.0"
pytest = { version = "^8.0", optional = true }
Expand All @@ -72,7 +72,6 @@ pytest-mypy-plugins = "^3.1"
pytest-subtests = "^0.13"
pytest-shard = "^0.1"

doc8 = "^1.1"

[tool.poetry.group.docs]
optional = true
Expand All @@ -83,7 +82,7 @@ sphinx = "^7.3"
sphinx-autodoc-typehints = "^2.3"
sphinxcontrib-mermaid = "^1.0"
furo = "^2024.5"
m2r2 = "^0.3"
myst-parser = "^4.0"
tomli = "^2.0"

[tool.poetry.extras]
Expand Down
8 changes: 0 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,6 @@ disallow_subclassing_any = False
disallow_subclassing_any = False


[doc8]
# doc8 configuration: https://pypi.org/project/doc8/
ignore-path = docs/_build
max-line-length = 80
sphinx = True
ignore-path-errors=docs/pages/railway.rst;D000


[codespell]
# codespell configuration: https://pypi.org/project/codespell
ignore-words-list = appliable,falsy
Expand Down
35 changes: 0 additions & 35 deletions tests/conftest.py

This file was deleted.

1 change: 0 additions & 1 deletion typesafety/test_curry/test_curry/test_curry_arguments.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- case: curry_pos_only_args
disable_cache: false
skip: sys.version_info[:2] < (3, 8)
main: |
from returns.curry import curry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
- case: partial_pos_only_args
disable_cache: false
skip: sys.version_info[:2] < (3, 8)
main: |
from returns.curry import partial
Expand Down
37 changes: 0 additions & 37 deletions typesafety/test_curry/test_partial/test_partial_generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,46 +79,9 @@
main:22: note: Revealed type is "builtins.int"
- case: partial_double_generic_complex37
disable_cache: false
skip: sys.version_info[:2] >= (3, 8)
main: |
from returns.curry import partial
from typing import List, TypeVar, Union
A = TypeVar('A')
B = TypeVar('B')
def multiple(
a: int,
*,
b: List[B],
c: List[A],
) -> Union[A, B]:
...
x: List[int]
y: List[str]
reveal_type(partial(multiple))
reveal_type(partial(multiple, 1))
reveal_type(partial(multiple, 1, b=x))
reveal_type(partial(multiple, 1, c=x))
reveal_type(partial(multiple, 1, b=y))
reveal_type(partial(multiple, 1, c=y))
out: |
main:18: note: Revealed type is "def [B, A] (a: builtins.int, *, b: builtins.list[B`-1], c: builtins.list[A`-2]) -> Union[A`-2, B`-1]"
main:19: note: Revealed type is "def [B, A] (*, b: builtins.list[B`-1], c: builtins.list[A`-2]) -> Union[A`-2, B`-1]"
main:20: note: Revealed type is "def [A] (*, c: builtins.list[A`-2]) -> Union[A`-2, builtins.int]"
main:21: note: Revealed type is "def [B] (*, b: builtins.list[B`-1]) -> Union[builtins.int, B`-1]"
main:22: note: Revealed type is "def [A] (*, c: builtins.list[A`-2]) -> Union[A`-2, builtins.str]"
main:23: note: Revealed type is "def [B] (*, b: builtins.list[B`-1]) -> Union[builtins.str, B`-1]"
# Python3.8+ sorts generic arguments differently:
- case: partial_double_generic_complex38
disable_cache: false
skip: sys.version_info[:2] < (3, 8)
main: |
from returns.curry import partial
from typing import List, TypeVar, Union
Expand Down
2 changes: 0 additions & 2 deletions typesafety/test_future/test_future_container/test_do.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
- case: do_sync_error
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.future import Future
Expand Down Expand Up @@ -27,7 +26,6 @@
- case: do_with_if
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.future import Future
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
- case: do_sync_error
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.future import FutureResult, FutureSuccess
Expand Down Expand Up @@ -81,7 +80,6 @@
- case: do_with_if
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.future import FutureSuccess, FutureResult
Expand Down
1 change: 0 additions & 1 deletion typesafety/test_io/test_io_container/test_do.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- case: do_with_if
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.io import IO
Expand Down
1 change: 0 additions & 1 deletion typesafety/test_io/test_ioresult_container/test_do.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
- case: do_with_if
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.io import IOSuccess, IOResult
Expand Down
1 change: 0 additions & 1 deletion typesafety/test_maybe/test_do.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
- case: do_with_if
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.maybe import Maybe
Expand Down
1 change: 0 additions & 1 deletion typesafety/test_result/test_do.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
- case: do_with_if
skip: sys.version_info[:2] < (3, 8)
disable_cache: false
main: |
from returns.result import Success, Result
Expand Down

0 comments on commit 28f14f8

Please sign in to comment.