This guide walks you through a first time Intellij setup for Baserow for developers. It will ensure you can run and debug all tests and also enable all the relevant linters and automatic style fixers to make your life as easy as possible.
This guide assumes you have a basic understanding of git, python, virtualenvs, postgres and command line tools.
- First checkout a fresh copy of Baserow:
git clone [email protected]:bramw/baserow.git
cd baserow
./config/intellij/apply_standard_baserow_intellij_config.sh
- Type
Y
and hit enter to apply the standard Baserow config
- Type
- Open Intellij and on the "Welcome to IntelliJ IDEA" screen click the "Open" button and open the baserow folder you cloned above.
- Make sure you have installed / enabled the Python IntelliJ plugin.
- Now we will create python virtualenv and configure IntelliJ to use it to run tests
and linters:
- Choose a location for your virtualenv, it is recommended to store it separately from the baserow source-code folder so IntelliJ does not search nor index it.
- Create the virtualenv:
python3 -m venv venv
orvirtualenv -p python venv
- Activate the virtualenv:
source venv/bin/activate
(will differ depending on your shell) - Run
which pip
and ensure the output of this command is now pointing into the bin in your new virtualenv - Change to the Baserow source directory:
cd path/to/your/baserow
- Install all the Baserow python requirements into your virtualenv:
pip install -r backend/requirements/dev.txt -r backend/requirements/base.txt
- Now back in Intellij, press F4 or right-click on the top level baserow folder and
select
module settings
:- Make sure the
backend
module SDK is set to the python virtualenv you just made. - There will most likely be an existing
Python 3.8 (baserow)
virtualenv SDK which is red. Delete this first. - Then you will most likely need to add it as a new SDK by navigating to
- F4 → SDK
- click +
- Add New Python SDK
- Existing Interpreter
- Find and select your virtualenvs
bin/python
executable - call this new SDK
Python 3.8 (baserow)
so you don't make an accidental thebackend.iml
file:
- Make sure the
- Install and get a postgresql database running locally:
- https://www.postgresql.org/docs/11/tutorial-install.html
- Change the default postgres port otherwise it will clash when running with Baserow (the default IntelliJ config in the repo assumes your testing db is running on 5430)
- Create a baserow user called
baserow
with the passwordbaserow
and give them permission to create databases-
https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e
CREATE USER baserow WITH ENCRYPTED PASSWORD 'baserow'; ALTER USER baserow CREATEDB;
-
- You might also have to
pip install psycopg2-binary
orsudo apt install postgresql-devel
- Now you should be able to run the backend python tests, try
run
backend/tests/baserow/core/test_core_models.py
for instance. - Now lets set up your frontend dev by changing directory to
baserow/web-frontend
- Now run
yarn install
(if you do not have yarn available check out and install a node version manager like nvm , baserow currently uses node 16) - Select "Trust Project" if you see an IntelliJ popup after running yarn install
- Open your settings, search for and open the
Node.js and NPM
category and ensure the Node interpreter is pointing to the desired node executable - Confirm you can run a web-frontend unit test from intellij
- Open settings and search for eslint, make sure you have switched
to
Manual ESLint configuration
, have set theESlint package
to toeslint
sub folder in thenode_modules
created by the previousyarn install
(baserow/web-frontend/node_modules/eslint
)
- https://plugins.jetbrains.com/plugin/14321-blackconnect
- Auto runs black over changed files. Setup a blackd daemon that runs on startup for lowest friction.
- Database Navigator
- IntellijVue
- Key Promoter X
- Vue.js