Skip to main content

npyfile is a a package that allows you to continuously write arrays to a .npy file. You can use it like a standard Python file with the well-known context manager.

Warning: Due to the internal structure of .npy files, the arrays must have the same shape & dtype.

Example

Generate some artificial dummy data, e.g. images, & write them into a temporary file. A real world scenario reflecting this is the continuous arrival of new images from a camera.

import pathlib
import tempfile
tmp_dir = tempfile.TemporaryDirectory()
outfile = pathlib.Path(tmp_dir.name) / 'images.npy'

images = np.random.randint(low=0, high=255, size=(10,640,480,3))

with NpyFile(outfile) as file:
    for img in images:
        file.write(img)

np.testing.assert_array_equal(images, np.load(outfile))

tmp_dir.cleanup()

Credits

  • attrs: Project & infrastructure setup

  • numpy: File format

Release files for npyfile 1.0.0

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

Source distribution (sdist)

Source distribution for npyfile 1.0.0
File Size Uploaded
npyfile-1.0.0.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for npyfile 1.0.0
File Interpreter ABI Platform
npyfile-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size:16.0 kB

Release files / npyfile-1.0.0.tar.gz

Download URL npyfile-1.0.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
25658f37448d3522710765d3e7afcecef81da747dde3b1562274648debc74ba3
BLAKE2b-256 checksum
How to use checksums
c271d23e95e4ee394f5ef3c66f8362c1f05690dc43e9a12c16bd4f0eaa5c5d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

Release files / npyfile-1.0.0-py3-none-any.whl

Download URL npyfile-1.0.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10f7abcea1ec0d77edc3344be2c9fc2e01214b9cdf85f8ca3c450c3c02bc30f7
BLAKE2b-256 checksum
How to use checksums
53f355680764f046a5f3ce4c13e8cf4f5dd963c4ef2a2bf16426d50d456f6931
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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