- Environment Setup
- Prerequisites
- Cloning TabPy Repository
- Tests
- Code Coverage
- TabPy in Python Virtual Environment
- Documentation Updates
- TabPy with Swagger
- Code styling
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:
- Supported 64-bit Python version (see README for a list of compatible versions).
- git
- Node.js for npm packages - install from https://nodejs.org.
- NPM packages - install all with
npm install markdown-toc markdownlint
command.
-
Open your OS shell.
-
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
-
Install all dependencies:
python -m pip install --upgrade pip pip install -r requirements.txt pip install -r requirements_dev.txt
To run the whole test suite execute the following command:
pytest
Unit tests suite can be executed with the following command:
pytest tests/unit
Integration tests can be executed with the next command:
pytest tests/integration
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
It is possible (and recommended) to run TabPy in a virtual environment. More details are on TabPy in Python virtual environment page.
For any process, scripts or API changes documentation needs to be updated accordingly. Please use markdown validation tools like web-based markdownlint or npm markdownlint-cli.
TOC for markdown file is built with markdown-toc:
markdown-toc -i docs/server-startup.md
To check markdown style for all the documentation use markdownlint
:
markdownlint .
These checks will run as part of the build if you submit a pull request.
You can invoke the TabPy Server API against a running TabPy instance with Swagger.
- Make CORS related changes in TabPy configuration file: update
tabpy/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 a local instance of TabPy server following TabPy Server Startup Guide.
- Run a 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 does not run on
localhost:9004
updatehost
value inTabPy.yml
accordingly.
flake8
is used to check Python code against our style conventions:
flake8 .