Skip to main content

Utilities for working with newline delimited JSON (NDJSON) files.

Latest release 20211208: Initial PyPI release.

Function append_ndjson(arg, *a, **kw)

Append an iterable of objects to a file as newline delimited JSON.

Function scan_ndjson(arg, *a, **kw)

Read a newline delimited JSON file, yield instances of dictclass (default dict, otherwise a class which can be instantiated by dictclass(a_dict)).

error_list is an optional list to accrue (lineno,exception) tuples for errors encountered during the scan.

Class UUIDNDJSONMapping(cs.obj.SingletonMixin,cs.mappings.IndexedSetMixin)

A subclass of IndexedSetMixin which maintains records from a newline delimited JSON file.

Method UUIDNDJSONMapping.__init__(self, filename, dictclass=<class 'cs.mappings.UUIDedDict'>, create=False)

Initialise the mapping.

Parameters:

  • filename: the file containing the newline delimited JSON data; this need not yet exist
  • dictclass: a optional dict subclass to hold each record, default UUIDedDict
  • create: if true, ensure the file exists by transiently opening it for append if it is missing; default False

Method UUIDNDJSONMapping.add_backend(self, record)

Append record to the backing file.

Method UUIDNDJSONMapping.rewrite_backend(self)

Rewrite the backing file.

Because the record updates are normally written in append mode, a rewrite will be required every so often.

Method UUIDNDJSONMapping.scan(self)

Scan the backing file, yield records.

Function write_ndjson(arg, *a, **kw)

Transcribe an iterable of objects to a file as newline delimited JSON.

Release Log

Release 20211208: Initial PyPI release.

Metadata

Release files for cs-ndjson 20211208

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs-ndjson 20211208
File Size Uploaded Provenance Actions
cs.ndjson-20211208.tar.gz 3.7 kB Without provenance Details for cs.ndjson-20211208.tar.gz

Release files / cs.ndjson-20211208.tar.gz

Download URL cs.ndjson-20211208.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fee83178551a62ab7a98f8a9c4f1adf9a3aff52a4eca118887c9e3c7b487bcd7
BLAKE2b-256 checksum
How to use checksums
34946bd5963399b6bdb2b5d63d795e705f2148ceb34f82d17cc5d84e691743e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

Security for cs-ndjson 20211208

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

20211208 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page