Skip to main content

Python package containing useful file system operations

Project description

File System IO

Badges
License License: MIT
PyPI PyPI version PyPI - Python Version
Version Build Status
Main GitHub Build main GitHub Build main

File System IO or simply FSIO is a Python package containing useful file system operations.

Table of contents

Installation

Installing the main package is as simple as downloading from PyPI.

pip install 'fsio==$VERSION'

If you also require use of the CLI, then you can install with extras as follows.

pip install 'fsio[cli]==$VERSION'

Getting Started

This package was designed for simplifying some file system operations. Its original design was for detecting file types of a file, but it has been expanded beyond this. The main code lives within the core directory. Here, for example, you will see the file_type class which supports the detect-file-type commands within the CLI. Moreover, we can use this within Python code provided we have the object in BytesIO form. For example, suppose we have a .parquet file without an extension and we want to establish its type, and confirm that it really is of type parquet. To do this, we could do something as follows.

>>> from io import BytesIO
>>> from pathlib import Path
>>>
>>> from fsio.core import FileType
>>>
>>> path_to_file = Path('path/to/suspected/parquet')
>>>
>>> with path_to_file.open('rb') as f:
>>>     body = BytesIO(f.read())
>>>
>>> FileType.detect_file_type(body)
'parquet'

CLI

If you optionally installed the cli subpackage, then you get extra functionality and are able to use most of the functionality from the core package. For example, you can detect the file type of a given file using the command

fsio detect-file-type path/to/file.ext

This will return the type of the file to the stdout, for example parquet. You can get more information about each command by using the --help flag on each command. The CLI was designed using typer, from the creators of FastAPI. A list of the following CLI commands which are available are below.

Commands
fsio detect-file-type FILE Detect the type of FILE given as input
fsio supported-types List the current supportoed file types

Development

To contribute to this project, you can clone the repository and install the development dependencies. This can be done using uv sync --all-extras (which uses the uv.lock file for consistency). There is a pre-commit hook which will run on each commit to ensure that the code is formatted correctly. To install this, we need to run

uv sync --extra test

to install pre-commit and then run pre-commit install in terminal. We can manually run the pre-commit hooks using the command

pre-commit run --all-files

Branching

When creating a new branch, please use one of the following:

  • feature/* for new features, branching off of develop branch (with PR to develop on completion);
  • bugfix/* for bug fixes (non-critical), branches off of develop branch (with PR to develop on completion);
  • hotfix/* for hotfixes, branching off of main branch (with PR to main on completion, then synced to develop); and
  • release/* for releases, branching off of develop branch (with PR to main on completion, then synced to develop).

The main branch is the stable deployment, and release branches are used for preparing a new release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fsio-1.3.6.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fsio-1.3.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file fsio-1.3.6.tar.gz.

File metadata

  • Download URL: fsio-1.3.6.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.6

File hashes

Hashes for fsio-1.3.6.tar.gz
Algorithm Hash digest
SHA256 17cbb98e9bde32747cab07686130814d5be2ee0fc05c6b378aceb2e690346a6a
MD5 ae25a760b3ff624598c2f879a079ddc8
BLAKE2b-256 785ccc0afae8f81262152faa959647b7498f6b1e82217730ee0595772073a991

See more details on using hashes here.

File details

Details for the file fsio-1.3.6-py3-none-any.whl.

File metadata

  • Download URL: fsio-1.3.6-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.6

File hashes

Hashes for fsio-1.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d34f4af333d8c923fbff73a4e3085d1001be69460cea109163c5e2b3fbba45
MD5 3aa9389338ad36ae77ee6902a9a8dd6a
BLAKE2b-256 aefb3fd2222f5872b7375d9bbe9b1727e21005deac8a1a8a88eb84cbca57e5aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page