← Return to program

Adding File System context to pathlib

Sunday 11:55 AM–12:25 PM in Eureka 2

Adding file system specific information (e.g. how to match case, whether to follow symlinks) to pathlib Path objects, instead of adding such arguments to methods taking Path objects.

See this talk and many more by getting your ticket to PyCon AU now!

I want a ticket!

Pathlib has become the de facto standard to pass file system paths around, which is kinda weird as the only real thing it's going go for it is a tiny bit of syntactic sugar.

Paths are a bit of an odd duck, as their literal form is very close to their object form.

But there are extra bits of context around a path that matter, such as following symlinks, and junctions, how to handle case when matching file names.

I became interested in the idea of embedding some of this knowledge inside the path object, and seeing if that led to a clean up of the API, can we avoid having all these file system, implementation specific flags in our API, and instead encapsulate them within our path objects?

A lot of work has been done in the last few releases to make pathlib extensible, so that paves the way for trying API experiments like this.

Often when you get an idea, it rattles around in the brain like a buzzing bee. With Python you can throw it up on the "ideas" forum and get it shot down quickly.

Or Not..

Clinton Roy they • clinton_roy

Clinton is an Open Source software engineer, who has made a career around supporting researchers.