|
| 1 | +# Blue Button 2.0 SDK Development Documentation |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This README contains information related to developing the SDK. |
| 6 | + |
| 7 | +It is intended for BB2 team members or others performing SDK development work. |
| 8 | + |
| 9 | +## Install Prerequisites: |
| 10 | + |
| 11 | +- Install Python for your environment and verify the version with: |
| 12 | + |
| 13 | + ``` |
| 14 | + $ python --version |
| 15 | + # or |
| 16 | + $ python3 --version |
| 17 | + ``` |
| 18 | + |
| 19 | + This should output a 3.x version number. |
| 20 | + |
| 21 | +- Install up to date versions of pip, setuptools and wheel: |
| 22 | + ``` |
| 23 | + $ python3 -m pip install --upgrade pip setuptools wheel |
| 24 | + ``` |
| 25 | +- Optionally you can use a virtual environment for the previous insall step via the following: |
| 26 | + ``` |
| 27 | + $ python -m venv bb2_env |
| 28 | + $ source bb2_env/bin/activate |
| 29 | + # Perform install and commands after sourcing the venv. |
| 30 | + ``` |
| 31 | +## Installation |
| 32 | + |
| 33 | +To install the package file do the following: |
| 34 | + |
| 35 | +``` |
| 36 | +# From repository root directory: |
| 37 | +$ pip install <package file name> |
| 38 | +``` |
| 39 | + |
| 40 | + |
| 41 | +## Developing the Blue Button 2.0 SDK (for BB2 team SDK developers) |
| 42 | + |
| 43 | +### Install Development |
| 44 | + |
| 45 | +To install with the tools you need to develop and run tests do the following: |
| 46 | + |
| 47 | +From the repository base directory: |
| 48 | + |
| 49 | +``` |
| 50 | +$ pip install -e .[dev] |
| 51 | +``` |
| 52 | + |
| 53 | +### Running tests |
| 54 | + |
| 55 | +To run the tests, use the following commands: |
| 56 | + |
| 57 | +From the package base directory: |
| 58 | + |
| 59 | +``` |
| 60 | +$ cd cms_bluebutton |
| 61 | +
|
| 62 | +$ # To run all tests: |
| 63 | +$ pytest |
| 64 | +
|
| 65 | +$ # To run a specific test and show console debugging output: |
| 66 | +$ pytest tests/test_fhir_request.py -s |
| 67 | +``` |
| 68 | + |
| 69 | +To run the tests with coverage, use the following commands: |
| 70 | + |
| 71 | +From the package base directory: |
| 72 | + |
| 73 | +``` |
| 74 | +$ coverage run -m pytest |
| 75 | +
|
| 76 | +# Check report |
| 77 | +$ coverage report -m |
| 78 | +``` |
| 79 | + |
| 80 | +## Packaging and Publishing |
| 81 | + |
| 82 | + |
| 83 | +### Create or Update Manifest |
| 84 | + |
| 85 | +If check-manifest is not yet installed run the following: |
| 86 | + |
| 87 | +``` |
| 88 | +$ pip install check-manifest # If not already installed. |
| 89 | +``` |
| 90 | + |
| 91 | +If MANIFEST.in does not yet exist, run the following to create it: |
| 92 | + |
| 93 | +``` |
| 94 | +$ check-manifest --create |
| 95 | +``` |
| 96 | + |
| 97 | +To help with updating MANIFEST.in run the following to get information: |
| 98 | + |
| 99 | +``` |
| 100 | +$ check-manifest |
| 101 | +# This creates the following directory: cms_bluebutton.egg-info |
| 102 | +``` |
| 103 | + |
| 104 | +### Build Packages |
| 105 | + |
| 106 | +To build the cms_bluebutton packages do the following: |
| 107 | + |
| 108 | +- Build a wheel distribution package (.whl): |
| 109 | + |
| 110 | + ``` |
| 111 | + # From repository root directory: |
| 112 | + $ rm -rf build/ |
| 113 | + $ python setup.py bdist_wheel |
| 114 | + ``` |
| 115 | + |
| 116 | +- Build a distribution package (.tar.gz): |
| 117 | + |
| 118 | + ``` |
| 119 | + # From repository root directory: |
| 120 | + $ rm -rf build/ |
| 121 | + $ python setup.py sdist |
| 122 | + ``` |
| 123 | + |
| 124 | +- Build a source package: |
| 125 | + |
| 126 | + ``` |
| 127 | + # From repository root directory: |
| 128 | + $ rm -rf build/ |
| 129 | + $ python setup.py sdist |
| 130 | + ``` |
| 131 | + |
| 132 | +The resulting distribution files with be created in the `dist/` directory. |
| 133 | + |
| 134 | +### Install from a Package File |
| 135 | + |
| 136 | +Package files can be installed via the following commands: |
| 137 | + |
| 138 | +```bash |
| 139 | +pip install cms_bluebutton-0.1.0-py3-none-any.whl # wheel |
| 140 | +``` |
| 141 | +or |
| 142 | + |
| 143 | +```bash |
| 144 | +pip install cms_bluebutton-0.1.0.tar.gz # bdist |
| 145 | +``` |
| 146 | + |
| 147 | +### Publishing |
| 148 | + |
| 149 | +TODO! |
0 commit comments