From 16f4cc5b78be2f9cfcbd80d41fccb4ce774e0134 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Tue, 13 Feb 2024 10:20:20 -0500 Subject: [PATCH] SM-1098: Update Python Wrapper README Instructions (#592) ## Type of change ``` - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [x] Other ``` ## Objective Update the Python Wrapper README, now that we are using [maturin](https://pypi.org/project/maturin). --- languages/python/.gitignore | 1 + languages/python/README.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/languages/python/.gitignore b/languages/python/.gitignore index baa13a078..495f6296b 100644 --- a/languages/python/.gitignore +++ b/languages/python/.gitignore @@ -1,3 +1,4 @@ *.egg-info bitwarden_py*.so __pycache__ +.venv diff --git a/languages/python/README.md b/languages/python/README.md index f41fd8a12..e5fe5ae70 100644 --- a/languages/python/README.md +++ b/languages/python/README.md @@ -33,3 +33,26 @@ Set the `ORGANIZATION_ID` and `ACCESS_TOKEN` environment variables to your organ ```bash python3 ./example.py ``` + +# Using Virtual Environments + +If you would like to build & run the script within a virtual environment you can do the following. + +## Build + +```bash +npm run schemas # generate schemas.py + +cd languages/python/ +python3 -m venv .venv +maturin develop +``` + +## Run + +```bash +source .venv/bin/activate +python3 ./example.py + +deactivate # run this to close the virtual session +```