Warning
On windows, please use Ubuntu 20.04 with Windows Subsystem for Linux (WSL) to run. (Windows native is not tested yet)
- Prepare GitHub
- Clone RACOON-AI
- Setup Protobuf compiler
- Prepare Python environment
- Enable pre-commit hooks
- Build RACOON-AI
- OpenSSH client - For SSH connection
- GitHub command line tool - For working with GitHub (
gh
command) - anyenv - For managing version management tools
- pyenv - For managing python versions
- Poetry - For managing python dependencies
- Protoc - For compiling
.proto
files
We know Python version 3.10.X is still in development, isntalling with version management tool is recommended.
Here, we use pyenv
with anyenv
since its simplicity.
Note
This step is for those who want to costomize SSH key.
(GitHub CLI can generateid_ed25519
automatically)
From the security perspective, we recommend to use SSH key. Please refer to GitHub documentation
ssh-keygen -t ed25519 -C "<Your GitHub Email>"
- Create a GitHub account
Please register from this page: GitHub
- Install GitHub Command Line Tool
Please follow the official installation.
For ubuntu (Linux) users: Instructions for Linux
- Login with your GitHub account
Note
Select theSSH
option, and upload your SSH key
gh auth login
- Write configuration file
Please add following to your ~/.ssh/config
file.
Host *
AddKeysToAgent yes
# Only for MacOS (10.12.2 or later)
UseKeychain yes
# Recommended for the security reason
PasswordAuthentication no
# For GitHub
Host github.com
HostName github.com
IdentityFile ~/.ssh/<Your Secret Key File>
- Connect to GitHub
ssh -T git@github.com
Note
If you get an error about the connection to the ssh-agent, please retry after the following command
eval $(ssh-agent -s)
Clone to your local workspace.
gh repo clone Rione/ssl-RACOON-AI ~/ws/ssl-racoon-ai && cd $_
See also the Official Guide
- Install build requirements (if not installed)
- autoconf
- automake
- libtool (GNU libtool)
- make
- g++
- unzip
On MacOS native, install with Homebrew is recommended:
brew install autoconf automake libtool
If you use ubuntu (Debian):
sudo apt update && sudo apt install -y build-essential automake autoconf libtool unzip
- Clone the protobuf repository
gh repo clone protocolbuffers/protobuf ${HOME}/.local/opt/protobuf -- -b v3.19.1 --depth=1 --recurse-submodules --shallow-submodules
- Cd into the repo & run setup script
cd ${HOME}/.local/opt/protobuf && ./autogen.sh
- Configure to your environment
./configure --prefix=${HOME}/.local/opt/protobuf
- Build the code
Note
You can speed up by using make with-j
option.
make
- Test the compilation
make check
- Install
make install
- Link protoc to your bin directory
mkdir -p ${HOME}/.local/bin && ln -s ${HOME}/.local/opt/protobuf/bin/* ${HOME}/.local/bin/
- Test the installation
protoc --version
You would get libprotoc 3.19.1
.
Note
If you get an error about the command not found, please add following to your~/.zshrc
or~/.bashrc
file, and retry after source it.
Example (bash):
echo 'export PATH="${HOME}/.local/bin:${PATH}"' >> ~/.bashrc && . ~/.bashrc
- Add to your
$PKG_CONFIG_PATH
Please add the following to your ~/.zshrc
or ~/.bashrc
, and source it.
Example (bash):
echo 'export PKG_CONFIG_PATH="${HOME}/.local/opt/protobuf/lib/pkgconfig:${PKG_CONFIG_PATH}"' >> ~/.bashrc && . ~/.bashrc
Since the ease of installation, we recommend using with anyenv.
anyenv
is a tool to manage multiple version management tools, include pyenv
.
The tool is provided in Homebrew (brew install anyenv
).
If you prefer to use Homebrew, please skip the following steps.
- Clone
anyenv
from GitHub
gh repo clone anyenv/anyenv ~/.local/opt/anyenv
- Set environment variable
Add following to your ~/.zshrc
or ~/.bashrc
file.
export ANYENV_ROOT="${HOME}/.local/opt/anyenv"
if [ -d $ANYENV_ROOT ]; then
export PATH="${ANYENV_ROOT}/bin:${PATH}"
eval "$(anyenv init -)"
test -e "${PYENV_ROOT}/plugins/pyenv-virtualenv" && eval "$(pyenv virtualenv-init -)"
fi
- Install manifests
anyenv install --init https://github.com/anyenv/anyenv-install.git
Test the installation:
anyenv install -l
- Install Python build dependencies
See also Suggested build environment
On MacOS native (with Homebrew):
brew install openssl@1.1 readline
On Ubuntu:
sudo apt update && sudo apt install -y libbz2-dev libssl-dev libreadline-dev libsqlite3-dev llvm tk-dev libxmlsec1-dev
- Install
pyenv
anyenv install pyenv
Note
Restart terminal is recommended after installingpyenv
- Search for the available versions
pyenv install -l | grep 3.10
- Install Python
pyenv install <Your Selected Version> && pyenv rehash
- Install build dependencies
On Ubuntu:
sudo apt update && sudo apt install -y python3-dev python3-pip python3-venv
- Checkout to Python 3.10.x
pyenv shell <Your Selected Version>
- Install Poetry
curl -sSL https://install.python-poetry.org | python3.10 -
Follow the installation guide, and add to your $PATH
- Check if Poetry is installed
poetry --version
You would get Poetry version X.X.X
- Enable Tab completion (optional)
Please follow the following guide.
NOTE: You can check your shell by echo $SHELL
or echo $0
(current shell)
Guide: https://python-poetry.org/docs/master#enable-tab-completion-for-bash-fish-or-zsh
- (Optional) Activate virtual environment
If you are not in the python3.10 environment, please follow the following
pyenv shell <Your Selected Version>
- Install dependencies
poetry install
NOTE: If you need extra dependencies, please specify with -E
option.
Ex) poetry install -E pygame
cd $(git rev-parse --show-toplevel) && git config commit.template .gitmessage.txt
Note
Afterpoetry install
, you need to checkout to the .venv withpyenv shell --unset && poetry shell
.
pre-commit install
Used hooks:
- check-yaml
- end-of-file-fixer - Corrected line breaks to be on one line at the end of the file
- mixed-line-ending - Unify line feed code to
LF
- no-commit-to-branch - Prohibit committing to branches
master
,main
anddev
- isort - Ordering import
- flake8 - Python code style checker
- pylint - Python code linter
- mypy - Python type checker
- black - Python code formatter (See also: Supported hooks - pre-commit)
Compile proto files, build python package to dist
directory and execute.
make