Skip to main content

FilesFF - Files For Fun

  • python package to work with file handles
  • use handles of files as parameters without keeping open files
  • replace file handles easily with mocks
  • handle many file types with generic protocol

to install

pip install filesff

Usage

read a json from gzip compressed file:

accessor = json_file_accessor("./file.gz", GzippedFileHandle)
accessor.dump({"json": "data"})

write a protobuf into a temp file

pip install fileff[protobuf]
from google.protobuf.timestamp_pb2 import Timestamp

accessor = temp_protobuf_file_accessor()
now = Timestamp()
now.FromDatetime(datetime.now())
accessor.dump(now)

loaded_now = accessor.load(message_cls=Timestamp)

implement new file format:

class NewFileFormatter(FullFileFormatter):
    def load(self, reader: IO, **_) -> AnyStr:
        return reader.read().replace("a", "e")

    def dump(self, writer: IO, value: Any, **_):
        writer.write(value.replace("e", "a"))

use it

file_accessor = FullFileAccessor.of("./path.ae", NewFileFormatter())
file_accessor.dump("ababab")

Metadata

Release files for filesff 0.0.3

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

Source distribution (sdist)

Source distribution for filesff 0.0.3
File Size Uploaded Provenance Actions
filesff-0.0.3.tar.gz 5.8 kB Without provenance Details for filesff-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 14.6 kB

Release files / filesff-0.0.3.tar.gz

Download URL filesff-0.0.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7aeb04cd5eb966f739a4903d5caf54343b2d1e1e84a97be8e6fe819561c1ac7f
BLAKE2b-256 checksum
How to use checksums
cc38d977f558e1c2e662868a48807346cdfd1c5c9f4daf2d3d324f78afda0efa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.11.1 Windows/10

Release files / filesff-0.0.3-py3-none-any.whl

Download URL filesff-0.0.3-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f6f1b76545aba10b8eec0dc7af72615e6011a87e0956385a7a92668eda692ee
BLAKE2b-256 checksum
How to use checksums
b44a5c47be028b42dd87f6f9b654971d4a62bb3a70378f8768f3d04e9abb7fad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.11.1 Windows/10

Security for filesff 0.0.3

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.

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