Skip to content

Commit

Permalink
issues/185: support python3.8 (#186)
Browse files Browse the repository at this point in the history
What:
- support python3.8

Why:
- Future and all
- Fixes: #185
  • Loading branch information
komuw authored Dec 7, 2019
1 parent 8274fb8 commit 895a269
Show file tree
Hide file tree
Showing 43 changed files with 128 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Contributions are under the [MIT License](https://github.com/komuw/naz/blob/mast
- fork this repo.
- install pre-requiste software:
```shell
apt-get -y install pandoc && pip install -e .[dev,test,benchmarks]
apt-get -y install pandoc && pip install -U -e .[dev,test,benchmarks]
```
- make the changes you want on your fork.
- your changes should have backward compatibility in mind unless it is impossible to do so.
Expand Down
40 changes: 23 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# DOCS: https://help.github.com/en/articles/workflow-syntax-for-github-actions



name: naz ci
on: [pull_request, push]

jobs:

static_analysis:
name: static_analysis
name: static_analysis ${{ matrix.python-version }}
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [ '3.7' ] # pytype doesnt yet support python3.8; https://github.com/google/pytype/issues/466
timeout-minutes: 6
steps:
- uses: actions/checkout@v1

- name: Set up python
uses: actions/setup-python@v1
with:
python-version: '3.7'
python-version: ${{ matrix.python-version }}

- name: Check out code
uses: actions/checkout@v1

# TODO: fix this, for master branch it fails
- name: check if changes have release notes
if: github.ref != 'refs/heads/master'
Expand Down Expand Up @@ -46,7 +50,7 @@ jobs:
run: |
pwd; ls -lsha
sudo apt -y update; sudo apt-get -y install pandoc
pip install -e .[dev,test,benchmarks]
pip install -U -e .[dev,test,benchmarks]
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
- name: run them analyzers
Expand All @@ -64,29 +68,32 @@ jobs:
printf "\n\t running mypy:\n"
mypy --show-column-numbers --ignore-missing-imports cli/ naz/ tests/ examples/ benchmarks/ #--strict
printf "\n\t running pytype:\n"
pytype --verbosity 0 --python-version 3.7 --protocols --strict-import --keep-going naz/ cli/ examples/ benchmarks/
pytype --verbosity 0 --python-version ${{ matrix.python-version }} --protocols --strict-import --keep-going naz/ cli/ examples/ benchmarks/
env:
PYTHONASYNCIODEBUG: '1'
NAZ_DEBUG: 'NAZ_DEBUG'


tests:
name: tests
name: tests ${{ matrix.python-version }}
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [ '3.7', '3.8' ]
timeout-minutes: 6
steps:
- uses: actions/checkout@v1

- name: Set up python
uses: actions/setup-python@v1
with:
python-version: '3.7'
python-version: ${{ matrix.python-version }}

- name: Check out code
uses: actions/checkout@v1

- name: install apt and pip deps
run: |
pwd; ls -lsha
sudo apt -y update; sudo apt-get -y install curl pandoc
pip install -e .[dev,test,benchmarks]
pip install -U -e .[dev,test,benchmarks]
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
- name: run tests
Expand All @@ -106,19 +113,18 @@ jobs:
runs-on: ubuntu-18.04
timeout-minutes: 3
steps:
- uses: actions/checkout@v1

- name: Set up python
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: Check out code
uses: actions/checkout@v1

- name: install apt and pip deps
run: |
pwd; ls -lsha
sudo apt -y update; sudo apt-get -y install pandoc
pip install -e .[dev,test,benchmarks]
pip install -U -e .[dev,test,benchmarks]
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
- name: check docs are okay
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
most recent version is listed first.



## **version:** v0.7.7
- support python version 3.8: https://github.com/komuw/naz/pull/186


## **version:** v0.7.6
- Add ability to supply more `submit_sm` parameters when enquiuing `submit_sm`: https://github.com/komuw/naz/pull/193

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test:
@printf "\n run pylint::\n" && pylint --enable=E --disable=W,R,C naz/ tests/ cli/ documentation/ examples/ benchmarks/
@printf "\n run bandit::\n" && bandit -r --exclude .venv -ll .
@printf "\n run mypy::\n" && mypy --show-column-numbers --ignore-missing-imports cli/ naz/ tests/ examples/ benchmarks/
@printf "\n run pytype::\n" && pytype --verbosity 0 --python-version 3.7 --protocols --strict-import --keep-going naz/ cli/ examples/ benchmarks/
@printf "\n run pytype::\n" && pytype --verbosity 0 --protocols --strict-import --keep-going naz/ cli/ examples/ benchmarks/

# note `.nojekyll` file is important inside `docs/` folder
# without it, css styling for docs in https://komuw.github.io/naz/ is broken
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV PYTHONPATH="/usr/src/app"
RUN printf "\\n\\t Installing using branch: %s \\n" "${NAZ_BRANCH}" && \
wget -nc "https://github.com/komuw/naz/archive/${NAZ_BRANCH}.zip" && \
unzip ./*.zip && \
(cd naz-*; pip install -e .[benchmarks]) && \
(cd naz-*; pip install -U -e .[benchmarks]) && \
rm -rf ./naz-* && \
rm -rf ./*.zip && \
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete;find . -name '*.pid' -delete
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/digitalocean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cd naz/benchmarks
# A. SMSC SERVER
# 1. Add firewall to the server that has these ports open: 22, 2775, 6379, 9000
# 2. start screen
python3.7 -m pip install -e ..[dev,test,benchmarks]
python3.7 -m pip install -U -e ..[dev,test,benchmarks]
export REDIS_PASSWORD=hey_NSA && python3.7 smpp_n_broker_servers.py &>/dev/null &
disown

Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Overview: module code &mdash; naz v0.7.6 documentation</title>
<title>Overview: module code &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/broker.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.broker &mdash; naz v0.7.6 documentation</title>
<title>naz.broker &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
16 changes: 7 additions & 9 deletions docs/_modules/naz/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.client &mdash; naz v0.7.6 documentation</title>
<title>naz.client &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down Expand Up @@ -738,15 +738,11 @@ <h1>Source code for naz.client</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">_log</span><span class="p">(</span>
<span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">,</span> <span class="p">{</span><span class="s2">&quot;event&quot;</span><span class="p">:</span> <span class="s2">&quot;naz.Client.connect&quot;</span><span class="p">,</span> <span class="s2">&quot;stage&quot;</span><span class="p">:</span> <span class="s2">&quot;start&quot;</span><span class="p">,</span> <span class="s2">&quot;log_id&quot;</span><span class="p">:</span> <span class="n">log_id</span><span class="p">}</span>
<span class="p">)</span>
<span class="n">reader</span><span class="p">,</span> <span class="n">writer</span> <span class="o">=</span> <span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">open_connection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smsc_host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">smsc_port</span><span class="p">)</span>
<span class="n">reader</span><span class="p">,</span> <span class="n">writer</span> <span class="o">=</span> <span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">wait_for</span><span class="p">(</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">open_connection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smsc_host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">smsc_port</span><span class="p">),</span> <span class="n">timeout</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">socket_timeout</span>
<span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">reader</span>
<span class="bp">self</span><span class="o">.</span><span class="n">writer</span> <span class="o">=</span> <span class="n">writer</span>
<span class="n">sock</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">writer</span><span class="o">.</span><span class="n">get_extra_info</span><span class="p">(</span><span class="s2">&quot;socket&quot;</span><span class="p">)</span>
<span class="n">sock</span><span class="o">.</span><span class="n">settimeout</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">socket_timeout</span><span class="p">)</span>
<span class="c1"># A socket object can be in one of three modes: blocking, non-blocking, or timeout.</span>
<span class="c1"># At the OS level, sockets in timeout mode are internally set in non-blocking mode.</span>
<span class="c1"># https://docs.python.org/3/library/socket.html#notes-on-socket-timeouts</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_log</span><span class="p">(</span>
<span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">,</span> <span class="p">{</span><span class="s2">&quot;event&quot;</span><span class="p">:</span> <span class="s2">&quot;naz.Client.connect&quot;</span><span class="p">,</span> <span class="s2">&quot;stage&quot;</span><span class="p">:</span> <span class="s2">&quot;end&quot;</span><span class="p">,</span> <span class="s2">&quot;log_id&quot;</span><span class="p">:</span> <span class="n">log_id</span><span class="p">}</span>
<span class="p">)</span>
Expand All @@ -755,6 +751,8 @@ <h1>Source code for naz.client</h1><div class="highlight"><pre>
<span class="ne">OSError</span><span class="p">,</span>
<span class="ne">ConnectionError</span><span class="p">,</span>
<span class="ne">TimeoutError</span><span class="p">,</span>
<span class="c1"># Note that `asyncio.TimeoutError` is raised with no msg/args. So it will appear in logs as an empty string</span>
<span class="c1"># https://github.com/python/cpython/blob/723f71abf7ab0a7be394f9f7b2daa9ecdf6fb1eb/Lib/asyncio/tasks.py#L490</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">TimeoutError</span><span class="p">,</span>
<span class="n">socket</span><span class="o">.</span><span class="n">error</span><span class="p">,</span>
<span class="n">socket</span><span class="o">.</span><span class="n">herror</span><span class="p">,</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/codec.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.codec &mdash; naz v0.7.6 documentation</title>
<title>naz.codec &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/correlater.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.correlater &mdash; naz v0.7.6 documentation</title>
<title>naz.correlater &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/hooks.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.hooks &mdash; naz v0.7.6 documentation</title>
<title>naz.hooks &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.log &mdash; naz v0.7.6 documentation</title>
<title>naz.log &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/protocol.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.protocol &mdash; naz v0.7.6 documentation</title>
<title>naz.protocol &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/ratelimiter.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.ratelimiter &mdash; naz v0.7.6 documentation</title>
<title>naz.ratelimiter &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/sequence.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.sequence &mdash; naz v0.7.6 documentation</title>
<title>naz.sequence &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/state.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.state &mdash; naz v0.7.6 documentation</title>
<title>naz.state &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/naz/throttle.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>naz.throttle &mdash; naz v0.7.6 documentation</title>
<title>naz.throttle &mdash; naz v0.7.7 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
v0.7.6
v0.7.7
</div>


Expand Down
Loading

0 comments on commit 895a269

Please sign in to comment.