@@ -11,32 +11,32 @@ It is intended for BB2 team members or others performing SDK development work.
1111- Install Python for your environment and verify the version with:
1212
1313 ```
14- $ python --version
14+ python --version
1515 # or
16- $ python3 --version
16+ python3 --version
1717 ```
1818
1919 This should output a 3.x version number.
2020
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
21+ - You should use a virtual environment.
3222
33- To install the package file do the following:
23+ - To create a virtual environment and activate it, use the following commands :
3424
35- ```
36- # From repository root directory:
37- $ pip install <package file name>
38- ```
25+ ```
26+ python3 -m venv bb2_venv
27+ source bb2_venv/bin/activate
28+ # Perform install and commands after sourcing the venv.
29+ ```
3930
31+ - Install current versions of pip, setuptools, wheel and twine.
32+
33+ ```
34+ # Update PIP
35+ pip install --upgrade pip
36+
37+ # Update tools
38+ python3 -m pip install --upgrade pip setuptools wheel twine
39+ ```
4040
4141## Developing the Blue Button 2.0 SDK (for BB2 team SDK developers)
4242
@@ -47,7 +47,7 @@ To install with the tools you need to develop and run tests do the following:
4747From the repository base directory:
4848
4949```
50- $ pip install -e .[dev]
50+ pip install -e .[ dev]
5151```
5252
5353### Running tests
@@ -57,93 +57,246 @@ To run the tests, use the following commands:
5757From the package base directory:
5858
5959```
60- $ cd cms_bluebutton
60+ cd cms_bluebutton
6161
62- $ # To run all tests:
63- $ pytest
62+ # To run all tests:
63+ pytest
6464
65- $ # To run a specific test and show console debugging output:
66- $ pytest tests/test_fhir_request.py -s
65+ # To run a specific test and show console debugging output:
66+ pytest tests/test_fhir_request.py -s
6767```
6868
6969To run the tests with coverage, use the following commands:
7070
7171From the package base directory:
7272
7373```
74- $ coverage run -m pytest
74+ coverage run -m pytest
7575
7676# Check report
77- $ coverage report -m
77+ coverage report -m
7878```
7979
8080## Packaging and Publishing
8181
82+ ### Build Package
8283
83- ### Create or Update Manifest
84+ To build the cms_bluebutton package do the following:
8485
85- If check-manifest is not yet installed run the following :
86+ - Build a wheel distribution package (.whl) :
8687
87- ```
88- $ pip install check-manifest # If not already installed.
89- ```
88+ ```
89+ # From repository root directory:
90+ rm -rf build/
91+ python setup.py bdist_wheel
92+ ```
9093
91- If MANIFEST.in does not yet exist, run the following to create it:
94+ The resulting distribution files with be created in the `dist/` directory.
9295
93- ```
94- $ check-manifest --create
95- ```
96+ - Review the files included with the following. Update the filename for the target version.
97+
98+ ```
99+ unzip -l dist/cms_bluebutton_sdk-0.1.0-py3-none-any.whl
100+ ```
101+
102+
103+ ### Install from a Package File
96104
97- To help with updating MANIFEST.in run the following to get information :
105+ The package file can be installed via the following command :
98106
107+ ```bash
108+ pip install dist/cms_bluebutton_sdk-0.1.0-py3-none-any.whl # wheel
99109```
100- $ check-manifest
101- # This creates the following directory: cms_bluebutton.egg-info
110+
111+
112+ ### Un-install from a Package File
113+
114+ The package can be un-installed via the following command:
115+
116+ ``` bash
117+ pip uninstall cms_bluebutton_sdk
102118```
103119
104- ### Build Packages
105120
106- To build the cms_bluebutton packages do the following:
121+ ### Publish Testing using the TestPyPI registry instance
107122
108- - Build a wheel distribution package (.whl):
123+ Before publishing to the main PyPI registry, testing can be perfomed using the TestPyPI site.
124+
125+ See the following for more details: https://packaging.python.org/en/latest/guides/using-testpypi/
126+
127+ #### Prerequisite tasks:
128+
129+ - Create an OWNER type of account. This is the account that will own the ` cms-bluebutton-sdk ` project.
130+
131+ - Perform the initial release upload of the project using this account. See upload instruction below.
132+
133+ - BB2 developers who will be uploading releases need to create their own accounts.
134+
135+ - The OWNER account can setup the developers as MAINTAINERS on the project.
136+
137+ - Maintainers will have the following role permissions for the project:
138+
139+ Has permissions to Upload releases for a package. Can upload releases. Cannot invite collaborators. Cannot delete files, releases, or the project.
140+
141+
142+ #### Upload project to TestPyPI
143+
144+ - Setup your configuration by adding the following lines to your $HOME/.pypirc file:
109145
110146 ```
111- # From repository root directory:
112- $ rm -rf build/
113- $ python setup.py bdist_wheel
147+ [testpypi]
148+ username = <your TestPyPI username>
114149 ```
115150
116- - Build a distribution package (.tar.gz):
151+ - Source the virtual environment from previous instruction.
117152
153+ ``` bash
154+ source bb2_venv/bin/activate
118155 ```
119- # From repository root directory:
120- $ rm -rf build/
121- $ python setup.py sdist
156+
157+ - Upload to the TestPyPI registry with the following command:
158+
159+ ``` bash
160+ twine upload --repository testpypi dist/cms_bluebutton_sdk-0.1.0-py3-none-any.whl
122161 ```
123162
124- - Build a source package:
163+ Enter the account password.
164+
165+ - Confirm the project was uploaded via the following URL: https://test.pypi.org/project/cms-bluebutton-sdk
166+
125167
168+ #### Install test using TestPyPI
169+
170+ - Setup a temporary virtual environment to test the install.
171+
172+ ``` bash
173+ python3 -m venv /tmp/test_bb2_venv
174+ source /tmp/test_bb2_venv/bin/activate
175+ # Perform install and commands after sourcing the venv.
126176 ```
127- # From repository root directory:
128- $ rm -rf build/
129- $ python setup.py sdist
177+
178+ - Install ` cms-bluebutton-sdk ` from TestPyPI. Extras are installed from the main PyPI registry.
179+
180+ ``` bash
181+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ cms-bluebutton-sdk
130182 ```
131183
132- The resulting distribution files with be created in the ` dist/ ` directory .
184+ - Show the installed package .
133185
134- ### Install from a Package File
186+ ``` bash
187+ pip show cms-bluebutton-sdk
188+ ```
135189
136- Package files can be installed via the following commands:
190+ - Test imports with the following.
137191
138- ``` bash
139- pip install cms_bluebutton-0.1.0-py3-none-any.whl # wheel
140- ```
141- or
192+ ` ` ` bash
193+ cat << EOF >test_bb2_sdk.py
194+ from cms_bluebutton import BlueButton, AuthorizationToken
195+ EOF
196+ python test_bb2_sdk.py
197+ ` ` `
142198
143- ``` bash
144- pip install cms_bluebutton-0.1.0.tar.gz # bdist
145- ```
199+ - If successful, there will be no errors in the output.
200+
201+
202+ # ## Publish to the main PyPI registry
203+
204+ After testing, the package / release can be published to the main PyPI site.
205+
206+ See the following for more details: https://pypi.org/
207+
208+ # ### Prerequisite tasks:
209+
210+ - Create an OWNER type of account. This is the account that will own the ` cms-bluebutton-sdk` project.
211+
212+ - Perform the initial release upload of the project using this account. See upload instruction below.
213+
214+ - BB2 developers who will be uploading releases need to create their own accounts.
215+
216+ - The OWNER account can setup the developers as MAINTAINERS on the project.
217+
218+ - Maintainers will have the following role permissions for the project:
219+
220+ Has permissions to Upload releases for a package. Can upload releases. Cannot invite collaborators. Cannot delete files, releases, or the project.
221+
222+
223+ # ### Upload project to PyPI
224+
225+ - Setup your configuration by adding the following lines to your $HOME /.pypirc file:
226+
227+ ` ` `
228+ [pypi]
229+ username = <your PyPI username>
230+ ` ` `
231+
232+ - Source the virtual environment from previous instruction.
233+
234+ ` ` ` bash
235+ source bb2_venv/bin/activate
236+ ` ` `
237+
238+ - Upload to the PyPI registry with the following command. Update the filename for the target version.
239+
240+ ` ` ` bash
241+ twine upload dist/cms_bluebutton_sdk-0.1.0-py3-none-any.whl
242+ ` ` `
243+
244+ Enter the account password.
245+
246+ - Confirm the project was uploaded at the following URL: https://pypi.org/project/cms-bluebutton-sdk
247+
248+
249+ # ### Install test using PyPI
250+
251+ - Setup a temporary virtual environment to test the install.
252+
253+ ` ` ` bash
254+ python3 -m venv /tmp/test_bb2_venv
255+ source /tmp/test_bb2_venv/bin/activate
256+ # Perform install and commands after sourcing the venv.
257+ ` ` `
258+
259+ - Install ` cms-bluebutton-sdk` from TestPyPI. Extras are installed from the main PyPI registry.
260+
261+ ` ` ` bash
262+ pip install cms-bluebutton-sdk
263+ ` ` `
264+
265+ - Show the installed package.
266+
267+ ` ` ` bash
268+ pip show cms-bluebutton-sdk
269+ ` ` `
146270
147- ### Publishing
271+ - Test imports with the following.
272+
273+ ` ` ` bash
274+ cat <<EOF
275+ from cms_bluebutton import BlueButton, AuthorizationToken
276+ print("IMPORT TEST SUCCESSFUL!!!")
277+ EOF
278+ python test_bb2_sdk.py
279+ ` ` `
280+
281+ - If successful, there will be no errors and the following message will output:
282+
283+ IMPORT TEST SUCCESSFUL!!!
284+
285+ - Remove the test virtual environmnet to clean up.
286+
287+ ` ` ` bash
288+ rm -rf /tmp/test_bb2_venv/
289+ ` ` `
290+
291+ # ## Publishing NEW versions
292+
293+ New versions can be published using the previous build, TestPyPI and PyPI publishing instruction.
294+
295+ Before building and publishing a new version, the version number needs to be increased.
296+
297+ To do this, edit the following line in the ` setup.py` file with the desired release version:
298+
299+ ` ` `
300+ version="0.1.0",
301+ ` ` `
148302
149- TODO!
0 commit comments