build: migrate to poetry

This commit is contained in:
Robert Kaussow 2020-12-28 16:21:51 +01:00 committed by GitHub
parent 1a15c4ab8d
commit 50bce1ac0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1281 additions and 186 deletions

View File

@ -5,11 +5,11 @@ local PythonVersion(pyversion='3.5') = {
PY_COLORS: 1,
},
commands: [
'pip install -r dev-requirements.txt -qq',
'pip install -qq .',
'pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail',
'ansible-later --help',
'ansible-later --version',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry install -q',
'poetry run pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail',
'poetry version',
'poetry run ansible-later --help',
],
depends_on: [
'clone',
@ -32,9 +32,10 @@ local PipelineLint = {
PY_COLORS: 1,
},
commands: [
'pip install -r dev-requirements.txt -qq',
'pip install -qq .',
'flake8 ./ansiblelater',
'git fetch -tq',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry install -q',
'poetry run flake8 ./ansiblelater',
],
},
],
@ -52,6 +53,13 @@ local PipelineTest = {
arch: 'amd64',
},
steps: [
{
name: 'fetch',
image: 'python:3.9',
commands: [
'git fetch -tq',
],
},
PythonVersion(pyversion='3.5'),
PythonVersion(pyversion='3.6'),
PythonVersion(pyversion='3.7'),
@ -100,9 +108,10 @@ local PipelineSecurity = {
PY_COLORS: 1,
},
commands: [
'pip install -r dev-requirements.txt -qq',
'pip install -qq .',
'bandit -r ./ansiblelater -x ./ansiblelater/test',
'git fetch -tq',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry install -q',
'poetry run bandit -r ./ansiblelater -x ./ansiblelater/test',
],
},
],
@ -127,7 +136,9 @@ local PipelineBuildPackage = {
name: 'build',
image: 'python:3.9',
commands: [
'python setup.py sdist bdist_wheel',
'git fetch -tq',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry build',
],
},
{
@ -153,12 +164,15 @@ local PipelineBuildPackage = {
},
{
name: 'publish-pypi',
image: 'plugins/pypi',
settings: {
username: { from_secret: 'pypi_username' },
password: { from_secret: 'pypi_password' },
repository: 'https://upload.pypi.org/legacy/',
skip_build: true,
image: 'python:3.9',
commands: [
'git fetch -tq',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry publish -n',
],
environment: {
POETRY_HTTP_BASIC_PYPI_USERNAME: { from_secret: 'pypi_username' },
POETRY_HTTP_BASIC_PYPI_PASSWORD: { from_secret: 'pypi_password' },
},
when: {
ref: ['refs/tags/**'],
@ -186,7 +200,9 @@ local PipelineBuildContainer(arch='amd64') = {
name: 'build',
image: 'python:3.9',
commands: [
'python setup.py bdist_wheel',
'git fetch -tq',
'pip install poetry poetry-dynamic-versioning -qq',
'poetry build',
],
},
{

View File

@ -10,9 +10,10 @@ steps:
- name: flake8
image: python:3.9
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- flake8 ./ansiblelater
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run flake8 ./ansiblelater
environment:
PY_COLORS: 1
@ -34,14 +35,19 @@ platform:
arch: amd64
steps:
- name: fetch
image: python:3.9
commands:
- git fetch -tq
- name: python35-pytest
image: python:3.5
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- ansible-later --help
- ansible-later --version
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- poetry version
- poetry run ansible-later --help
environment:
PY_COLORS: 1
depends_on:
@ -50,11 +56,11 @@ steps:
- name: python36-pytest
image: python:3.6
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- ansible-later --help
- ansible-later --version
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- poetry version
- poetry run ansible-later --help
environment:
PY_COLORS: 1
depends_on:
@ -63,11 +69,11 @@ steps:
- name: python37-pytest
image: python:3.7
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- ansible-later --help
- ansible-later --version
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- poetry version
- poetry run ansible-later --help
environment:
PY_COLORS: 1
depends_on:
@ -76,11 +82,11 @@ steps:
- name: python38-pytest
image: python:3.8
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- ansible-later --help
- ansible-later --version
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- poetry version
- poetry run ansible-later --help
environment:
PY_COLORS: 1
depends_on:
@ -89,11 +95,11 @@ steps:
- name: python39-pytest
image: python:3.9
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- ansible-later --help
- ansible-later --version
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run pytest ansiblelater --cov=ansiblelater --cov-append --no-cov-on-fail
- poetry version
- poetry run ansible-later --help
environment:
PY_COLORS: 1
depends_on:
@ -138,9 +144,10 @@ steps:
- name: bandit
image: python:3.9
commands:
- pip install -r dev-requirements.txt -qq
- pip install -qq .
- bandit -r ./ansiblelater -x ./ansiblelater/test
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry install -q
- poetry run bandit -r ./ansiblelater -x ./ansiblelater/test
environment:
PY_COLORS: 1
@ -168,7 +175,9 @@ steps:
- name: build
image: python:3.9
commands:
- python setup.py sdist bdist_wheel
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: checksum
image: alpine
@ -191,13 +200,15 @@ steps:
- refs/tags/**
- name: publish-pypi
image: plugins/pypi
settings:
password:
image: python:3.9
commands:
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry publish -n
environment:
POETRY_HTTP_BASIC_PYPI_PASSWORD:
from_secret: pypi_password
repository: https://upload.pypi.org/legacy/
skip_build: true
username:
POETRY_HTTP_BASIC_PYPI_USERNAME:
from_secret: pypi_username
when:
ref:
@ -227,7 +238,9 @@ steps:
- name: build
image: python:3.9
commands:
- python setup.py bdist_wheel
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: dryrun
image: plugins/docker:19
@ -312,7 +325,9 @@ steps:
- name: build
image: python:3.9
commands:
- python setup.py bdist_wheel
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: dryrun
image: plugins/docker:19
@ -397,7 +412,9 @@ steps:
- name: build
image: python:3.9
commands:
- python setup.py bdist_wheel
- git fetch -tq
- pip install poetry poetry-dynamic-versioning -qq
- poetry build
- name: dryrun
image: plugins/docker:19
@ -662,6 +679,6 @@ depends_on:
---
kind: signature
hmac: ee188eafcf82509ebf2c7ea729e399d4ea0e52071e650835f7a1f49b0b3e5cc7
hmac: e4769957c0f74e3e94d504d92b80cb32e181d06eab5730b8b61a8aa65fcc8c87
...

6
.style.yapf Normal file
View File

@ -0,0 +1,6 @@
[style]
based_on_style = google
column_limit = 99
dedent_closing_brackets = true
coalesce_brackets = true
split_before_logical_operator = true

View File

@ -1,12 +1,6 @@
"""Default package."""
__author__ = "Robert Kaussow"
__project__ = "ansible-later"
__license__ = "MIT"
__maintainer__ = "Robert Kaussow"
__email__ = "mail@thegeeklab.de"
__url__ = "https://github.com/thegeeklab/ansible-later"
__version__ = "0.3.12"
__version__ = "0.0.0"
from ansiblelater import logger

View File

@ -1,19 +0,0 @@
pydocstyle
flake8
flake8-colors
flake8-blind-except
flake8-builtins
flake8-docstrings
flake8-isort
flake8-logging-format
flake8-polyfill
flake8-quotes
flake8-pep3101
flake8-eradicate; python_version >= "3.6"
pep8-naming
wheel
pytest
pytest-mock
pytest-cov
bandit
yapf

13
import.txt Normal file
View File

@ -0,0 +1,13 @@
six
pyyaml
appdirs
unidiff
flake8
yamllint
nested-lookup
colorama
anyconfig
python-json-logger
jsonschema
pathspec
toolz

1064
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

103
pyproject.toml Normal file
View File

@ -0,0 +1,103 @@
[tool.poetry]
authors = ["Robert Kaussow <mail@thegeeklab.de>"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Natural Language :: English",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Utilities",
"Topic :: Software Development",
]
description = "Reviews ansible playbooks, roles and inventories and suggests improvements."
documentation = "https://ansible-later.geekdocs.de/"
homepage = "https://ansible-later.geekdocs.de/"
include = [
"LICENSE",
]
keywords = ["ansible", "code", "review"]
license = "MIT"
name = "ansible-later"
packages = [
{include = "ansiblelater"},
]
readme = "README.md"
repository = "https://github.com/thegeeklab/ansible-later/"
version = "0.0.0"
[tool.poetry.dependencies]
PyYAML = "^5.3.1"
anyconfig = "^0.9.11"
appdirs = "^1.4.4"
colorama = "^0.4.4"
flake8 = "^3.8.4"
jsonschema = "^3.2.0"
nested-lookup = "^0.2.21"
pathspec = "^0.8.1"
python = "^3.6.0"
python-json-logger = "^2.0.1"
six = "^1.15.0"
toolz = "^0.11.1"
unidiff = "^0.6.0"
yamllint = "^1.25.0"
ansible = {version = "^2.10.4", extras = ["ansible"]}
ansible-base = {version = "^2.10.4", extras = ["ansible-base"]}
[tool.poetry.dev-dependencies]
bandit = "^1.7.0"
flake8 = "^3.8.4"
flake8-blind-except = "^0.1.1"
flake8-builtins = "^1.5.3"
flake8-colors = "^0.1.9"
flake8-docstrings = "^1.5.0"
flake8-eradicate = "^1.0.0"
flake8-isort = "^4.0.0"
flake8-logging-format = "^0.6.0"
flake8-pep3101 = "^1.3.0"
flake8-polyfill = "^1.0.2"
flake8-quotes = "^3.2.0"
pep8-naming = "^0.11.1"
pydocstyle = "^5.1.1"
pytest = "^6.2.1"
pytest-cov = "^2.10.1"
pytest-mock = "^3.4.0"
wheel = "^0.36.2"
yapf = "^0.30.0"
[tool.poetry.scripts]
ansible-later = "ansiblelater.__main__:main"
[tool.poetry-dynamic-versioning]
enable = true
style = "semver"
vcs = "git"
[tool.isort]
default_section = "THIRDPARTY"
force_single_line = true
line_length = 99
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip_glob = ["**/.env*", "**/env/*", "**/docs/*"]
[tool.pytest.ini_options]
addopts = "--cov=ansiblelater --cov-report xml:coverage.xml --cov-append --no-cov-on-fail"
filterwarnings = [
"ignore::FutureWarning",
"ignore:.*collections.*:DeprecationWarning",
"ignore:.*pep8.*:FutureWarning",
]
[tool.coverage.run]
omit = ["**/test/*"]
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]

View File

@ -1,30 +0,0 @@
[metadata]
description-file = README.md
license_file = LICENSE
[bdist_wheel]
universal = 1
[isort]
default_section = THIRDPARTY
known_first_party = ansiblelater
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
force_single_line = true
line_length = 99
skip_glob = **/.env*,**/env/*,**/docs/*
[yapf]
based_on_style = google
column_limit = 99
dedent_closing_brackets = true
coalesce_brackets = true
split_before_logical_operator = true
[tool:pytest]
filterwarnings =
ignore::FutureWarning
ignore:.*collections.*:DeprecationWarning
ignore:.*pep8.*:FutureWarning
[coverage:run]
omit = **/test/*

View File

@ -1,69 +0,0 @@
#!/usr/bin/env python
"""Setup script for the package."""
import io
import os
import re
from setuptools import find_packages
from setuptools import setup
PACKAGE_NAME = "ansiblelater"
def get_property(prop, project):
current_dir = os.path.dirname(os.path.realpath(__file__))
result = re.search(
r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format(prop),
open(os.path.join(current_dir, project, "__init__.py")).read()
)
return result.group(1)
def get_readme(filename="README.md"):
this = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(this, filename), encoding="utf-8") as f:
long_description = f.read()
return long_description
setup(
name=get_property("__project__", PACKAGE_NAME),
description=("Reviews ansible playbooks, roles and inventories and suggests improvements."),
keywords="ansible code review",
version=get_property("__version__", PACKAGE_NAME),
author=get_property("__author__", PACKAGE_NAME),
author_email=get_property("__email__", PACKAGE_NAME),
url=get_property("__url__", PACKAGE_NAME),
license=get_property("__license__", PACKAGE_NAME),
long_description=get_readme(),
long_description_content_type="text/markdown",
packages=find_packages(exclude=["*.test", "test", "test.*"]),
package_data={"ansiblelater": ["data/*"]},
python_requires=">=3.5,<4",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Natural Language :: English",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Utilities",
"Topic :: Software Development",
],
include_package_data=True,
zip_safe=False,
install_requires=[
"ansible", "six", "pyyaml", "appdirs", "unidiff", "flake8", "yamllint", "nested-lookup",
"colorama", "anyconfig", "python-json-logger", "jsonschema", "pathspec", "toolz"
],
entry_points={"console_scripts": ["ansible-later = ansiblelater.__main__:main"]},
)