Skip to content

Commit

Permalink
Merge pull request #92 from PickwickSoft/release/v1.3.0
Browse files Browse the repository at this point in the history
Release v1.3.0
  • Loading branch information
garlontas authored May 16, 2024
2 parents 471b6ea + 1093956 commit 3436199
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Now you might be wondering why another library when there are already a few impl
* The implementation achieves 100% test coverage.
* It follows Pythonic principles, resulting in clean and readable code.
* It adds some cool innovative features such as conditions or error handling and an even more declarative look.
* It provides loaders for various data sources such as CSV, JSON and XML files.
* It provides loaders for various data sources such as CSV, JSON, XML and YAML files.

Let's take a look at a small example:

Expand Down Expand Up @@ -213,15 +213,15 @@ Stream.concat(Stream.of([1, 2]), Stream.of([3, 4]))

Creates a new Stream from multiple Streams. Order doesn't change.

## Use loaders: Load data from CSV, JSON and XML files in just one line
## Use loaders: Load data from CSV, JSON, XML and YAML files in just one line

PyStreamAPI offers a convenient way to load data from CSV, JSON and XML files. Like that you can start processing your
PyStreamAPI offers a convenient way to load data from CSV, JSON, XML and YAML files. Like that you can start processing your
files right away without having to worry about reading and parsing the files.

You can import the loaders with:

```python
from pystreamapi.loaders import csv, json, xml
from pystreamapi.loaders import csv, json, xml, yaml
```
Now you can use the loaders directly when creating your Stream:

Expand Down Expand Up @@ -253,14 +253,30 @@ pip install streams.py[xml_loader]
Afterward, you can use the XML loader like this:

```python
Stream.of(xml("data.xml"))
.map(lambda x: x.attr1)
Stream.of(xml("data.xml")) \
.map(lambda x: x.attr1) \
.for_each(print)
```

The access to the attributes is using a node path syntax. For more details on how to use the node path syntax, please
refer to the [documentation](https://pystreamapi.pickwicksoft.org/reference/data-loaders).

For YAML:

In order to use the YAML loader, you need to install the optional yaml dependency:

```bash
pip install streams.py[yaml_loader]
```

Afterward, you can use the YAML loader like this:

```python
Stream.of(yaml("data.yaml")) \
.map(lambda x: x.attr1) \
.for_each(print)
```

## API Reference
For a more detailed documentation view the docs on GitBook: [PyStreamAPI Docs](https://pystreamapi.pickwicksoft.org/)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "streams.py"
version = "1.2.1"
version = "1.3.0"
authors = ["Stefan Garlonta <stefan@pickwicksoft.org>"]
description = "A stream library for Python inspired by Java Stream API"
keywords = ["streams", "parallel", "data"]
Expand Down
2 changes: 1 addition & 1 deletion pystreamapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pystreamapi.__stream import Stream
from pystreamapi._streams.error.__levels import ErrorLevel

__version__ = "1.2.1"
__version__ = "1.3.0"
__all__ = ["Stream", "ErrorLevel"]

0 comments on commit 3436199

Please sign in to comment.