Skip to content

Commit a3dffd5

Browse files
authored
Change installation of python inside docker to use another version. (#658)
- Remove old Python versions - python3.4-dev isn't available - python3.5 reaches end of life. pip 21.0 will drop support for Python 3.5 in January 2021. - Fix test with python 3.6.
1 parent c0f8672 commit a3dffd5

File tree

7 files changed

+46
-19
lines changed

7 files changed

+46
-19
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
python-version: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '-dev']
21+
python-version: ['3.6', '3.7', '3.8', '3.9']
2222

2323
steps:
2424
- uses: actions/checkout@v2

Dockerfile.qa

+19-9
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@ FROM ubuntu:20.04
22

33
ARG PYTHON_VERSION
44

5-
RUN \
6-
apt update && \
7-
apt-get install -y make gcc-8 libkrb5-dev python$PYTHON_VERSION python3-pip && \
8-
apt-get clean
5+
# Install add-apt-repository
6+
RUN apt-get update
7+
RUN apt-get install -y software-properties-common
98

9+
# Install python development
10+
RUN add-apt-repository ppa:deadsnakes/ppa
11+
RUN apt-get update
12+
RUN apt-get install -y python$PYTHON_VERSION-dev python3-pip
13+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python$PYTHON_VERSION 1
14+
15+
# Install kerberos development
16+
RUN apt-get install -y libkrb5-dev
17+
18+
# Clean
19+
RUN apt-get clean
20+
21+
# Install modules
1022
WORKDIR /atlassian-python-api
1123
COPY requirements.txt .
1224
COPY requirements-dev.txt .
25+
RUN python3 -m pip install --no-cache-dir --upgrade pip
26+
RUN python3 -m pip install --no-cache-dir -r requirements-dev.txt
1327

14-
ENV PYTHON_VERSION=PYTHON_VERSION
15-
16-
RUN \
17-
python3 -m pip install --no-cache-dir --upgrade pip && \
18-
python3 -m pip install --no-cache-dir -r requirements-dev.txt
28+
ENV PYTHON_VERSION=$PYTHON_VERSION
1929

2030
CMD python3 -m pip install -e . && \
2131
make qa PYTHON_VERSION=$PYTHON_VERSION

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
PYTHON_VERSION ?= 3.7
66

7-
87
QA_CONTAINER ?= atlassian-python-api-qa-$(PYTHON_VERSION)
98
TEST_OPTS ?=
109

10+
LINTING_TARGETS := atlassian/ examples/ tests/
11+
1112
.PHONY: help setup-dev qa lint test doc docker-qa docker-qa-build
1213

1314
help:

atlassian-python-api.code-workspace

-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
"settings": {
88
"files.exclude": {
99
".mypy_cache": true,
10-
".tox": true,
1110
"**/__pycache__": true,
1211
"**/*.pyc": true,
13-
"atlassian_python_api.egg-info": true
1412
},
1513
"files.associations": {
1614
"DELETE": "python",

atlassian/bitbucket/base.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# coding=utf-8
22

3+
import re
4+
import sys
5+
36
from datetime import datetime
47
from ..rest_client import AtlassianRestAPI
58

69

10+
RE_TIMEZONE = re.compile(r"(\d{2}):(\d{2})$")
11+
12+
713
class BitbucketBase(AtlassianRestAPI):
814
CONF_TIMEFORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
915
bulk_headers = {"Content-Type": "application/vnd.atl.bitbucket.bulk+json"}
@@ -77,6 +83,9 @@ def get_time(self, id):
7783
return value_str
7884

7985
if isinstance(value_str, str):
86+
# The format contains a : in the timezone which is supported from 3.7 on.
87+
if sys.version_info <= (3, 7):
88+
value_str = RE_TIMEZONE.sub(r"\1\2", value_str)
8089
value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
8190
else:
8291
value = value_str

requirements-dev.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
mock
21
-r requirements.txt
3-
flake8
2+
mock
43
pytest
5-
pylint
4+
pytest-cov
5+
flake8
6+
black
67
tox

tox.ini

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22
linting_targets = atlassian/ examples/ tests/
33

44
[tox]
5-
envlist = py27,py3,flake8,black,mypy,bandit,doc8
5+
envlist = py3,flake8,black,mypy,bandit,doc8
66
skip_missing_interpreters = True
77

88
[testenv]
9-
deps = pytest
10-
commands = pytest -v
9+
deps =
10+
pytest
11+
pytest-cov
12+
coverage
13+
commands =
14+
coverage erase
15+
pytest -v --cov=atlassian --cov-branch
16+
coverage report --omit='.tox/*'
17+
coverage html --omit='.tox/*'
1118
extras = kerberos
19+
parallel_show_output = true
1220

1321
[testenv:flake8]
1422
basepython = python3

0 commit comments

Comments
 (0)