pyiter


Namepyiter JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://github.com/mokeyish/pyiter
SummaryPyIter is a Python package for iterative operations inspired by the Kotlin、CSharp(linq)、TypeSrcipt and Rust . Enables strong typing and type inference for iterative operations.
upload_time2024-04-19 23:28:41
maintainerNone
docs_urlNone
authorYISH
requires_python>=3.8
licenseMIT
keywords linq iterator typing lazy evaluation type inference
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyIter

[![Pypi version](https://img.shields.io/pypi/v/pyiter?style=for-the-badge)](https://pypi.org/project/pyiter/)

PyIter is a Python package for iterative operations inspired by the Kotlin、CSharp(linq)、TypeSrcipt and Rust .
Enables strong **typing** and type inference for iterative operations.

- Chain operations like map, reduce, filter, map
- Lazy evaluation
- parallel execution
- strong **typing**

## Install

```bash
pip install pyiter
```

## Quickstart

```python
from pyiter import it
from tqdm import tqdm


text = ["hello", "world"]
it(text).map(str.upper).to_list()
# ['HELLO', 'WORLD']


words = 'I dont want to believe I want to know'.split()
it(words).group_by(lambda x: x).map(lambda g: (g.key, g.values.count())).to_list()
# [('I', 2), ('dont', 1), ('want', 2), ('to', 2), ('believe', 1), ('know', 1)]


# use tqdm
it(range(10)).map(lambda x: str(x)).progress(lambda x: tqdm(x, total=x.len)).parallel_map(lambda x: x, max_workers=5).to_list()

```


**Type inference**
![.](https://github.com/mokeyish/pyiter/raw/main/screenshots/screenshot.png)

## API

See [API](https://pyiter.yish.org/pyiter/sequence.html) documention.

- You no need to read API documention. all functions are listed by the code completion as follows.
  
   ![.](https://github.com/mokeyish/pyiter/raw/main/screenshots/apilist.png)

- All documentions are showed as follows.

   ![.](https://github.com/mokeyish/pyiter/raw/main/screenshots/apidoc.png)

## Similar libraries

Note that none of the following libraries are providing full strong typing for code completion.

- [Pyterator](https://github.com/remykarem/pyterator)
- [PyFunctional](https://github.com/EntilZha/PyFunctional)
- [fluent](https://github.com/dwt/fluent)
- [Simple Smart Pipe](https://github.com/sspipe/sspipe)
- [pyxtension](https://github.com/asuiu/pyxtension)


## License

Licensed under either of

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)

at your option.


### Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mokeyish/pyiter",
    "name": "pyiter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "linq, iterator, typing, lazy evaluation, type inference",
    "author": "YISH",
    "author_email": "mokeyish@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/81/57/949b00930968a8370c613892c9991082ad316ffee19add7502975e204df4/pyiter-0.9.0.tar.gz",
    "platform": null,
    "description": "# PyIter\n\n[![Pypi version](https://img.shields.io/pypi/v/pyiter?style=for-the-badge)](https://pypi.org/project/pyiter/)\n\nPyIter is a Python package for iterative operations inspired by the Kotlin\u3001CSharp(linq)\u3001TypeSrcipt and Rust .\nEnables strong **typing** and type inference for iterative operations.\n\n- Chain operations like map, reduce, filter, map\n- Lazy evaluation\n- parallel execution\n- strong **typing**\n\n## Install\n\n```bash\npip install pyiter\n```\n\n## Quickstart\n\n```python\nfrom pyiter import it\nfrom tqdm import tqdm\n\n\ntext = [\"hello\", \"world\"]\nit(text).map(str.upper).to_list()\n# ['HELLO', 'WORLD']\n\n\nwords = 'I dont want to believe I want to know'.split()\nit(words).group_by(lambda x: x).map(lambda g: (g.key, g.values.count())).to_list()\n# [('I', 2), ('dont', 1), ('want', 2), ('to', 2), ('believe', 1), ('know', 1)]\n\n\n# use tqdm\nit(range(10)).map(lambda x: str(x)).progress(lambda x: tqdm(x, total=x.len)).parallel_map(lambda x: x, max_workers=5).to_list()\n\n```\n\n\n**Type inference**\n![.](https://github.com/mokeyish/pyiter/raw/main/screenshots/screenshot.png)\n\n## API\n\nSee [API](https://pyiter.yish.org/pyiter/sequence.html) documention.\n\n- You no need to read API documention. all functions are listed by the code completion as follows.\n  \n   ![.](https://github.com/mokeyish/pyiter/raw/main/screenshots/apilist.png)\n\n- All documentions are showed as follows.\n\n   ![.](https://github.com/mokeyish/pyiter/raw/main/screenshots/apidoc.png)\n\n## Similar libraries\n\nNote that none of the following libraries are providing full strong typing for code completion.\n\n- [Pyterator](https://github.com/remykarem/pyterator)\n- [PyFunctional](https://github.com/EntilZha/PyFunctional)\n- [fluent](https://github.com/dwt/fluent)\n- [Simple Smart Pipe](https://github.com/sspipe/sspipe)\n- [pyxtension](https://github.com/asuiu/pyxtension)\n\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)\n\nat your option.\n\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PyIter is a Python package for iterative operations inspired by the Kotlin\u3001CSharp(linq)\u3001TypeSrcipt and Rust . Enables strong typing and type inference for iterative operations.",
    "version": "0.9.0",
    "project_urls": {
        "Homepage": "https://github.com/mokeyish/pyiter"
    },
    "split_keywords": [
        "linq",
        " iterator",
        " typing",
        " lazy evaluation",
        " type inference"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98d65b507453650835042eaf70b996a05f0852f195b06e15b26fbfcfa25fca4c",
                "md5": "2665e7cf28d0518b44d3cf9e29825774",
                "sha256": "c8da6a6e10f19c2c4fbb02cde09296ff935e8f1ec64aaf2e1ee7e9fb294c7511"
            },
            "downloads": -1,
            "filename": "pyiter-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2665e7cf28d0518b44d3cf9e29825774",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21411,
            "upload_time": "2024-04-19T23:28:39",
            "upload_time_iso_8601": "2024-04-19T23:28:39.041893Z",
            "url": "https://files.pythonhosted.org/packages/98/d6/5b507453650835042eaf70b996a05f0852f195b06e15b26fbfcfa25fca4c/pyiter-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8157949b00930968a8370c613892c9991082ad316ffee19add7502975e204df4",
                "md5": "d945f00f7d581cd5cb13b6b8248d99d5",
                "sha256": "a0e5984e9fa8edcb591f67ce680b344c1d7566cb1299dc6bcfaf89d70787d0c7"
            },
            "downloads": -1,
            "filename": "pyiter-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d945f00f7d581cd5cb13b6b8248d99d5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21935,
            "upload_time": "2024-04-19T23:28:41",
            "upload_time_iso_8601": "2024-04-19T23:28:41.496611Z",
            "url": "https://files.pythonhosted.org/packages/81/57/949b00930968a8370c613892c9991082ad316ffee19add7502975e204df4/pyiter-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 23:28:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mokeyish",
    "github_project": "pyiter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyiter"
}
        
Elapsed time: 0.23732s