Skip to content

Maintainers Build Test and Distribute

Sumio Kiyooka edited this page Apr 16, 2021 · 3 revisions

Build

You should be using virtualenv, virtrualenvwrapper to make things easy on yourself.

Ref: Packaging Python Projects Tutorial

Build the blackduck packages

To build both the source distribution package and the wheel package:

pip3 install -r requirements.txt
python3 setup.py sdist bdist_wheel

Test

Using pytest

git clone https://github.com/blackducksoftware/hub-rest-api-python.git
cd hub-rest-api-python
# optional but advisable: create/use virtualenv
# you should have 3.x+, e.g. Python 3.7.0

pip3 install -r requirements.txt
pip3 install .
cd test
pytest

Distribute the package

Requires you have an account on either/both PyPi and Test PyPi AND you must be a package maintainer.

Send a request to gsnyder@synopsys.com or gsnyder2007@gmail.com if you want to be listed as a package maintainer.

To PyPI

Upload to PyPI:

twine upload dist/*

Then try installing it from PyPI

pip3 install blackduck

To Test PyPI

Upload to Test PyPI:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Then try installing it from Test PyPI

pip install --index-url https://test.pypi.org/simple/ blackduck

Install package locally

Do this when testing a new version.

git clone https://github.com/blackducksoftware/hub-rest-api-python.git
cd hub-rest-api-python
pip3 install -r requirements.txt
pip3 install .

To uninstall:

pip3 uninstall blackduck
Clone this wiki locally