Skip to content
muhrinPublic

About

A way to treat your python objects like files on disk

Resources

Stars

13 stars

Watchers

3 watching

Forks

Repository files navigation

pyOS

CI Coverage Latest Version Python versions License Ruff

A fresh way to interact with your python objects as though they were files on your filesystem.

Why pyOS?

pyOS gives your Python objects a home: a versioned, searchable filesystem that you browse with the commands you already know. It's at its best in interactive work (IPython, Jupyter), wherever results pile up faster than you can organise them:

  • An organised, searchable home for your results: no more folders of pickle files, save the objects themselves into directories and find them by what they contain, without a database schema:

    mkdir("projects/alloys/")
    save(Result("CuZn", energy=-3.5), "projects/alloys/CuZn")
    find("projects/", Result.energy < -3.2)
  • Lightweight experiment tracking: tag objects with metadata (meta -s), find them by it and mv the interesting ones somewhere safe.

  • Every version kept: history(result) shows how any object came to be what it is.

  • Work locally, share with your group: start with a local database (nothing to install) and rsync what is worth keeping to a shared server.

See the documentation for examples of each.

Installation

pyOS needs Python 3.11 or later:

pip install pyos

Objects are stored using mincePy, either in a local directory (with litemongo, no server needed) or in MongoDB. Tell pyOS where with the MINCEPY_ARCHIVE environment variable:

# In a local directory
export MINCEPY_ARCHIVE="litemongo:///path/to/my/db#pyos"

# Or, in MongoDB, e.g. a server started with: docker run -d -p 27017:27017 mongo
export MINCEPY_ARCHIVE="mongodb://localhost/pyos"

Getting started

Use pyOS from Python (e.g. IPython or Jupyter):

In [1]: from pyos.pyos import *
In [2]: ls()

or from its shell:

pyos shell
# Or choose the database directly, e.g. one in memory to try things out
pyos shell --uri "litemongo://?engine=memory#scratch"

From here you can save() objects, use familiar linux commands (ls(), mv(), find(), etc.) and a whole lot more. Head over to the documentation to find out how.

About

A way to treat your python objects like files on disk

Resources

Stars

13 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages