Developer Setup¶
The purpose of this document is to get all developers on the same page for development when beginning so all dependencies install properly in a virtual environment and all IDE interpreters run off the same environment.
Windows users: The files in this repo use unix-style line wraps. Ensure you have git configured such that it checks out/commits with newlines as-is:
git config core.autocrlf
Prerequisites¶
Python 3.7 and pip are installed: https://www.python.org/downloads/
Docker and docker-compose are installed: https://docs.docker.com/docker-for-windows/install/
Operating System Setups¶
- Windows
- Mac/OSX
- Linux
Windows¶
- Docker:
Ensure all required drives are shared with Docker
- Right click Docker on Task Tray
- Select “Settings”
- Select “Shared Drives”
- Check “D” (as well as any others that show up)
- Click “Apply”
- Other Tools:
- Git-bash must be installed: https://git-scm.com/downloads
- Git-bash will conflict with the 64-bit version of Cyqwin. Windows users must uninstall if present and instead install the 32-bit version of Cygwin: https://cygwin.com/install.html
- Run the Cygwin installer again and install the 64-bit versions of libtool, automake, and pkgconfig.
- Run
echo 'export PATH="$PATH:/c/cygwin/bin"' > ~/.bashrc
in git-bash to access those tools from git-bash. - Add
C:\cygwin\bin
to your Windows PATH variable as well. - Add
COMPOSE_CONVERT_WINDOWS_PATHS=1
to .env to allow docker-compose to run as per: https://github.com/docker/for-win/issues/1829 - Run
echo 'export PATH="$PATH:/c/Python37"' > ~/.bashrc
in git-bash to run Python3.7 and pip3 from git-bash. - Restart git-bash to allow the changes to take effect.
- Set-up your virtual env:
Navigate to the top level of the project (sawtooth-next-directory)
Run the following:
python -m venv ENV
To Activate your virtual environment, run:
source ./ENV/scripts/activate
You should now see ‘(ENV)’ at the beginning of your terminal command line. This indicates you are in your ENV. To Deactivate, run the following:
deactivate
- Tar File Dependencies:
- Navigate to the “windows-dependencies” folder from the home folder.
- Untar “secp256k1-0.13.2-py3.7.egg-info.tar” and “secp256k1.tar”
- Move both untarred folders into “sawtooth-next-directoryENVLibsite-packages”
- Setting up Dependencies:
Prior to setting up dependencies you should activate your virtual env and have automake installed. Automake is to help with the installation of secp256k1 as it will error without during installation.
1. Follow this solution to get a C++ support for a couple of dependencies. 2. Run the following:
pip3 install -r requirements.txt
You should now have all dependencies installed within your virtualenv. You can tell by running:
pip freeze -l
This will list all of your installed dependencies. You can then deactivate your env, run the same command, and see the difference.
Mac/OSX¶
- Prerequisites:
- Ensure brew is up to date Ensure XCode is installed and up to date
- Getting Tools:
Run in home directory:
brew install automake
brew install libtool
brew install pkg-config
python3.7 -m venv ENV
Activate virtual env
source ENV/bin/activate
You should now see ‘(ENV)’ at the beginning of your terminal command line. This indicates you are in your ENV. To Deactivate, run the following:
deactivate
Run the following:
pip3 install -r requirements.txt
If you receive errors with a permission denied error with directory creation run with sudo:
sudo pip install -r requirements.txt
You should now have all dependencies installed within your virtualenv. You can tell by running
pip freeze -l
This will list all of your installed dependencies. You can then deactivate your env, run the same command, and see the difference.
Linux¶
- Getting Tools:
Run in home directory:
apt-get install automake
apt-get install libtool
apt-get install pkg-config
python3.7 -m venv ENV
Activate virtual env
source ENV/bin/activate
You should now see ‘(ENV)’ at the beginning of your terminal command line. This indicates you are in your ENV. To Deactivate, run the following:
deactivate
Run the following:
pip3 install -r requirements.txt
If you receive errors with a permission denied error with directory creation run with sudo:
sudo pip install -r requirements.txt
You should now have all dependencies installed within your virtualenv. You can tell by running
pip freeze -l
This will list all of your installed dependencies. You can then deactivate your env, run the same command, and see the difference.
IDE Interpreter setup¶
This will of course change between each IDE for the example process I will be using PyCharm. You need to set your Interpreter path to point at the python in the ENV folder in the top level directory. If you are using PyCharm the following steps will work for you; if not please adapt to your IDE. Go to http://pylint.pycqa.org/en/latest/user_guide/ide-integration.html#pylint-in-pycharm for easy integration with different interpreters.
- Select Preferences > Project: saw-tooth-next-directory > Project Interpreter
- Click the ‘gear’ image in the top corner and click ‘Add..’
- Select ‘Existing Environment’ and in ‘Interpreter:’ from the drop down select the path that leads to your ‘ENV’. This will automatically be detected and be in the dropdown.
- Select ‘OK’
- You will see your new interpreter with all the dependencies listed.
IDE pylint setup¶
Once again this will be using PyCharm as an example. This is to unite all pep8 pylint errors under the same standards across IDEs. Our common standards and what to ignore and pass is defined in setup.cfg. That means that when running pylint you need to add the argument ‘–rcfile=setup.cfg’. Lets set this up now.
- In PyCharm go to Preferences > Plugins and search for Pylint
- Click on the plugin named Pylint, select Download and Install and click on restart PyCharm when prompted (You may have to click ok afterward and leave before it will restart)
- Select Preferences > Pylint
- For path to executable put the path to you virtual env’s pylint (i.e. ENV/bin/pylint)
- For Arguments put –rcfile=setup.cfg
You are now done. If you want it easily available for selection under External tools go to http://pylint.pycqa.org/en/latest/user_guide/ide-integration.html#pylint-in-pycharm and follow the section ‘Using External Tools’
Client Setup¶
1. Run the following:
# Install Yarn and Gulp globally npm install -g yarn gulp2. Install NPM packages:
# Install NPM packages and create yarn.lock cd client && yarn3. Build Semantic UI (https://react.semantic-ui.com/usage/):
# Build Semantic UI yarn build:semantic
- Client Development
- # Watch for changes to Semantic source yarn watch:semantic