Skip to content

Commit

Permalink
Update maintainers guide
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Aug 5, 2020
1 parent 27d8d3b commit 9f4b735
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 23 deletions.
85 changes: 73 additions & 12 deletions maintainers_guide.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,77 @@
# Deploy to test repository
# Getting Started with The Project

## Python Runtime Management

We recommend using pyenv for Python runtime management.

https://github.com/pyenv/pyenv

If you use macOS, follow the following steps:

```bash
$ brew update
$ brew install pyenv
```

Then, install Python runtimes for this project:

```bash
$ pyenv install -l | grep -v "-e[conda|stackless|pypy]"

$ pyenv install 3.8.5
$ pyenv local 3.8.5

$ pyenv versions
system
3.6.10
3.7.7
* 3.8.5 (set by /path-to-bolt-python/.python-version)

$ pyenv rehash
```

## Create a Virtual Environment

```
$ python -m venv env_3.8.5
$ source env_3.8.5/bin/activate
```
# https://packaging.python.org/guides/using-testpypi/
python -m venv env
source env/bin/activate
pip install --upgrade pip
pip install twine wheel
rm -rf dist/ build/ slack_bolt.egg-info/ && python setup.py sdist bdist_wheel
twine check dist/*

# Deploy to test repository
twine upload --repository testpypi dist/*
# Test installation
pip install -U --index-url https://test.pypi.org/simple/ slack_bolt
## Run All the Tests

```bash
$ pip install -U pip
$ python setup.py test # or ./scripts/run_tests.sh
```

# Run the Samples

```bash
# Install all optional dependencies
$ pip install -e ".[adapter]"

$ cd samples/
$ export SLACK_SIGNING_SECRET=***
$ export SLACK_BOT_TOKEN=xoxb-***
$ python app.py

# In another terminal
$ ngrok http 3000 --subdomain {your-domain}
```

# Deploying to test.pypi.org

## $HOME/.pypirc

```
[testpypi]
username: {your username}
password: {your password}
```

## Run the Script

```bash
$ echo '__version__ = "{the version}"' > slack_bolt/version.py
$ ./scripts/deploy_to_test_pypi_org.sh
```
8 changes: 8 additions & 0 deletions scripts/build_pypi_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

./scripts/run_tests.sh && \
pip install -U pip && \
pip install twine wheel && \
rm -rf dist/ build/ slack_bolt.egg-info/ && \
python setup.py sdist bdist_wheel && \
twine check dist/*
9 changes: 9 additions & 0 deletions scripts/deploy_to_test_pypi_org.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

./scripts/run_tests.sh && \
pip install -U pip && \
pip install twine wheel && \
rm -rf dist/ build/ slack_bolt.egg-info/ && \
python setup.py sdist bdist_wheel && \
twine check dist/* && \
twine upload --repository testpypi dist/*
5 changes: 2 additions & 3 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
script_dir=`dirname $0`
cd ${script_dir}/..

python setup.py install && \
pip install "black==19.10b0" && \
pip install -e ".[testing]" && \
black slack_bolt/ tests/ && \
pytest $1
pytest $1
3 changes: 3 additions & 0 deletions scripts/uninstall_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

pip freeze | grep -v "^-e" | xargs pip uninstall -y
4 changes: 1 addition & 3 deletions slack_bolt/adapter/aws_lambda/chalice_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def clear_all_log_handlers(cls):
root.removeHandler(handler)

def handle(self, request: Request):
body: str = request.raw_body.decode(
"utf-8"
) if request.raw_body else ""
body: str = request.raw_body.decode("utf-8") if request.raw_body else ""
self.logger.debug(f"Incoming request: {request.to_dict()}, body: {body}")

method = request.method
Expand Down
2 changes: 1 addition & 1 deletion slack_bolt/adapter/starlette/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Don't add async module imports here
from .handler import SlackRequestHandler
from .handler import SlackRequestHandler
13 changes: 10 additions & 3 deletions slack_bolt/app/async_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ def __init__(
if self._bolt_oauth_flow:
self.web_app.add_routes(
[
web.get(self._bolt_oauth_flow.install_path, self.handle_get_requests),
web.get(self._bolt_oauth_flow.redirect_uri_path, self.handle_get_requests),
web.get(
self._bolt_oauth_flow.install_path, self.handle_get_requests
),
web.get(
self._bolt_oauth_flow.redirect_uri_path,
self.handle_get_requests,
),
web.post(self._endpoint_path, self.handle_post_requests),
]
)
else:
self.web_app.add_routes([web.post(self._endpoint_path, self.handle_post_requests)])
self.web_app.add_routes(
[web.post(self._endpoint_path, self.handle_post_requests)]
)

async def handle_get_requests(self, request: web.Request) -> web.Response:
oauth_flow = self._bolt_oauth_flow
Expand Down
2 changes: 1 addition & 1 deletion slack_bolt/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0a6"
__version__ = "0.2.0a7"

0 comments on commit 9f4b735

Please sign in to comment.