Frequently Asked Questions

Python Sphinx Autodoc Is Not Rendering on readthedocs

The project’s dependencies are not specified on RTD, but instead have installed the dependencies locally. Visit the project’s Builds, click a build, and click “view raw”:

WARNING: autodoc: failed to import module 'rnn' from module 'screwdriver_cd_python_sdk'; the following exception was raised:
No module named 'matplotlib'

To remedy the situation, we must specify that the project’s dependencies to be installed. See Specifying Dependencies.

Generate Sphinx Documentation Locally

This site is auto-generated using Sphinx with the following command in venv:

cd /path/to/screwdriver-cd-python-sdk/
python3 -m venv venv
source venv/bin/activate
pip3 install .
pip3 install -r docs/source/requirements.txt
sphinx-build -a -b html docs/source/ /path/to/html/output/dir
deactivate

Note

The command above works for Linux/UNIX systems. Some commands will differ on Windows OS

Install SDK from Source Locally

We recommend creating a virtualenv for your application and activate it

Navigate to the screwdriver-cd-python-sdk root directory and run:

pip3 install -e .

For more general information, please refer to the Hitchhiker’s Guide to Python: “Structuring Your Project”.

“module ‘collections’ has no attribute ‘Callable’ Error When Running nosetests

First, uninstall nose with the following command:

pip3 uninstall -y nose

Second, reinstall nose but with --nobinaries flag:

pip3 install -U nose --no-binary :all:

Why does this work? At the time of this writing the binary generated by nose was likely generated with a version of Python 3.4 or older. This command forces to rebuild from source.

No module named ‘pytest’ while Running Test Directly in PyCharm

“Right-click” run a test_**.py file results in:

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py", line 5, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

The solution is going to ‘Settings -> Tools -> Python Integrated Tools’ and scroll down to where it says pytest not found and there is a FIX button. Clicking on it and apply the settings shall resolve the problem

PyCharm Doesn’t Detect Newly Installed screwdriver-cd-python-sdk

Simply close your project and open it with PyCharm again. The re-indexing should make it work