-
Notifications
You must be signed in to change notification settings - Fork 14
Local Development
You will need Python 3.9 or higher as well as the pip python package manager(or any python package manager).
Each of our containers has instructions on running locally in their description.md
.
We use virtual environments for development, to keep the various requirements isolated to the container they're imported for. You can use any virtual environment manager you like, but a number of team members use pyenv-virtualenv. Follow their installation instructions first. One of the nice features of virtualenv
is that you can set a different virtual environment per directory (i.e. fhir-converter/
, validation/
, etc), and when you leave that directory the virtualenv automatically deactivates.
cd containers/$service
pyenv virtualenv $virtual-environment-name
pyenv local $virtual-environment-name
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload
cd containers
pyenv virtualenvs
#lists virtual environments
pyenv deactivate $virtual-environment-name
pyenv virtualenv-delete $virtual-environment-name
You might also need to manually delete the .python-version
file in your container directory.
There isn't a way to "run" the SDK aside from unit tests. See Testing the SDK Locally.
The team uses Black and Flake8 for Python formatting.
These formatters run as a PR check in Github, but for your convenience you can run them as a pre-commit hook.
To set up the pre-commit hook (only needs to be run once, in the repo):
pip install pre-commit
pre-commit install
Our pre-commit-config will now run each time you attempt a git commit
. If there are failures, you'll need to address these and re-commit.
To bypass the commit hook, run with --no-verify
: git commit -am "some very important change" --no-verify
For more information, see the pre-commit docs.