Skip to content

A ⚡️fast⚡️ implementation of the pathlib.Path class. Written in Rust, built for Python.

Notifications You must be signed in to change notification settings

juftin/pathlibrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

pathlib.rs

A ⚡️fast⚡️ implementation of the pathlib.Path class. Written in Rust, built for Python.

Usage

from pathlibrs import Path

p = Path("foo/bar")
p.mkdir(parents=True)
baz_file = p / "baz.txt"
baz_file.write_text("Hello, world!")

Performance

pathlibrs is much faster than the standard library's pathlib module for certain operations. For example, traversing a directory tree can be ~4x faster:

from pathlib import Path
from pathlibrs import Path as PathRS

p = Path("~/Downloads")
r = PathRS("~/Downloads")

%timeit
list(p.glob("**/*"))
# 1.03 s ± 6.04 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

%timeit
list(r.glob("**/*"))
# 253 ms ± 1.04 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

About

A ⚡️fast⚡️ implementation of the pathlib.Path class. Written in Rust, built for Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published