Skip to content

Commit 38eb781

Browse files
committed
Release v1.3.14
1 parent cae9c69 commit 38eb781

File tree

3 files changed

+18
-37
lines changed

3 files changed

+18
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Releases
22

3+
### v1.3.14 (2025-07-07)
4+
35
- **Added**: `dump_archive` function to dump JSON Lines files into an archive (zip or tar)
46
- **Changed**: Update documentation site during **CD** pipeline instead of CI pipeline
57
- **Changed**: Add Ruff linter integration to **CI** pipeline

README.md

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -79,54 +79,33 @@ which are then stored in a ZIP or TAR archive.
7979
import jsonl
8080

8181
data = [
82+
# Create `file1.jsonl` withing the archive
8283
("file1.jsonl", [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]),
84+
# Create `file2.jsonl` within the archive
8385
("path/to/file2.jsonl", [{"name": "Charlie", "age": 35}, {"name": "David", "age": 40}]),
84-
("file1.jsonl", [{"name": "Eve", "age": 28}]), # this will append to the file1.jsonl
86+
# Append to `file1.jsonl` within the archive
87+
("file1.jsonl", [{"name": "Eve", "age": 28}]),
8588
]
8689
jsonl.dump_archive("my_archive.zip", data)
8790
```
8891

8992
**Dumping data to Multiple JSON Lines Files**
9093

91-
Use `jsonl.dump_fork` to incrementally write structured data to multiple **.jsonl** files—one per key (in this case, player name).
92-
This helps organize and efficiently store data for separate entities.
93-
This example creates individual JSON Lines files for each player, storing their respective wins.
94+
Use `jsonl.dump_fork` to incrementally write structured data to multiple **.jsonl** files,
95+
which can be useful when you want to separate data based on some criteria.
9496

9597
```python
9698
import jsonl
9799

98-
99-
def generate_win_data():
100-
"""Yield player wins data for multiple players."""
101-
102-
data = (
103-
{
104-
"name": "Gilbert",
105-
"wins": [
106-
{"hand": "straight", "card": "7♣"},
107-
{"hand": "one pair", "card": "10♥"},
108-
]
109-
},
110-
{
111-
"name": "May",
112-
"wins": [
113-
{"hand": "two pair", "card": "9♠"},
114-
]
115-
},
116-
{
117-
"name": "Gilbert",
118-
"wins": [
119-
{"hand": "three of a kind", "card": "A♦"},
120-
]
121-
}
122-
)
123-
for player in data:
124-
name = player["name"]
125-
yield (f"{name}.jsonl", player["wins"])
126-
127-
128-
# Write the generated data to files in JSON Lines format
129-
jsonl.dump_fork(generate_win_data())
100+
data = [
101+
# Create `file1.jsonl` or overwrite it if it exists
102+
("file1.jsonl", [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]),
103+
# Create `file2.jsonl` or overwrite it if it exists
104+
("file2.jsonl", [{"name": "Charlie", "age": 35}, {"name": "David", "age": 40}]),
105+
# Append to `file1.jsonl`
106+
("file1.jsonl", [{"name": "Eve", "age": 28}]),
107+
]
108+
jsonl.dump_fork(data)
130109
```
131110

132111
## Documentation

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "py-jsonl"
3-
version = "1.3.13"
3+
version = "1.3.14"
44
description = "A lightweight Python library for handling jsonlines files."
55
readme = "README.md"
66
license-files = ["LICENSE"]

0 commit comments

Comments
 (0)