Skip to content

Commit

Permalink
explr PR - Fix issue slackapi#777: use jekyll {include} to standardiz…
Browse files Browse the repository at this point in the history
…e virtual env creation
  • Loading branch information
srtaalej committed Jun 24, 2024
1 parent b88d0fc commit 2a26617
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 34 deletions.
9 changes: 3 additions & 6 deletions docs/_tutorials/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
9 changes: 3 additions & 6 deletions docs/_tutorials/getting_started_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
9 changes: 3 additions & 6 deletions docs/_tutorials/ja_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
9 changes: 3 additions & 6 deletions docs/_tutorials/ja_getting_started_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
5 changes: 2 additions & 3 deletions examples/aws_lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions examples/django/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions examples/getting_started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@ responding to events and interactive buttons.

### 1. Setup environment variables

```zsh
```bash
# Replace with your signing secret and token
export SLACK_BOT_TOKEN=<your-bot-token>
export SLACK_SIGNING_SECRET=<your-signing-secret>
```

### 2. Setup your local project

```zsh
```bash
# Clone this project onto your machine
git clone https://github.com/slackapi/bolt-python.git

# Change into this project
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
```
Expand All @@ -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
```
Expand Down
4 changes: 4 additions & 0 deletions includes/virtual_env_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
python3 -m venv .venv
source .venv/bin/activate
```

0 comments on commit 2a26617

Please sign in to comment.