3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

shoestring をソースから動かしてみようぜ

Last updated at Posted at 2025-05-28

よっしゃ!今回は Symbol の shoestring をソースからガッツリ動かす方法を紹介していくぜ!
難しそうに見えても、手順通りにやれば余裕だ。さっそく始めてみよう


1. pyenv をインストールするぜ

Python のバージョン管理は pyenv が超便利。
もし他の仮想環境ツール使ってるなら、この手順はスキップしても OK!

まずは必要なパッケージをインストールだ

sudo apt install -y make build-essential libssl-dev zlib1g-dev \
    libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
    libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
    libffi-dev liblzma-dev

pyenv 本体をインストールするぞ

curl https://pyenv.run | bash

シェルの設定ファイルに追記しておこう

echo '#pyenv' >> ~/.bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc

シェルを再起動して反映だ

exec $SHELL -l

2. shoestring をクローンしようぜ

ホームディレクトリにクローンする例だけど、好きな場所で OK!

git clone https://github.com/symbol/product.git
cd product/tools/shoestring
git submodule update --init --recursive

3. Python 仮想環境を作るぞ

pyenv install 3.12.10
pyenv virtualenv 3.12.10 shoestring-dev
pyenv local shoestring-dev

4. 依存パッケージをインストールだ

scripts/ci/setup_lint.sh
pip install symbol-lightapi
pip install symbol-sdk-python

5. 言語ファイルを作成しよう

2025/05/28 現在、日本語は入ってないから、日本語で動かしたい場合は自分で翻訳した shoestring/lang/ja/LC_MESSAGES/messages.po を作って実行してくれよな!

scripts/compile_resource_strings.sh

6. shoestring を実行してみるぜ

日本語で実行したいなら、こうだ!

LC_MESSAGES=ja python3 -m shoestring

ウィザードモードで起動したいときは?

LC_MESSAGES=ja python3 -m shoestring.wizard

別のディレクトリから動かしたい場合は?

PYTHONPATH=~/product/tools/shoestring LC_MESSAGES=ja python3 -m shoestring.wizard

7. Lint チェックもやってみようぜ

まずは shellcheck をインストールするぜ!必須だぜ!

sudo apt update
sudo apt install shellcheck

Lint を実行するにはこうやるんだぜ!迷わず実行だ!

cd ~/product/tools/shoestring
scripts/ci/lint.sh

8. テストも動かしてみようぜ

こいつでバッチリ動作確認だぜ!

cd ~/product/tools/shoestring
scripts/ci/test.sh

9. インストールしてしまうのもアリだぜ

ビルドには Poetry v1 系を使用してるから、まずはそれをインストールするんだ。

curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 -

あとはビルドしてインストールするだけ!簡単だろ?

poetry build
pip install dist/symbol_shoestring-0.2.1-py3-none-any.whl

お疲れさま!これですべての準備が整ったぜ!
もし困ったことがあったら、遠慮せずコメントしてくれよな!
一緒に楽しく開発ライフを送ろうぜ!最高だぜ!

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?