Skip to main content

Text File Splitter

CircleCI Issues Forks Stars

Python module to split text file easy and fast, without compromising memory using big files.

Installation

You can install text-file-splitter by running the following command:

pip install text-file-splitter

Or you can download direct from Github and install it manually.

Usage

Import the module and initialise it.

    from text_files_splitter import TextFilesSplitter, ListMetrics

    source_file = './src/test/files'
    file_name = 'test_csv.csv'
    max_size_file = 10
    file_type = 'csv'
    metric_units = ListMetrics.MB
    output_directory = './output'
    include_header = True
    file_suffix = 'file_example'

    file_splitter = TextFilesSplitter(source_file, file_name, max_size_file, file_type,
                                                ListMetrics.MB, output_directory, include_header, file_suffix)

    files_splitted = file_splitter.get_file_splitted()

The outcome of get_file_splitted() is a list of dict with the following details

files_splitted = [
    {
        "file_name": file_name,
        "path": output_directory,
        "file_size": file_size_in_bytes,
        "count": count
    }...
]


Files compatibility

  • csv

Test

To run a test of the clone the repository and follow the instructions

pip install -r requirements.txt
python -m unittest

Expected Outcome

the time may vary depending on your machine performance

Ran 1 test in 0.180s

OK

List of test created

  • csv

Requirements

  • Python 3.4 or newer

Code Standards

Following pylint standards

License

The MIT License (MIT). Please see License File for more information.

Contributions

Thanks to Gorka for all his contributions.

Metadata

Release files for text-file-splitter 0.0.13

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

Source distribution (sdist)

Source distribution for text-file-splitter 0.0.13
File Size Uploaded Provenance Actions
text-file-splitter-0.0.13.tar.gz 4.7 kB Without provenance Details for text-file-splitter-0.0.13.tar.gz

Release files / text-file-splitter-0.0.13.tar.gz

Download URL text-file-splitter-0.0.13.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4e94a85474f482c4b4c5e3da9d3ac0ba37685599de1dec6ac43e4fbcf85f290c
BLAKE2b-256 checksum
How to use checksums
561494940aab426939d964ab38d70059090b297adbd5118811d9b88f3ce11ca3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Security for text-file-splitter 0.0.13

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.

Release history Release notifications | RSS feed

This release

0.0.13 This release

1 release file No provenance

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