modern_python v0.9.1
jaseg 2022-02-06 20:42:46 +01:00
rodzic 77f2da8761
commit 0d21c171d3
9 zmienionych plików z 50 dodań i 142 usunięć

Wyświetl plik

@ -1,80 +1,48 @@
stages:
- test
- coverage
- build
- upload
image: python:3-alpine
variables:
TWINE_NON_INTERACTIVE: "true"
CONFIG_FILE: ".pypirc"
GIT_SUBMODULE_STRATEGY: recursive
cache:
stages:
- build
- test
- publish
build:debian_10:
stage: build
image: "registry.gitlab.com/gerbolyze/build-containers/debian:10"
variables:
GIT_SUBMODULE_STRATEGY: none
script:
- python3 setup.py bdist_wheel
artifacts:
name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
paths:
- .pipcache/
- dist/*.whl
before_script:
- apk --no-cache add make
- pip --cache-dir .pipcache install -r test-requirements.txt
- cat /etc/alpine-release
- python -V
.test:
test:debian_10:
stage: test
image: "registry.gitlab.com/gerbolyze/build-containers/debian:10"
script:
- make test
- "pytest -o 'testpaths=gerbonara/tests' -o 'norecursedirs=*'"
dependencies:
- build:debian_10
artifacts:
name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
when: on_failure
paths:
- gerbonara_test_failures/*
test:3.6:
extends: .test
image: python:3.6-alpine
test:3.7:
extends: .test
image: python:3.7-alpine
test:3.8:
extends: .test
image: python:3.8-alpine
test:3.9:
extends: .test
image: python:3.9-alpine
# 3.10
test:rc:
extends: .test
allow_failure: true
image: python:rc-alpine
testpypi:
stage: upload
publish:gerbonara:
stage: publish
variables:
GIT_SUBMODULE_STRATEGY: none
image: "registry.gitlab.com/gerbolyze/build-containers/debian:10"
cache: {}
script:
- pip --cache-dir .pipcache install twine
- python setup.py sdist bdist_wheel
- twine upload --skip-existing --repository testpypi dist/*
- pip install -U --user twine
- export TWINE_USERNAME TWINE_PASSWORD
- ~/.local/bin/twine upload dist/*
dependencies:
- build:debian_10
only:
- master
- /^v.*$/
pypi:
stage: upload
script:
- pip --cache-dir .pipcache install twine
- python setup.py sdist bdist_wheel
- twine upload --skip-existing --repository pypi dist/*
only:
- tags
aur_git:
stage: upload
script:
- echo "build pygerber-git"
only:
- master
aur:
stage: upload
script:
- echo "build pygerber"
only:
- tags

Wyświetl plik

@ -32,13 +32,6 @@ def test_zero_suppression():
("10000", 0.1),
("100000", 1.0),
("1000000", 10.0),
("-1", -0.00001),
("-10", -0.0001),
("-100", -0.001),
("-1000", -0.01),
("-10000", -0.1),
("-100000", -1.0),
("-1000000", -10.0),
("0", 0.0),
]
@ -57,13 +50,6 @@ def test_zero_suppression():
("00001", 0.001),
("000001", 0.0001),
("0000001", 0.00001),
("-1", -10.0),
("-01", -1.0),
("-001", -0.1),
("-0001", -0.01),
("-00001", -0.001),
("-000001", -0.0001),
("-0000001", -0.00001),
("0", 0.0),
]
@ -83,13 +69,6 @@ def test_format():
((2, 3), "1", 0.001),
((2, 2), "1", 0.01),
((2, 1), "1", 0.1),
((2, 7), "-1", -0.0000001),
((2, 6), "-1", -0.000001),
((2, 5), "-1", -0.00001),
((2, 4), "-1", -0.0001),
((2, 3), "-1", -0.001),
((2, 2), "-1", -0.01),
((2, 1), "-1", -0.1),
((2, 6), "0", 0),
]
for fmt, string, value in test_cases:
@ -104,12 +83,6 @@ def test_format():
((3, 5), "1", 100.0),
((2, 5), "1", 10.0),
((1, 5), "1", 1.0),
((6, 5), "-1", -100000.0),
((5, 5), "-1", -10000.0),
((4, 5), "-1", -1000.0),
((3, 5), "-1", -100.0),
((2, 5), "-1", -10.0),
((1, 5), "-1", -1.0),
((2, 5), "0", 0),
]
for fmt, string, value in test_cases:

Wyświetl plik

@ -1,5 +0,0 @@
# install base requirements
-r requirements.txt
pytest==6.0.1
pytest-cov==2.10.1

Wyświetl plik

@ -1,6 +0,0 @@
# install base requirements
-r requirements.txt
# documentation generation support
Sphinx==3.2.1
numpydoc==1.1.0

Wyświetl plik

@ -1,2 +0,0 @@
# cairo rendering support
cairocffi==0.6

Wyświetl plik

@ -1,2 +0,0 @@
[tool:pytest]
flake8-max-line-length = 120

Wyświetl plik

@ -1,30 +1,13 @@
#!/usr/bin/env python3
from os import environ
from os.path import join, abspath, dirname
from codecs import open
from pathlib import Path
from setuptools import setup, find_packages
from subprocess import check_output
def long_description():
with open('README.md', 'r') as fh:
return fh.read()
import subprocess
def version():
with open(join(abspath(dirname(__file__)), 'gerbonara/__init__.py')) as fh:
for line in fh:
if line.startswith('__version__'):
ver = line.split("'")[1]
if environ.get('CI_COMMIT_SHA', '') != '' and environ.get('CI_COMMIT_TAG', '') == '':
# attach commit hash to non tagged test uploads from CI
commits = check_output(['/usr/bin/env', 'git', 'rev-list', '--count', 'HEAD'], text=True)
return f'{ ver }.dev{ commits.strip() }'
return ver
raise RuntimeError('Unable to find version string.')
res = subprocess.run(['git', 'describe', '--tags', '--match', 'v*'], capture_output=True, check=True, text=True)
version, _, _rest = res.stdout.strip()[1:].partition('-')
return version
setup(
name='gerbonara',
@ -32,7 +15,7 @@ setup(
author='jaseg, XenGi',
author_email='gerbonara@jaseg.de',
description='Tools to handle Gerber and Excellon files in Python',
long_description=long_description(),
long_description=Path('README.md').read_text(),
long_description_content_type='text/markdown',
url='https://gitlab.com/gerbolyze/gerbonara',
project_urls={
@ -50,8 +33,6 @@ setup(
],
},
classifiers=[
#'Development Status :: 1 - Planning',
#'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
#'Development Status :: 5 - Production/Stable',
'Environment :: Console',

Wyświetl plik

@ -1,5 +0,0 @@
pytest
pytest-cov
pytest-xdist
pytest-flake8
twine

6
tox.ini 100644
Wyświetl plik

@ -0,0 +1,6 @@
[tox]
envlist = py37, py310
[testenv]
deps = pytest
commands = pytest