Name | wraps-futures JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | Futures functionality of wraps. |
upload_time | 2024-08-13 11:31:29 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024-present, Nikita Tikhonov (nekitdev) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
either
future
option
python
result
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# `wraps-futures`
[![License][License Badge]][License]
[![Version][Version Badge]][Package]
[![Downloads][Downloads Badge]][Package]
[![Discord][Discord Badge]][Discord]
[![Documentation][Documentation Badge]][Documentation]
[![Check][Check Badge]][Actions]
[![Test][Test Badge]][Actions]
[![Coverage][Coverage Badge]][Coverage]
> *Futures feature of wraps.*
## Installing
**Python 3.8 or above is required.**
### `pip`
Installing the library with `pip` is quite simple:
```console
$ pip install wraps-futures
```
Alternatively, the library can be installed from the source:
```console
$ pip install git+https://github.com/nekitdev/wraps-futures.git
```
Or via cloning the repository:
```console
$ git clone https://github.com/nekitdev/wraps-futures.git
$ cd wraps-futures
$ pip install .
```
### `uv`
You can add `wraps-futures` as a dependency with the following command:
```console
$ uv add wraps-futures
```
## Examples
## ReAwaitable
This library implements the [`ReAwaitable[T]`][wraps.futures.core.reawaitable.ReAwaitable] type,
which wraps awaitables to allow re-awaiting.
Using the [`wrap_reawaitable`][wraps.futures.core.reawaitable.wrap_reawaitable] decorator:
```python
# reawaitable.py
from wraps.futures.core import wrap_reawaitable
@wrap_reawaitable
async def function() -> int:
return 42
```
```python
>>> from reawaitable import function
>>> awaitable = function()
>>> await awaitable
42
>>> await awaitable
42
>>> await awaitable
42
>>> # ad infinitum...
```
## Future
[`Future[T]`][wraps.futures.core.future.Future] allows to chain asynchronous computations.
Using the [`wrap_future`][wraps.futures.core.future.wrap_future] decorator:
```python
# future.py
from wraps.futures.core import wrap_future
@wrap_future
async def function() -> int:
return 13
async def square(value: int) -> int:
return value * value
```
```python
>>> from future import function, square
>>> future = function().future_map_await(square).future_map(str)
>>> await future
"13"
```
[`Future[T]`][wraps.futures.core.future.Future] uses
[`ReAwaitable[T]`][wraps.futures.core.reawaitable.ReAwaitable] under the hood, so any given future
can safely be re-awaited on.
## Documentation
You can find the documentation [here][Documentation].
## Support
If you need support with the library, you can send us an [email][Email]
or refer to the official [Discord server][Discord].
## Changelog
You can find the changelog [here][Changelog].
## Security Policy
You can find the Security Policy of `wraps-futures` [here][Security].
## Contributing
If you are interested in contributing to `wraps-futures`, make sure to take a look at the
[Contributing Guide][Contributing Guide], as well as the [Code of Conduct][Code of Conduct].
## License
`wraps-futures` is licensed under the MIT License terms. See [License][License] for details.
[Email]: mailto:support@nekit.dev
[Discord]: https://nekit.dev/chat
[Actions]: https://github.com/nekitdev/wraps-futures/actions
[Changelog]: https://github.com/nekitdev/wraps-futures/blob/main/CHANGELOG.md
[Code of Conduct]: https://github.com/nekitdev/wraps-futures/blob/main/CODE_OF_CONDUCT.md
[Contributing Guide]: https://github.com/nekitdev/wraps-futures/blob/main/CONTRIBUTING.md
[Security]: https://github.com/nekitdev/wraps-futures/blob/main/SECURITY.md
[License]: https://github.com/nekitdev/wraps-futures/blob/main/LICENSE
[Package]: https://pypi.org/project/wraps-futures
[Coverage]: https://codecov.io/gh/nekitdev/wraps-futures
[Documentation]: https://nekitdev.github.io/wraps-futures
[Discord Badge]: https://img.shields.io/discord/728012506899021874
[License Badge]: https://img.shields.io/pypi/l/wraps-futures
[Version Badge]: https://img.shields.io/pypi/v/wraps-futures
[Downloads Badge]: https://img.shields.io/pypi/dm/wraps-futures
[Documentation Badge]: https://github.com/nekitdev/wraps-futures/workflows/docs/badge.svg
[Check Badge]: https://github.com/nekitdev/wraps-futures/workflows/check/badge.svg
[Test Badge]: https://github.com/nekitdev/wraps-futures/workflows/test/badge.svg
[Coverage Badge]: https://codecov.io/gh/nekitdev/wraps-futures/branch/main/graph/badge.svg
[wraps.futures.core.reawaitable.ReAwaitable]: https://nekitdev.github.io/wraps-futures/reference/core/reawaitable#wraps.futures.core.reawaitable.ReAwaitable
[wraps.futures.core.reawaitable.wrap_reawaitable]: https://nekitdev.github.io/wraps-futures/reference/core/reawaitable#wraps.futures.core.reawaitable.wrap_reawaitable
[wraps.futures.core.future.Future]: https://nekitdev.github.io/wraps-futures/reference/core/future#wraps.futures.core.future.Future
[wraps.futures.core.future.wrap_future]: https://nekitdev.github.io/wraps-futures/reference/core/future#wraps.futures.core.future.wrap_future
Raw data
{
"_id": null,
"home_page": null,
"name": "wraps-futures",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "either, future, option, python, result",
"author": null,
"author_email": "nekitdev <nekit@nekit.dev>",
"download_url": "https://files.pythonhosted.org/packages/86/8b/489194dd9bd0e0d3503b0ee85fa9fa1398f082fbe91d7b805667fbd2fcf1/wraps_futures-0.2.0.tar.gz",
"platform": null,
"description": "# `wraps-futures`\n\n[![License][License Badge]][License]\n[![Version][Version Badge]][Package]\n[![Downloads][Downloads Badge]][Package]\n[![Discord][Discord Badge]][Discord]\n\n[![Documentation][Documentation Badge]][Documentation]\n[![Check][Check Badge]][Actions]\n[![Test][Test Badge]][Actions]\n[![Coverage][Coverage Badge]][Coverage]\n\n> *Futures feature of wraps.*\n\n## Installing\n\n**Python 3.8 or above is required.**\n\n### `pip`\n\nInstalling the library with `pip` is quite simple:\n\n```console\n$ pip install wraps-futures\n```\n\nAlternatively, the library can be installed from the source:\n\n```console\n$ pip install git+https://github.com/nekitdev/wraps-futures.git\n```\n\nOr via cloning the repository:\n\n```console\n$ git clone https://github.com/nekitdev/wraps-futures.git\n$ cd wraps-futures\n$ pip install .\n```\n\n### `uv`\n\nYou can add `wraps-futures` as a dependency with the following command:\n\n```console\n$ uv add wraps-futures\n```\n\n## Examples\n\n## ReAwaitable\n\nThis library implements the [`ReAwaitable[T]`][wraps.futures.core.reawaitable.ReAwaitable] type,\nwhich wraps awaitables to allow re-awaiting.\n\nUsing the [`wrap_reawaitable`][wraps.futures.core.reawaitable.wrap_reawaitable] decorator:\n\n```python\n# reawaitable.py\n\nfrom wraps.futures.core import wrap_reawaitable\n\n@wrap_reawaitable\nasync def function() -> int:\n return 42\n```\n\n```python\n>>> from reawaitable import function\n>>> awaitable = function()\n>>> await awaitable\n42\n>>> await awaitable\n42\n>>> await awaitable\n42\n>>> # ad infinitum...\n```\n\n## Future\n\n[`Future[T]`][wraps.futures.core.future.Future] allows to chain asynchronous computations.\n\nUsing the [`wrap_future`][wraps.futures.core.future.wrap_future] decorator:\n\n```python\n# future.py\n\nfrom wraps.futures.core import wrap_future\n\n\n@wrap_future\nasync def function() -> int:\n return 13\n\n\nasync def square(value: int) -> int:\n return value * value\n```\n\n```python\n>>> from future import function, square\n>>> future = function().future_map_await(square).future_map(str)\n>>> await future\n\"13\"\n```\n\n[`Future[T]`][wraps.futures.core.future.Future] uses\n[`ReAwaitable[T]`][wraps.futures.core.reawaitable.ReAwaitable] under the hood, so any given future\ncan safely be re-awaited on.\n\n## Documentation\n\nYou can find the documentation [here][Documentation].\n\n## Support\n\nIf you need support with the library, you can send us an [email][Email]\nor refer to the official [Discord server][Discord].\n\n## Changelog\n\nYou can find the changelog [here][Changelog].\n\n## Security Policy\n\nYou can find the Security Policy of `wraps-futures` [here][Security].\n\n## Contributing\n\nIf you are interested in contributing to `wraps-futures`, make sure to take a look at the\n[Contributing Guide][Contributing Guide], as well as the [Code of Conduct][Code of Conduct].\n\n## License\n\n`wraps-futures` is licensed under the MIT License terms. See [License][License] for details.\n\n[Email]: mailto:support@nekit.dev\n\n[Discord]: https://nekit.dev/chat\n\n[Actions]: https://github.com/nekitdev/wraps-futures/actions\n\n[Changelog]: https://github.com/nekitdev/wraps-futures/blob/main/CHANGELOG.md\n[Code of Conduct]: https://github.com/nekitdev/wraps-futures/blob/main/CODE_OF_CONDUCT.md\n[Contributing Guide]: https://github.com/nekitdev/wraps-futures/blob/main/CONTRIBUTING.md\n[Security]: https://github.com/nekitdev/wraps-futures/blob/main/SECURITY.md\n\n[License]: https://github.com/nekitdev/wraps-futures/blob/main/LICENSE\n\n[Package]: https://pypi.org/project/wraps-futures\n[Coverage]: https://codecov.io/gh/nekitdev/wraps-futures\n[Documentation]: https://nekitdev.github.io/wraps-futures\n\n[Discord Badge]: https://img.shields.io/discord/728012506899021874\n[License Badge]: https://img.shields.io/pypi/l/wraps-futures\n[Version Badge]: https://img.shields.io/pypi/v/wraps-futures\n[Downloads Badge]: https://img.shields.io/pypi/dm/wraps-futures\n\n[Documentation Badge]: https://github.com/nekitdev/wraps-futures/workflows/docs/badge.svg\n[Check Badge]: https://github.com/nekitdev/wraps-futures/workflows/check/badge.svg\n[Test Badge]: https://github.com/nekitdev/wraps-futures/workflows/test/badge.svg\n[Coverage Badge]: https://codecov.io/gh/nekitdev/wraps-futures/branch/main/graph/badge.svg\n\n[wraps.futures.core.reawaitable.ReAwaitable]: https://nekitdev.github.io/wraps-futures/reference/core/reawaitable#wraps.futures.core.reawaitable.ReAwaitable\n[wraps.futures.core.reawaitable.wrap_reawaitable]: https://nekitdev.github.io/wraps-futures/reference/core/reawaitable#wraps.futures.core.reawaitable.wrap_reawaitable\n\n[wraps.futures.core.future.Future]: https://nekitdev.github.io/wraps-futures/reference/core/future#wraps.futures.core.future.Future\n[wraps.futures.core.future.wrap_future]: https://nekitdev.github.io/wraps-futures/reference/core/future#wraps.futures.core.future.wrap_future\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024-present, Nikita Tikhonov (nekitdev) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Futures functionality of wraps.",
"version": "0.2.0",
"project_urls": {
"Chat": "https://nekit.dev/chat",
"Documentation": "https://nekitdev.github.io/wraps-futures",
"Funding": "https://nekit.dev/funding",
"Homepage": "https://github.com/nekitdev/wraps-futures",
"Issues": "https://github.com/nekitdev/wraps-futures/issues",
"Repository": "https://github.com/nekitdev/wraps-futures"
},
"split_keywords": [
"either",
" future",
" option",
" python",
" result"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c002f403ef00f645b88889df7f7db66c0d7c7d2614b4d46cbc6153370b66eaa4",
"md5": "cf98e8682f91d82bb413607a9c716677",
"sha256": "e223a63488c2da8ecb22bdb99cb9c48f6b0f7e09fc1028c34fa3bff608be987d"
},
"downloads": -1,
"filename": "wraps_futures-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cf98e8682f91d82bb413607a9c716677",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 15703,
"upload_time": "2024-08-13T11:31:28",
"upload_time_iso_8601": "2024-08-13T11:31:28.142332Z",
"url": "https://files.pythonhosted.org/packages/c0/02/f403ef00f645b88889df7f7db66c0d7c7d2614b4d46cbc6153370b66eaa4/wraps_futures-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "868b489194dd9bd0e0d3503b0ee85fa9fa1398f082fbe91d7b805667fbd2fcf1",
"md5": "502a8b2f1dae74954f9a00de02ce125a",
"sha256": "59e39f481c531932e80ec2faa74dd3b0cd978b78e8c6227ef69de4b22db845d3"
},
"downloads": -1,
"filename": "wraps_futures-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "502a8b2f1dae74954f9a00de02ce125a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20933,
"upload_time": "2024-08-13T11:31:29",
"upload_time_iso_8601": "2024-08-13T11:31:29.077612Z",
"url": "https://files.pythonhosted.org/packages/86/8b/489194dd9bd0e0d3503b0ee85fa9fa1398f082fbe91d7b805667fbd2fcf1/wraps_futures-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-13 11:31:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nekitdev",
"github_project": "wraps-futures",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "wraps-futures"
}