A fresh way to interact with your python objects as though they were files on your filesystem.
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 andmvthe 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
rsyncwhat is worth keeping to a shared server.
See the documentation for examples of each.
pyOS needs Python 3.11 or later:
pip install pyosObjects 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"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.