Skip to content

Latest commit

 

History

History
162 lines (115 loc) · 4.57 KB

CONTRIBUTING.md

File metadata and controls

162 lines (115 loc) · 4.57 KB

TabPy Contributing Guide

Environment Setup

The purpose of this guide is to enable developers of Tabpy to install the project and run it locally.

Prerequisites

These are prerequisites for an environment required for a contributor to be able to work on TabPy changes:

  • Python 3.6.5:
    • To see which version of Python you have installed, run python --version.
  • git
  • TabPy repo:
    • Get the latest TabPy repository with git clone https://github.com/tableau/TabPy.git
    • Create a new branch for your changes.
    • When changes are ready push them on github and create merge request.

Cloning TabPy Repository

  1. Open your OS shell.

  2. Navigate to the folder in which you would like to save your local TabPy repository.

  3. In the command prompt, enter the following commands:

    git clone https://github.com/tableau/TabPy.git
    cd TabPy

Before making any code changes run environment setup script. For Windows run this command from the repository root folder:

utils\set_env.cmd

and for Linux or Mac the next command from the repository root folder:

source utils/set_env.sh

Unit Tests

TabPy has test suites for tabpy-server and tabpy-tools components. To run the unit tests use pytest which you may need to install first (see https://docs.pytest.org for details):

pytest tests/unit

Check pytest documentation for how to run individual tests or set of tests.

Integration Tests

Integration tests can be executed with the next command:

pytest tests/integration

Code Coverage

You can run unit tests to collect code coverage data. To do so run pytest either for server or tools test, or even combined:

pytest tests --cov=tabpy-server/tabpy_server --cov=tabpy-tools/tabpy_tools --cov-append

TabPy in Python Virtual Environment

It is possible (and recommended) to run TabPy in a virtual environment. More details are on TabPy in Python virtual environment page.

Documentation Updates

For any process, scripts or API changes documentation needs to be updated accordingly. Please use markdown validation tools like web-basedmarkdownlint or npm markdownlint-cli.

TOC for markdown file is built with markdown-toc:

markdown-toc -i docs/server-startup.md

These checks will run as part of the build if you submit a pull request.

TabPy with Swagger

You can invoke the TabPy Server API against a running TabPy instance with Swagger.

  • Make CORS related changes in TabPy configuration file: update tabpy-server\state.ini file in your local repository to have the next settings:
[Service Info]
Access-Control-Allow-Origin = *
Access-Control-Allow-Headers = Origin, X-Requested-with, Content-Type
Access-Control-Allow-Methods = GET, OPTIONS, POST

Code styling

pycodestyle is used to check Python code against our style conventions. You can run install it and run locally for files where modifications were made:

pip install pycodestyle

And then run it for files where modifications were made, e.g.:

pycodestyle tabpy-server/server_tests/test_pwd_file.py

For reported errors and warnings either fix them manually or auto-format files with autopep8.

To install autopep8 run the next command:

pip install autopep8

Then you can run the tool for a file. In the example below -i option tells autopep8 to update the file. Without the option it outputs formatted code to the console.

autopep8 -i tabpy-server/server_tests/test_pwd_file.py