Skip to content

msaelices/mojo-csv

Repository files navigation

mojo-csv

mojo-csv is a lightweight library for parsing and writing CSV files that adheres closely to the Python standard library's csv module. It aims to provide an intuitive and familiar interface with additional features for enhanced usability.

Disclaimer ⚠️

This software is in a early stage of development, using the Mojo nightly version.

Features

  • CSV Reading and Writing: Supports reading from and writing to CSV files with a familiar API.
  • Custom Delimiters: Easily specify custom delimiters, quote characters, and line terminators.
  • Data Validation: Includes optional data validation during parsing.
  • Compatibility: API similar to Python's csv module for easy transition and minimal learning curve.

Installation

  1. Install Mojo nightly 🔥

  2. Add the CSV Package (at the top level of your project):

    magic add csv

Example of usage

from csv import reader

fn main():
    with open('data.csv', 'r') as file:
        csv_reader = reader(file, delimiter=',', quotechar='"', doublequote=True)
        for row in csv_reader:
            print(','.join(row))

TODO

  • Iterations instead of loading the whole file into memory
  • Optimizations leveraging SIMD

Contributing

Contributions are welcome! If you'd like to contribute, please follow the contribution guidelines in the CONTRIBUTING.md file in the repository.

License

mojo-csv is licensed under the MIT license.

About

Mojo CSV library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published