Skip to main content

FilesFF - Files For Fun

PyPI version PyPI downloads

  • 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 with all extras

pip install filesff[protobug,ujson,cap,msgpack,s3]

Usage

read a json from gzip compressed file:

accessor = GzippedFileHandle.of_str("./file.gz").access(JsonFormatter())
accessor.dump({"json": "data"})

write a protobuf into a temp file

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

accessor = PathFileHandle.of_temp().access(ProtoBytesFileFormatter)
now = Timestamp()
now.FromDatetime(datetime.now())
accessor.dump(now)

loaded_now = accessor.load(message_cls=Timestamp)

implement new file format:

class NewFileFormatter(FullTextFileFormatter):
    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 = PathFileHandle.of_str("./path.ae").access(NewFileFormatter())
file_accessor.dump("ababab")

Metadata

Release files for filesff 0.0.6

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.6
File Size Uploaded Provenance Actions
filesff-0.0.6.tar.gz 6.6 kB Without provenance Details for filesff-0.0.6.tar.gz

Built distribution (wheel)

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

Total release size: 16.1 kB

Release files / filesff-0.0.6.tar.gz

Download URL filesff-0.0.6.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
23b6bd50d79ea24299b604c008868c8a3387f93d2988daf3275b0849606a48b4
BLAKE2b-256 checksum
How to use checksums
921751de49502eecb831832ad86a245d0ba71133d25bc14a5917b5756115670f
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.6-py3-none-any.whl

Download URL filesff-0.0.6-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6b7745fa8688d7a3943c8f8cd61a0380f6bbf7ab8da86de9abd537ae7f26584
BLAKE2b-256 checksum
How to use checksums
bcf7655791ef94cd6c851c27881391e27837495e25205420b28c5480117761bb
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.6

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