@@ -136,11 +136,11 @@ data = {"foo": "bar", "baz": 123}
136136srsly.write_json(" /path/to/file.json" , data)
137137```
138138
139- | Argument | Type | Description |
140- | ---------- | ------------ | ------------------------------------------------------ |
141- | ` path ` | str / ` Path ` | The file path or ` "-" ` to write to stdout. |
142- | ` data ` | - | The JSON-serializable data to output. |
143- | ` indent ` | int | Number of spaces used to indent JSON. Defaults to ` 2 ` . |
139+ | Argument | Type | Description |
140+ | -------- | ------------ | ------------------------------------------------------ |
141+ | ` path ` | str / ` Path ` | The file path or ` "-" ` to write to stdout. |
142+ | ` data ` | - | The JSON-serializable data to output. |
143+ | ` indent ` | int | Number of spaces used to indent JSON. Defaults to ` 2 ` . |
144144
145145#### <kbd >function</kbd > ` srsly.read_json `
146146
@@ -152,7 +152,7 @@ data = srsly.read_json("/path/to/file.json")
152152
153153| Argument | Type | Description |
154154| ----------- | ------------ | ------------------------------------------ |
155- | ` path ` | str / ` Path ` | The file path or ` "-" ` to read from stdin. |
155+ | ` path ` | str / ` Path ` | The file path or ` "-" ` to read from stdin. |
156156| ** RETURNS** | dict / list | The loaded JSON content. |
157157
158158#### <kbd >function</kbd > ` srsly.write_gzip_json `
@@ -164,11 +164,27 @@ data = {"foo": "bar", "baz": 123}
164164srsly.write_gzip_json(" /path/to/file.json.gz" , data)
165165```
166166
167- | Argument | Type | Description |
168- | ---------- | ------------ | ------------------------------------------------------ |
169- | ` path ` | str / ` Path ` | The file path. |
170- | ` data ` | - | The JSON-serializable data to output. |
171- | ` indent ` | int | Number of spaces used to indent JSON. Defaults to ` 2 ` . |
167+ | Argument | Type | Description |
168+ | -------- | ------------ | ------------------------------------------------------ |
169+ | ` path ` | str / ` Path ` | The file path. |
170+ | ` data ` | - | The JSON-serializable data to output. |
171+ | ` indent ` | int | Number of spaces used to indent JSON. Defaults to ` 2 ` . |
172+
173+ #### <kbd >function</kbd > ` srsly.write_gzip_jsonl `
174+
175+ Create a gzipped JSONL file and dump contents.
176+
177+ ``` python
178+ data = [{" foo" : " bar" }, {" baz" : 123 }]
179+ srsly.write_gzip_json(" /path/to/file.jsonl.gz" , data)
180+ ```
181+
182+ | Argument | Type | Description |
183+ | ----------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
184+ | ` path ` | str / ` Path ` | The file path. |
185+ | ` lines ` | - | The JSON-serializable contents of each line. |
186+ | ` append ` | bool | Whether or not to append to the location. Appending to .gz files is generally not recommended, as it doesn't allow the algorithm to take advantage of all data when compressing - files may hence be poorly compressed. |
187+ | ` append_new_line ` | bool | Whether or not to write a new line before appending to the file. |
172188
173189#### <kbd >function</kbd > ` srsly.read_gzip_json `
174190
@@ -180,9 +196,22 @@ data = srsly.read_gzip_json("/path/to/file.json.gz")
180196
181197| Argument | Type | Description |
182198| ----------- | ------------ | ------------------------ |
183- | ` path ` | str / ` Path ` | The file path. |
199+ | ` path ` | str / ` Path ` | The file path. |
184200| ** RETURNS** | dict / list | The loaded JSON content. |
185201
202+ #### <kbd >function</kbd > ` srsly.read_gzip_jsonl `
203+
204+ Load gzipped JSONL from a file.
205+
206+ ``` python
207+ data = srsly.read_gzip_jsonl(" /path/to/file.jsonl.gz" )
208+ ```
209+
210+ | Argument | Type | Description |
211+ | ----------- | ------------ | ------------------------- |
212+ | ` path ` | str / ` Path ` | The file path. |
213+ | ** RETURNS** | dict / list | The loaded JSONL content. |
214+
186215#### <kbd >function</kbd > ` srsly.write_jsonl `
187216
188217Create a JSONL file (newline-delimited JSON) and dump contents line by line, or
@@ -195,7 +224,7 @@ srsly.write_jsonl("/path/to/file.jsonl", data)
195224
196225| Argument | Type | Description |
197226| ----------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- |
198- | ` path ` | str / ` Path ` | The file path or ` "-" ` to write to stdout. |
227+ | ` path ` | str / ` Path ` | The file path or ` "-" ` to write to stdout. |
199228| ` lines ` | iterable | The JSON-serializable lines. |
200229| ` append ` | bool | Append to an existing file. Will open it in ` "a" ` mode and insert a newline before writing lines. Defaults to ` False ` . |
201230| ` append_new_line ` | bool | Defines whether a new line should first be written when appending to an existing file. Defaults to ` True ` . |
@@ -211,7 +240,7 @@ data = srsly.read_jsonl("/path/to/file.jsonl")
211240
212241| Argument | Type | Description |
213242| ---------- | ---------- | -------------------------------------------------------------------- |
214- | ` path ` | str / Path | The file path or ` "-" ` to read from stdin. |
243+ | ` path ` | str / Path | The file path or ` "-" ` to read from stdin. |
215244| ` skip ` | bool | Skip broken lines and don't raise ` ValueError ` . Defaults to ` False ` . |
216245| ** YIELDS** | - | The loaded JSON contents of each line. |
217246
@@ -272,10 +301,10 @@ data = {"foo": "bar", "baz": 123}
272301srsly.write_msgpack(" /path/to/file.msg" , data)
273302```
274303
275- | Argument | Type | Description |
276- | ---------- | ------------ | ---------------------- |
277- | ` path ` | str / ` Path ` | The file path. |
278- | ` data ` | - | The data to serialize. |
304+ | Argument | Type | Description |
305+ | -------- | ------------ | ---------------------- |
306+ | ` path ` | str / ` Path ` | The file path. |
307+ | ` data ` | - | The data to serialize. |
279308
280309#### <kbd >function</kbd > ` srsly.read_msgpack `
281310
@@ -287,7 +316,7 @@ data = srsly.read_msgpack("/path/to/file.msg")
287316
288317| Argument | Type | Description |
289318| ----------- | ------------ | --------------------------------------------------------------------------------------- |
290- | ` path ` | str / ` Path ` | The file path. |
319+ | ` path ` | str / ` Path ` | The file path. |
291320| ` use_list ` | bool | Don't use tuples instead of lists. Can make deserialization slower. Defaults to ` True ` . |
292321| ** RETURNS** | - | The loaded and deserialized content. |
293322
@@ -343,7 +372,7 @@ yaml_string = srsly.yaml_dumps(data)
343372| ----------------- | ---- | ------------------------------------------ |
344373| ` data ` | - | The JSON-serializable data to output. |
345374| ` indent_mapping ` | int | Mapping indentation. Defaults to ` 2 ` . |
346- | ` indent_sequence ` | int | Sequence indentation. Defaults to ` 4 ` . |
375+ | ` indent_sequence ` | int | Sequence indentation. Defaults to ` 4 ` . |
347376| ` indent_offset ` | int | Indentation offset. Defaults to ` 2 ` . |
348377| ` sort_keys ` | bool | Sort dictionary keys. Defaults to ` False ` . |
349378| ** RETURNS** | str | The serialized string. |
@@ -373,10 +402,10 @@ srsly.write_yaml("/path/to/file.yml", data)
373402
374403| Argument | Type | Description |
375404| ----------------- | ------------ | ------------------------------------------ |
376- | ` path ` | str / ` Path ` | The file path or ` "-" ` to write to stdout. |
405+ | ` path ` | str / ` Path ` | The file path or ` "-" ` to write to stdout. |
377406| ` data ` | - | The JSON-serializable data to output. |
378407| ` indent_mapping ` | int | Mapping indentation. Defaults to ` 2 ` . |
379- | ` indent_sequence ` | int | Sequence indentation. Defaults to ` 4 ` . |
408+ | ` indent_sequence ` | int | Sequence indentation. Defaults to ` 4 ` . |
380409| ` indent_offset ` | int | Indentation offset. Defaults to ` 2 ` . |
381410| ` sort_keys ` | bool | Sort dictionary keys. Defaults to ` False ` . |
382411
@@ -390,7 +419,7 @@ data = srsly.read_yaml("/path/to/file.yml")
390419
391420| Argument | Type | Description |
392421| ----------- | ------------ | ------------------------------------------ |
393- | ` path ` | str / ` Path ` | The file path or ` "-" ` to read from stdin. |
422+ | ` path ` | str / ` Path ` | The file path or ` "-" ` to read from stdin. |
394423| ** RETURNS** | dict / list | The loaded YAML content. |
395424
396425#### <kbd >function</kbd > ` srsly.is_yaml_serializable `
0 commit comments