Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fb96984
mojo_csv
Phelsong Mar 12, 2025
0cccda6
Update recipe.yaml for CI
Mar 13, 2025
4799442
unquote for ci
Phelsong Mar 19, 2025
532a532
update test
Phelsong Mar 25, 2025
acae1eb
Merge branch 'main' into main
carolinefrasca Apr 14, 2025
a79c0d9
Update source git URL
carolinefrasca Apr 14, 2025
e93d802
change tests syntax
carolinefrasca Apr 14, 2025
0468a4a
Merge branch 'main' into main
carolinefrasca Apr 14, 2025
9b83dea
Merge branch 'main' into main
Phelsong Apr 23, 2025
28c6b0b
Merge branch 'main' into main
Phelsong Apr 29, 2025
181b35b
Merge branch 'main' into main
carolinefrasca Apr 30, 2025
63c9619
Merge branch 'main' into main
carolinefrasca Apr 30, 2025
811f118
verify 25.3.0 and update test
Phelsong Jun 3, 2025
433e85f
Merge branch 'main' into main
Phelsong Jun 3, 2025
87058f1
Merge branch 'main' into main
carolinefrasca Jun 3, 2025
95caa34
update test
Phelsong Jun 5, 2025
564d561
Merge remote-tracking branch 'origin/main'
Phelsong Jun 5, 2025
5a4d112
Merge branch 'main' into main
Phelsong Jun 5, 2025
ed4bd1a
Merge branch 'main' into main
carolinefrasca Jun 5, 2025
e36062c
update csv path
Phelsong Jun 5, 2025
5107692
Merge branch 'main' into main
Phelsong Jun 5, 2025
30ed096
Merge branch 'main' into main
carolinefrasca Jun 9, 2025
770b35c
update test to cwd
Phelsong Jun 10, 2025
0967a1b
Merge remote-tracking branch 'origin/main'
Phelsong Jun 10, 2025
8a55ce0
Merge branch 'main' into main
Phelsong Jun 10, 2025
fb67417
update build and versioning
Phelsong Jun 18, 2025
3203ee0
Merge branch 'main' into main
Phelsong Jun 18, 2025
c02eef6
add logo
Phelsong Jun 19, 2025
378904b
update readme
Phelsong Jun 19, 2025
55ac9cb
Merge branch 'main' into main
carolinefrasca Jun 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions recipes/mojo_csv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!-- ![mojo_csv_logo](./mojo_csv_logo.png) -->
<image src='./mojo_csv_logo.png' width='900'/>

![language](https://img.shields.io/badge/language-mojo-orange)
![license](https://badgen.net/static/license/MIT/red)

# Mojo Csv

Csv parsing library written in pure Mojo

### usage

Add the Modular community channel (https://repo.prefix.dev/modular-community) to your mojoproject.toml file or pixi.toml file in the channels section.

##### Basic Usage

```mojo
from mojo_csv import CsvReader
from pathlib import Path

fn main():
var csv_path = Path("path/to/csv/file.csv")
var reader = CsvReader(csv_path)
for i in range(len(reader)):
print(reader[i])
```

##### Optional Usage

```mojo
from mojo_csv import CsvReader
from pathlib import Path

fn main():
var csv_path = Path("path/to/csv/file.csv")
var reader = CsvReader(csv_path, delimiter="|", quotation_mark='*')
for i in range(len(reader)):
print(reader[i])
```

### Attributes

```mojo
reader.raw : String # raw csv string
reader.raw_length : Int # total number of Chars
reader.headers : List[String] # first row of csv file
reader.row_count : Int # total number of rows T->B
reader.column_count : Int # total number of columns L->R
reader.elements : List[String] # all delimited elements
reader.length : Int # total number of elements
```

##### Indexing

currently the array is only 1D, so indexing is fairly manual.

```Mojo
reader[0] # first element
```
Binary file added recipes/mojo_csv/mojo_csv_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions recipes/mojo_csv/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
context:
version: 1.2.1

package:
name: "mojo_csv"
version: ${{ version }}

source:
- git: https://github.com/Phelsong/mojo_csv.git
rev: c0c5b4b1fd7d7c4db1c504d1104b38f10ef9ff70

build:
number: 0
script:
- mojo package src -o ${{ PREFIX }}/lib/mojo/mojo_csv.mojopkg

requirements:
host:
- max >=25.1.0,<26
run:
- ${{ pin_compatible('max') }}

tests:
- script:
- if: unix
then:
- mojo test tests
files:
recipe:
- mojo_csv

about:
homepage: https://github.com/Phelsong/mojo_csv
license: MIT
license_file: LICENSE
summary: Csv parsing library written in pure Mojo
repository: https://github.com/Phelsong/mojo_csv

extra:
maintainers:
- phelsong
project_name:
- mojo_csv