Skip to content

Commit 2155093

Browse files
committed
build: restore compatibility with Python 3.8
1 parent 261b282 commit 2155093

File tree

4 files changed

+101
-101
lines changed

4 files changed

+101
-101
lines changed

.github/workflows/python.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: actions
22

33
on:
44
push:
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
15-
python-version: ['3.9', '3.10', '3.11']
15+
python-version: ['3.8', '3.9', '3.10', '3.11']
1616

1717
steps:
1818
- uses: actions/checkout@v3
@@ -48,8 +48,7 @@ jobs:
4848
with:
4949
python-version: '3.11'
5050
architecture: x64
51-
- run: pip install -r requirements_test.txt
52-
- run: python setup.py bdist_wheel sdist
51+
- run: python -m build
5352
- uses: pypa/gh-action-pypi-publish@release/v1
5453
with:
5554
password: ${{ secrets.PYPI_API_TOKEN }}

Jenkinsfile

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -8,114 +8,114 @@ pipeline {
88
ansiColor('xterm')
99
}
1010

11-
environment {
12-
PYTHON_MODULES = 'version_query test *.py'
11+
agent {
12+
dockerfile {
13+
additionalBuildArgs '--build-arg USER_ID=${USER_ID} --build-arg GROUP_ID=${GROUP_ID}' \
14+
+ ' --build-arg AUX_GROUP_IDS="${AUX_GROUP_IDS}" --build-arg TIMEZONE=${TIMEZONE}'
15+
label 'docker'
16+
}
1317
}
1418

15-
agent any
16-
1719
stages {
18-
stage('Matrix') {
19-
matrix {
20-
21-
axes {
22-
axis {
23-
name 'PYTHON_VERSION'
24-
values '3.9', '3.10', '3.11'
25-
}
26-
}
27-
28-
agent {
29-
dockerfile {
30-
additionalBuildArgs '--build-arg USER_ID=${USER_ID} --build-arg GROUP_ID=${GROUP_ID}' \
31-
+ ' --build-arg AUX_GROUP_IDS="${AUX_GROUP_IDS}" --build-arg TIMEZONE=${TIMEZONE}' \
32-
+ ' --build-arg PYTHON_VERSION=${PYTHON_VERSION}'
33-
label 'docker'
34-
}
35-
}
36-
37-
stages {
3820

39-
stage('Lint') {
40-
when {
41-
environment name: 'PYTHON_VERSION', value: '3.11'
42-
}
43-
steps {
44-
sh """#!/usr/bin/env bash
45-
set -Eeux
46-
python -m pylint ${PYTHON_MODULES} |& tee pylint.log
47-
echo "\${PIPESTATUS[0]}" | tee pylint_status.log
48-
python -m mypy ${PYTHON_MODULES} |& tee mypy.log
49-
echo "\${PIPESTATUS[0]}" | tee mypy_status.log
50-
python -m flake518 ${PYTHON_MODULES} |& tee flake518.log
51-
echo "\${PIPESTATUS[0]}" | tee flake518_status.log
52-
python -m pydocstyle ${PYTHON_MODULES} |& tee pydocstyle.log
53-
echo "\${PIPESTATUS[0]}" | tee pydocstyle_status.log
54-
"""
55-
}
56-
}
57-
58-
stage('Test') {
59-
steps {
60-
sh '''#!/usr/bin/env bash
61-
set -Eeuxo pipefail
62-
TEST_PACKAGING=1 python -m coverage run --branch --source . -m unittest -v
63-
'''
64-
}
65-
}
21+
stage('Lint') {
22+
environment {
23+
PYTHON_MODULES = 'version_query test *.py'
24+
}
25+
steps {
26+
sh """#!/usr/bin/env bash
27+
set -Eeux
28+
python3 -m pylint ${PYTHON_MODULES} |& tee pylint.log
29+
echo "\${PIPESTATUS[0]}" | tee pylint_status.log
30+
python3 -m mypy ${PYTHON_MODULES} |& tee mypy.log
31+
echo "\${PIPESTATUS[0]}" | tee mypy_status.log
32+
python3 -m flake518 ${PYTHON_MODULES} |& tee flake518.log
33+
echo "\${PIPESTATUS[0]}" | tee flake518_status.log
34+
python3 -m pydocstyle ${PYTHON_MODULES} |& tee pydocstyle.log
35+
echo "\${PIPESTATUS[0]}" | tee pydocstyle_status.log
36+
"""
37+
}
38+
}
6639

67-
stage('Coverage') {
68-
when {
69-
environment name: 'PYTHON_VERSION', value: '3.11'
70-
}
71-
steps {
72-
sh '''#!/usr/bin/env bash
73-
set -Eeux
74-
python -m coverage report --show-missing |& tee coverage.log
75-
echo "${PIPESTATUS[0]}" | tee coverage_status.log
76-
'''
77-
script {
78-
defaultHandlers.afterPythonBuild()
79-
}
80-
}
81-
}
40+
stage('Test') {
41+
steps {
42+
sh '''#!/usr/bin/env bash
43+
set -Eeuxo pipefail
44+
python3 -m coverage run --branch --source . -m unittest -v
45+
'''
46+
}
47+
}
8248

83-
stage('Codecov') {
84-
environment {
85-
CODECOV_TOKEN = credentials('codecov-token-mbdevpl-version-query')
86-
}
87-
steps {
88-
sh '''#!/usr/bin/env bash
89-
set -Eeuxo pipefail
90-
python -m codecov --token ${CODECOV_TOKEN}
91-
'''
92-
}
93-
}
49+
stage('Coverage') {
50+
steps {
51+
sh '''#!/usr/bin/env bash
52+
set -Eeux
53+
python3 -m coverage report --show-missing |& tee coverage.log
54+
echo "${PIPESTATUS[0]}" | tee coverage_status.log
55+
'''
56+
script {
57+
defaultHandlers.afterPythonBuild()
58+
}
59+
}
60+
}
9461

95-
stage('Release') {
96-
when {
97-
environment name: 'PYTHON_VERSION', value: '3.11'
98-
buildingTag()
99-
}
100-
environment {
101-
PACKAGE_NAME = 'version-query'
102-
VERSION = sh(script: 'python3 -m version_query .', returnStdout: true).trim()
103-
}
104-
steps {
105-
script {
106-
githubUtils.createRelease([
107-
"dist/${PACKAGE_NAME.replace('-', '_')}-${VERSION}-py3-none-any.whl",
108-
"dist/${PACKAGE_NAME}-${VERSION}.tar.gz",
109-
"dist/${PACKAGE_NAME}-${VERSION}.zip"
110-
])
111-
}
112-
}
113-
}
62+
stage('Codecov') {
63+
environment {
64+
CODECOV_TOKEN = credentials('codecov-token-mbdevpl-version-query')
65+
}
66+
steps {
67+
sh '''#!/usr/bin/env bash
68+
set -Eeuxo pipefail
69+
python3 -m codecov --token ${CODECOV_TOKEN}
70+
'''
71+
}
72+
}
11473

74+
stage('Upload') {
75+
when {
76+
anyOf {
77+
branch 'main'
78+
buildingTag()
11579
}
80+
}
81+
environment {
82+
PACKAGE_NAME = 'ingit'
83+
VERSION = sh(script: 'python3 -m version_query --predict .', returnStdout: true).trim()
84+
PYPI_AUTH = credentials('mbdev-pypi-auth')
85+
TWINE_USERNAME = "${PYPI_AUTH_USR}"
86+
TWINE_PASSWORD = "${PYPI_AUTH_PSW}"
87+
TWINE_REPOSITORY_URL = credentials('mbdev-pypi-public-url')
88+
}
89+
steps {
90+
sh """#!/usr/bin/env bash
91+
set -Eeuxo pipefail
92+
python3 -m twine upload \
93+
dist/${PACKAGE_NAME.replace('-', '_')}-${VERSION}-py3-none-any.whl \
94+
dist/${PACKAGE_NAME}-${VERSION}.tar.gz \
95+
dist/${PACKAGE_NAME}-${VERSION}.zip
96+
"""
97+
}
98+
}
11699

100+
stage('Release') {
101+
when {
102+
buildingTag()
103+
}
104+
environment {
105+
PACKAGE_NAME = 'version-query'
106+
VERSION = sh(script: 'python3 -m version_query .', returnStdout: true).trim()
107+
}
108+
steps {
109+
script {
110+
githubUtils.createRelease([
111+
"dist/${PACKAGE_NAME.replace('-', '_')}-${VERSION}-py3-none-any.whl",
112+
"dist/${PACKAGE_NAME}-${VERSION}.tar.gz",
113+
"dist/${PACKAGE_NAME}-${VERSION}.zip"
114+
])
115+
}
117116
}
118117
}
118+
119119
}
120120

121121
post {

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ using version-query without any issues.
436436
Requirements
437437
============
438438

439-
Python version 3.9 or later.
439+
Python version 3.8 or later.
440440

441441
Python libraries as specified in `<requirements.txt>`_.
442442

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Package(boilerplates.setup.Package):
2020
'Operating System :: MacOS :: MacOS X',
2121
'Operating System :: Microsoft :: Windows',
2222
'Operating System :: POSIX :: Linux',
23+
'Programming Language :: Python :: 3.8',
2324
'Programming Language :: Python :: 3.9',
2425
'Programming Language :: Python :: 3.10',
2526
'Programming Language :: Python :: 3.11',

0 commit comments

Comments
 (0)