- Environment Setup
- Prerequisites
- Windows Specific Steps
- Mac Specific Steps
- Documentation Updates
- Versioning
- TabPy with Swagger
The purpose of this guide is to enable developers of Tabpy to install the project and run it locally.
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
.
- To see which version of Python you have installed, run
- 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.
- Get the latest TabPy repository with
-
Open a windows command prompt.
-
In the command prompt, navigate to the folder in which you would like to save your local TabPy repository.
-
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
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.
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.
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
- Start local instance of TabPy server following TabPy Server Startup Guide.
- Run local copy of Swagger editor with steps provided at https://github.com/swagger-api/swagger-editor.
- Open
misc/TabPy.yml
in Swagger editor. - In case your TabPy server runs not on
localhost:9004
updatehost
value inTabPy.yml
accordingly.
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