Skip to content

Latest commit

 

History

History
139 lines (97 loc) · 3.82 KB

CONTRIBUTING.md

File metadata and controls

139 lines (97 loc) · 3.82 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.

Windows Specific Steps

  1. Open a windows command prompt.

  2. In the command prompt, 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

To start a local TabPy instance:

startup.cmd

To run the unit test suite:

python tests\runtests.py

Alternatevly you can run unit tests to collect code coverage data. First install pytest:

pip install pytest

And then run pytest either for server or tools test, or even combined:

pytest tabpy-server/server_tests/ --cov=tabpy-server/tabpy_server
pytest tabpy-tools/tools_tests/ --cov=tabpy-tools/tabpy_tools --cov-append

Linux and Mac Specific Steps

If you have downloaded Tabpy and would like to manually install Tabpy Server not using pip then follow the steps below to run TabPy in Python virtual environment.

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 markdonw-toc.

TabPy with Swagger

You can invoke TabPy Server API against 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

On github repo for merge request pycodestyle is used to check Python code against our style conventions.

You need to install pycodestyle locally:

pip install pycodestyle

And then run it for file 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

And 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 formated code to console.

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