From 126d8b335f488b46fbb84ad5116054a39f55c420 Mon Sep 17 00:00:00 2001 From: amin saied Date: Tue, 18 May 2021 11:30:40 -0700 Subject: [PATCH] Update environment to include version (#59) * Update environment.md * Update environment.md --- website/docs/cheatsheets/python/v1/environment.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/website/docs/cheatsheets/python/v1/environment.md b/website/docs/cheatsheets/python/v1/environment.md index fa1a775..f01dc2a 100644 --- a/website/docs/cheatsheets/python/v1/environment.md +++ b/website/docs/cheatsheets/python/v1/environment.md @@ -168,6 +168,20 @@ envs: Dict[str, Environment] = ws.environments This dictionary contains custom environments that have been registered to the workspace as well as a collection of _curated environments_ maintained by Azure ML. +#### Example. + +```python +# create / update, register environment +env = Environment.from_pip_requirements('my-env', 'requirements.txt') +env.register(ws) + +# use later +env = ws.environments['my-env'] + +# get a specific version +env = Environment.get(ws, 'my-env', version=6) +``` + ### Save / Load Environments Save an environment to a local directory: