Python package containing useful file system operations
Project description
File System IO
| Badges | |
|---|---|
| License | |
| PyPI |
| Version | Build Status |
|---|---|
| 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.
There is a pre-commit hook which will run on each commit to ensure that the code is formatted correctly.
To install this, install the .[test] requirements of this project and then run pre-commit install in terminal.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fsio-1.3.1.tar.gz.
File metadata
- Download URL: fsio-1.3.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a49967a881749bcb2b29bc6b3b03ccbe02d9d5b651a56c0308105df9a7acd6
|
|
| MD5 |
176c394fd45785dfc000d9a40c747b71
|
|
| BLAKE2b-256 |
df2df1b2106640a49856d5824a01a1f114d3d9740c2baa17f37f7ee657e3ba49
|
Provenance
The following attestation bundles were made for fsio-1.3.1.tar.gz:
Publisher:
python-publish.yaml on collier-p-charlie/fsio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fsio-1.3.1.tar.gz -
Subject digest:
76a49967a881749bcb2b29bc6b3b03ccbe02d9d5b651a56c0308105df9a7acd6 - Sigstore transparency entry: 348270557
- Sigstore integration time:
-
Permalink:
collier-p-charlie/fsio@3adafd3cbbf408e5c596402f1e29ef01d490740e -
Branch / Tag:
refs/tags/1.3.1 - Owner: https://github.com/collier-p-charlie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@3adafd3cbbf408e5c596402f1e29ef01d490740e -
Trigger Event:
release
-
Statement type:
File details
Details for the file fsio-1.3.1-py3-none-any.whl.
File metadata
- Download URL: fsio-1.3.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e77794a53b976b8d98d7455846d65ca6a6bb601788c33e4a36e51580ed53a40
|
|
| MD5 |
586607ceb3813c2090b0aea2c41f3e9e
|
|
| BLAKE2b-256 |
0ca0e8bf0c3fce9dab1c1d65c5cd9022a7e5899bb1fe14a805b5528aa70a0855
|
Provenance
The following attestation bundles were made for fsio-1.3.1-py3-none-any.whl:
Publisher:
python-publish.yaml on collier-p-charlie/fsio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fsio-1.3.1-py3-none-any.whl -
Subject digest:
4e77794a53b976b8d98d7455846d65ca6a6bb601788c33e4a36e51580ed53a40 - Sigstore transparency entry: 348270580
- Sigstore integration time:
-
Permalink:
collier-p-charlie/fsio@3adafd3cbbf408e5c596402f1e29ef01d490740e -
Branch / Tag:
refs/tags/1.3.1 - Owner: https://github.com/collier-p-charlie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@3adafd3cbbf408e5c596402f1e29ef01d490740e -
Trigger Event:
release
-
Statement type: