Skip to content

Commit

Permalink
major: rename to iterpy to align with pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Jan 4, 2024
1 parent 263b4ca commit 0279a65
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 44 deletions.
8 changes: 4 additions & 4 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"author": "Martin Bernstorff",
"copyright_year": "2023",
"email": "martinbernstorff@gmail.com",
"friendly_name": "Iter",
"github_repo": "Iter",
"friendly_name": "iterpy",
"github_repo": "iterpy",
"github_user": "MartinBernstorff",
"license": "MIT",
"package_name": "Iter",
"project_name": "Iter",
"package_name": "iterpy",
"project_name": "iterpy",
"release_to_pypi": "yes",
"version": "0.0.0"
}
8 changes: 4 additions & 4 deletions .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"checkout": null,
"context": {
"cookiecutter": {
"project_name": "Iter",
"package_name": "Iter",
"friendly_name": "Iter",
"project_name": "iterpy",
"package_name": "iterpy",
"friendly_name": "iterpy",
"author": "Martin Bernstorff",
"email": "martinbernstorff@gmail.com",
"github_user": "MartinBernstorff",
"github_repo": "Iter",
"github_repo": "iterpy",
"version": "0.0.0",
"copyright_year": "2023",
"release_to_pypi": "no",
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Here is a list of important resources for contributors:
- [Code of Conduct]

[mit license]: https://opensource.org/licenses/MIT
[source code]: https://github.com/MartinBernstorff/Iter
[source code]: https://github.com/MartinBernstorff/iterpy
[documentation]: https://iter.readthedocs.io/
[issue tracker]: https://github.com/MartinBernstorff/Iter/issues
[issue tracker]: https://github.com/MartinBernstorff/iterpy/issues

## How to report a bug

Expand Down Expand Up @@ -77,7 +77,7 @@ $ nox --session=pre-commit -- install
It is recommended to open an issue before starting work on anything.
This will allow a chance to talk it over with the owners and validate your approach.

[pull request]: https://github.com/MartinBernstorff/Iter/pulls
[pull request]: https://github.com/MartinBernstorff/iterpy/pulls

<!-- github-only -->

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Iter
# iterpy
[![Open in Dev Container](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)][dev container]
[![PyPI](https://img.shields.io/pypi/v/iter.svg)][pypi status]
[![Python Version](https://img.shields.io/pypi/pyversions/Iter)][pypi status]
[![Tests](https://github.com/MartinBernstorff/Iter/actions/workflows/tests.yml/badge.svg)][tests]
[![Python Version](https://img.shields.io/pypi/pyversions/iterpy)][pypi status]
[![Tests](https://github.com/MartinBernstorff/iterpy/actions/workflows/tests.yml/badge.svg)][tests]

[pypi status]: https://pypi.org/project/Iter/
[tests]: https://github.com/MartinBernstorff/Iter/actions?workflow=Tests
[dev container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/MartinBernstorff/Iter/
[pypi status]: https://pypi.org/project/iterpy/
[tests]: https://github.com/MartinBernstorff/iterpy/actions?workflow=Tests
[dev container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/MartinBernstorff/iterpy/


<!-- start short-description -->
**ALPHA**: APIs can change dramatically without notice.

Python has implemented `map`, `filter` etc. as functions, rather than methods on a sequence. This makes the result harder to read and Iterators less used than they could be. Iter exists to change that.
Python has implemented `map`, `filter` etc. as functions, rather than methods on a sequence. This makes the result harder to read and iterators less used than they could be. iterpy exists to change that.

You get this 🔥:

```python
result = (Iter([1,2,3])
result = (iterpy([1,2,3])
.map(multiply_by_2)
.filter(is_even))
```
Expand All @@ -44,7 +44,7 @@ pip install iterpy

## Usage
```python
from iter import Seq
from iterpy import Iter

result = (Iter([1, 2])
.filter(lambda x: x % 2 == 0)
Expand All @@ -55,7 +55,7 @@ assert result == [4]
```

## Prior art
Iter stands on the shoulders of Scala, Rust etc.
iterpy stands on the shoulders of Scala, Rust etc.

Other Python projects have had similar ideas:
* [PyFunctional](https://github.com/EntilZha/PyFunctional) has existed for 7+ years with a comprehensive feature set. It is performant, with built-in lineage and caching. Unfortunately, this makes typing [non-trivial, with a 4+ year ongoing effort to add types](https://github.com/EntilZha/PyFunctional/issues/118).
Expand Down Expand Up @@ -83,7 +83,7 @@ In cases where this conflicts with typical python implementations, the API shoul
#### Devcontainer
1. Install [Orbstack](https://orbstack.dev/) or Docker Desktop. Make sure to complete the full install process before continuing.
2. If not installed, install VSCode
3. Press this [link](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/MartinBernstorff/Iter/)
3. Press this [link](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/MartinBernstorff/iterpy/)
4. Complete the setup process
5. Done! Easy as that.

Expand All @@ -96,7 +96,7 @@ In cases where this conflicts with typical python implementations, the API shoul
| 👩‍💻 **Usage Questions** | [GitHub Discussions] |
| 🗯 **General Discussion** | [GitHub Discussions] |

[github issue tracker]: https://github.com/MartinBernstorff/Iter/issues
[github discussions]: https://github.com/MartinBernstorff/Iter/discussions
[github issue tracker]: https://github.com/MartinBernstorff/iterpy/issues
[github discussions]: https://github.com/MartinBernstorff/iterpy/discussions


File renamed without changes.
4 changes: 2 additions & 2 deletions iter/_generate_pyi.py → iterpy/_generate_pyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def flatten(self: Seq[TYPE[S] | T]) -> Seq[S]: ..."""

combined_interface = f" # Code for generating the following is in {Path(__file__).name}"
for mark in [
TypeMarker("Iterable[S]"),
TypeMarker("Iterator[S]"),
TypeMarker("iterpyable[S]"),
TypeMarker("iterpyator[S]"),
TypeMarker("tuple[S, ...]"),
TypeMarker("Sequence[S]"),
TypeMarker("list[S]"),
Expand Down
4 changes: 2 additions & 2 deletions iter/_iter.py → iterpy/_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __getitem__(self, index: int | slice) -> T | "Iter[T]":
if isinstance(index, int) and index >= 0:
try:
return list(self._non_consumable)[index]
except StopIteration:
except Stopiterpyation:
raise IndexError("Index out of range") from None
elif isinstance(index, slice):
return Iter(
Expand All @@ -54,7 +54,7 @@ def to_list(self) -> list[T]:
def to_tuple(self) -> tuple[T, ...]:
return tuple(self._iterator) # pragma: no cover

def to_iter(self) -> Iterator[T]:
def to_iterator(self) -> Iterator[T]:
return iter(self._iterator) # pragma: no cover

def to_set(self) -> set[T]:
Expand Down
12 changes: 6 additions & 6 deletions iter/_iter.pyi → iterpy/_iter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ This type stub file was generated by pyright.

from collections.abc import (
Callable,
Iterable,
Iterator,
iterpyable,
iterpyator,
Sequence,
)
from typing import Generic, TypeVar, overload
from typing import Generic, Iterable, Iterator, TypeVar, overload

S = TypeVar("S")
T = TypeVar("T")
U = TypeVar("U")

Iterables: TypeVar = (
Iterable | Iterator | tuple | list | set | frozenset # type: ignore
iterpyables: TypeVar = (
iterpyable | iterpyator | tuple | list | set | frozenset # type: ignore
)

class Iter(Generic[T]):
Expand All @@ -27,7 +27,7 @@ class Iter(Generic[T]):
def count(self) -> int: ...
def to_list(self) -> list[T]: ...
def to_tuple(self) -> tuple[T, ...]: ...
def to_iter(self) -> Iterator[T]: ...
def to_iterator(self) -> Iterator[T]: ...
def to_set(self) -> set[T]: ...
def map(self, func: Callable[[T], S]) -> Iter[S]: # noqa: A003
...
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from enum import Enum
from typing import Any

from iter import Iter
from iter.benchmark.query_1.input_data import Q1_DATA
from iter.benchmark.utils import benchmark_method
from iterpy import Iter
from iterpy.benchmark.query_1.input_data import Q1_DATA
from iterpy.benchmark.utils import benchmark_method


class LineStatus(Enum):
Expand Down Expand Up @@ -105,7 +105,7 @@ def main_iterator(data: Sequence[Item]) -> Sequence[CategorySummary]:

summaries = [
summarise_category(group, rows=values)
for group, values in mapping.to_iter()
for group, values in mapping.to_iterator()
]

return summaries
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion iter/test_iter.py → iterpy/test_iter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Sequence

from iter._iter import Iter
from iterpy._iter import Iter


def test_chaining():
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ build-backend = "setuptools.build_meta"
"*" = ["py.typed", "*.pyi"]

[project]
name = "iter"
name = "iterpy"
version = "0.19.0"
authors = [{ name = "Martin Bernstorff", email = "martinbernstorff@gmail.com" }]
description = "iter"
description = "iterpy"
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
Expand Down Expand Up @@ -40,9 +40,9 @@ file = "README.md"
content-type = "text/markdown"

[project.urls]
homepage = "https://github.com/MartinBernstorff/Iter"
repository = "https://github.com/MartinBernstorff/Iter"
documentation = "https://MartinBernstorff.github.io/Iter/"
homepage = "https://github.com/MartinBernstorff/iterpy"
repository = "https://github.com/MartinBernstorff/iterpy"
documentation = "https://MartinBernstorff.github.io/iterpy/"

[tool.pyright]
exclude = [".*venv*"]
Expand Down

0 comments on commit 0279a65

Please sign in to comment.