agentos-project / agentos

The Python Component System (PCS) is an API and CLI for building, running, and sharing Python code. AgentOS is a set of libraries built on top of PCS that make it easy to build, run, and share agents that use Reinforcement Learning.
https://agentos.org
Apache License 2.0
13 stars 4 forks source link

Demo of versioned dependency install #424

Open nickjalbert opened 2 years ago

nickjalbert commented 2 years ago

Draft PR to show a little demo I've put together per our "rapid prototype" discussion on discord (in case you have a few minutes during baby care).

The demo file contains imports as follows:

import infer
import arrow  # ==1.1.1
import numpy  # ==1.22.4
import regex

If you run demo.py on a clean environment, the import of the infer package will automatically install the specified versions of arrow and numpy (note these are not the default latest versions) and the latest version of regex.

Here's an example running through the demo script:

cd documentation/demos/dependency_inference/
virtualenv -p /usr/bin/python3.9 demo_env
source demo_env/bin/activate
python demo.py  # Installs missing packages numpy and arrow
pip install numpy -U  # Installs incorrect version of numpy into the virtualenv
python demo.py  # re-installs the correct version on numpy

Some things I've been thinking about as I've been playing with this: