diff --git a/docs/_tutorials/getting_started.md b/docs/_tutorials/getting_started.md index 492494ac..34359753 100644 --- a/docs/_tutorials/getting_started.md +++ b/docs/_tutorials/getting_started.md @@ -69,21 +69,18 @@ With the initial configuration handled, it's time to set up a new Bolt project. If you don’t already have a project, let’s create a new one. Create an empty directory: -```shell +```bash mkdir first-bolt-app cd first-bolt-app ``` Next, we recommend using a [Python virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) to manage your project's dependencies. This is a great way to prevent conflicts with your system's Python packages. Let's create and activate a new virtual environment with [Python 3.6 or later](https://www.python.org/downloads/): -```shell -python3 -m venv .venv -source .venv/bin/activate -``` +{% include virtualenv_setup.md %} We can confirm that the virtual environment is active by checking that the path to `python3` is _inside_ your project ([a similar command is available on Windows](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#activating-a-virtual-environment)): -```shell +```bash which python3 # Output: /path/to/first-bolt-app/.venv/bin/python3 ``` diff --git a/docs/_tutorials/getting_started_http.md b/docs/_tutorials/getting_started_http.md index 75ab22f7..6720fa96 100644 --- a/docs/_tutorials/getting_started_http.md +++ b/docs/_tutorials/getting_started_http.md @@ -62,21 +62,18 @@ With the initial configuration handled, it's time to set up a new Bolt project. If you don’t already have a project, let’s create a new one. Create an empty directory: -```shell +```bash mkdir first-bolt-app cd first-bolt-app ``` Next, we recommend using a [Python virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) to manage your project's dependencies. This is a great way to prevent conflicts with your system's Python packages. Let's create and activate a new virtual environment with [Python 3.6 or later](https://www.python.org/downloads/): -```shell -python3 -m venv .venv -source .venv/bin/activate -``` +{% include virtualenv_setup.md %} We can confirm that the virtual environment is active by checking that the path to `python3` is _inside_ your project ([a similar command is available on Windows](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#activating-a-virtual-environment)): -```shell +```bash which python3 # Output: /path/to/first-bolt-app/.venv/bin/python3 ``` diff --git a/docs/_tutorials/ja_getting_started.md b/docs/_tutorials/ja_getting_started.md index b85527ac..3a5d1c36 100644 --- a/docs/_tutorials/ja_getting_started.md +++ b/docs/_tutorials/ja_getting_started.md @@ -69,21 +69,18 @@ Slack アプリで使用できるトークンには、ユーザートークン プロジェクトをまだ作成していない場合は、新しく作成しましょう。空のディレクトリを作成します。 -```shell +```bash mkdir first-bolt-app cd first-bolt-app ``` 次に、プロジェクトの依存関係を管理する方法として、[Python 仮想環境](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment)を使ったおすすめの方法を紹介します。これはシステム Python に存在するパッケージとのコンフリクトを防ぐために推奨されている優れた方法です。[Python 3.6 以降](https://www.python.org/downloads/)の仮想環境を作成し、アクティブにしてみましょう。 -```shell -python3 -m venv .venv -source .venv/bin/activate -``` +{% include virtualenv_setup.md %} `python3` へのパスがプロジェクトの中を指していることを確かめることで、仮想環境がアクティブになっていることを確認できます([Windows でもこれに似たコマンドが利用できます](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#activating-a-virtual-environment))。 -```shell +```bash which python3 # 出力結果 : /path/to/first-bolt-app/.venv/bin/python3 ``` diff --git a/docs/_tutorials/ja_getting_started_http.md b/docs/_tutorials/ja_getting_started_http.md index d69b7740..f631999b 100644 --- a/docs/_tutorials/ja_getting_started_http.md +++ b/docs/_tutorials/ja_getting_started_http.md @@ -64,21 +64,18 @@ Slack アプリで使用できるトークンには、ユーザートークン プロジェクトをまだ作成していない場合は、新しく作成しましょう。空のディレクトリを作成します。 -```shell +```bash mkdir first-bolt-app cd first-bolt-app ``` 次に、プロジェクトの依存関係を管理する方法として、[Python 仮想環境](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment)を使ったおすすめの方法を紹介します。これはシステム Python に存在するパッケージとのコンフリクトを防ぐために推奨されている優れた方法です。[Python 3.6 以降](https://www.python.org/downloads/)の仮想環境を作成し、アクティブにしてみましょう。 -```shell -python3 -m venv .venv -source .venv/bin/activate -``` +{% include virtualenv_setup.md %} `python3` へのパスがプロジェクトの中を指していることを確かめることで、仮想環境がアクティブになっていることを確認できます([Windows でもこれに似たコマンドが利用できます](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#activating-a-virtual-environment))。 -```shell +```bash which python3 # 出力結果 : /path/to/first-bolt-app/.venv/bin/python3 ``` diff --git a/examples/aws_lambda/README.md b/examples/aws_lambda/README.md index 454f080a..0a1186be 100644 --- a/examples/aws_lambda/README.md +++ b/examples/aws_lambda/README.md @@ -39,9 +39,8 @@ Instructions on how to set up and deploy each example are provided below. apps as the environment variables `SLACK_BOT_TOKEN` and `SLACK_SIGNING_SECRET`, respectively, as per the [Getting Started Guide](https://slack.dev/bolt-python/tutorial/getting-started). -5. You may want to create a dedicated virtual environment for this example app, as - per the "Setting up your project" section of the [Getting - Started Guide](https://slack.dev/bolt-python/tutorial/getting-started). +5. You may want to create a dedicated virtual environment for this example app: +{% include virtualenv_setup.md %} 6. Let's deploy the Lambda! Run `./deploy_lazy.sh`. By default it deploys to the us-east-1 region in AWS - you can change this at the top of `lazy_aws_lambda_config.yaml` if you wish. 7. Load up AWS Lambda inside the AWS Console - make sure you are in the correct diff --git a/examples/django/README.md b/examples/django/README.md index c50681c5..a4ad0f57 100644 --- a/examples/django/README.md +++ b/examples/django/README.md @@ -18,9 +18,8 @@ To run this app, all you need to do are: You can start your Django application this way: +{% include virtualenv_setup.md %} ```bash -python -m venv .venv -source .venv/bin/activate pip install -U pip pip install -r requirements.txt diff --git a/examples/getting_started/README.md b/examples/getting_started/README.md index 63875a4d..5a1b0ee8 100644 --- a/examples/getting_started/README.md +++ b/examples/getting_started/README.md @@ -10,7 +10,7 @@ responding to events and interactive buttons. ### 1. Setup environment variables -```zsh +```bash # Replace with your signing secret and token export SLACK_BOT_TOKEN= export SLACK_SIGNING_SECRET= @@ -18,7 +18,7 @@ export SLACK_SIGNING_SECRET= ### 2. Setup your local project -```zsh +```bash # Clone this project onto your machine git clone https://github.com/slackapi/bolt-python.git @@ -26,9 +26,10 @@ git clone https://github.com/slackapi/bolt-python.git cd bolt-python/examples/getting_started/ # Setup virtual environment -python3 -m venv .venv -source .venv/bin/activate +``` +{% include virtualenv_setup.md %} +```bash # Install the dependencies pip install -r requirements.txt ``` @@ -37,7 +38,7 @@ pip install -r requirements.txt [Setup ngrok][3] to create a local requests URL for development. -```zsh +```bash ngrok http 3000 python3 app.py ``` diff --git a/includes/virtual_env_setup.md b/includes/virtual_env_setup.md new file mode 100644 index 00000000..79b32738 --- /dev/null +++ b/includes/virtual_env_setup.md @@ -0,0 +1,4 @@ +```bash +python3 -m venv .venv +source .venv/bin/activate +``` \ No newline at end of file