ci: added linting config & pipeline; renamed project to aiovieter
ci/woodpecker/push/lint Pipeline failed
Details
ci/woodpecker/push/lint Pipeline failed
Details
parent
242d685a6c
commit
e9a189b309
|
@ -1,3 +1,4 @@
|
|||
.venv/
|
||||
__pycache__/
|
||||
main.py
|
||||
*.egg-info/
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
branches:
|
||||
exclude: [ main ]
|
||||
platform: 'linux/amd64'
|
||||
|
||||
pipeline:
|
||||
lint:
|
||||
image: 'python:alpine'
|
||||
commands:
|
||||
- pip install -e .[lint]
|
||||
- flake8 aiovieter
|
13
Makefile
13
Makefile
|
@ -1,13 +1,22 @@
|
|||
PYTHON ?= python3
|
||||
VENV ?= .venv
|
||||
SRC_DIR = aiovieter
|
||||
|
||||
.PHONY: venv
|
||||
venv: $(VENV)/bin/activate
|
||||
$(VENV)/bin/activate: requirements.txt
|
||||
$(VENV)/bin/activate: setup.py setup.cfg
|
||||
rm -rf '$(VENV)'
|
||||
'$(PYTHON)' -m venv '$(VENV)'
|
||||
'$(VENV)'/bin/pip install -r requirements.txt
|
||||
'$(VENV)'/bin/pip install -e .[develop]
|
||||
|
||||
.PHONY: shell
|
||||
shell: venv
|
||||
@ '$(VENV)'/bin/python
|
||||
|
||||
.PHONY: lint
|
||||
lint: venv
|
||||
'$(VENV)/bin/flake8' '$(SRC_DIR)'
|
||||
|
||||
.PHONY: format
|
||||
format: venv
|
||||
'$(VENV)/bin/black' '$(SRC_DIR)'
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
from .vieter import Vieter
|
||||
|
||||
__all__ = ('Vieter')
|
||||
__all__ = "Vieter"
|
|
@ -0,0 +1,8 @@
|
|||
class VieterBuildLogs:
|
||||
def __init__(self, vieter):
|
||||
self._vieter = vieter
|
||||
|
||||
async def list(self, offset: int = 0, limit: int = 25):
|
||||
params = {"offset": offset, "limit": limit}
|
||||
|
||||
return await self._vieter._get("/api/logs", params=params)
|
|
@ -0,0 +1,8 @@
|
|||
class VieterRepos:
|
||||
def __init__(self, vieter):
|
||||
self._vieter = vieter
|
||||
|
||||
async def list(self, offset: int = 0, limit: int = 25):
|
||||
params = {"offset": offset, "limit": limit}
|
||||
|
||||
return await self._vieter._get("/api/repos", params=params)
|
|
@ -1,16 +1,19 @@
|
|||
import aiohttp
|
||||
|
||||
from .repos import VieterRepos
|
||||
from .logs import VieterBuildLogs
|
||||
|
||||
|
||||
class Vieter:
|
||||
def __init__(self, address: str, api_key: str) -> None:
|
||||
self._address = address
|
||||
self._api_key = api_key
|
||||
self._client = aiohttp.ClientSession(
|
||||
base_url=address, headers={'X-Api-Key': api_key}
|
||||
base_url=address, headers={"X-Api-Key": api_key}
|
||||
)
|
||||
|
||||
self.repos = VieterRepos(self)
|
||||
self.logs = VieterBuildLogs(self)
|
||||
|
||||
async def close(self):
|
||||
await self._client.close()
|
||||
|
@ -20,4 +23,4 @@ class Vieter:
|
|||
return await res.json()
|
||||
|
||||
async def _get(self, *args, **kwargs):
|
||||
return await self._do_req('GET', *args, **kwargs)
|
||||
return await self._do_req("GET", *args, **kwargs)
|
|
@ -1,2 +0,0 @@
|
|||
aiohttp
|
||||
aiodns
|
|
@ -0,0 +1,14 @@
|
|||
[options]
|
||||
install_requires =
|
||||
aiohttp
|
||||
|
||||
[options.extras_require]
|
||||
# Used inside tox for linting
|
||||
lint =
|
||||
black==22.3.0
|
||||
flake8==4.0.1
|
||||
flake8-black==0.3.3
|
||||
# Required for the developer
|
||||
develop =
|
||||
%(lint)s
|
||||
jedi
|
|
@ -0,0 +1,8 @@
|
|||
from setuptools import setup
|
||||
setup(
|
||||
name="aiovieter",
|
||||
version="0.1.0",
|
||||
author="Jef Roosens",
|
||||
description="Wrapper around the Vieter API.",
|
||||
packages=["aiovieter"],
|
||||
)
|
|
@ -1,11 +0,0 @@
|
|||
class VieterRepos:
|
||||
def __init__(self, vieter):
|
||||
self._vieter = vieter
|
||||
|
||||
async def list(self, offset: int = 0, limit: int = 25):
|
||||
params = {
|
||||
'offset': offset,
|
||||
'limit': limit
|
||||
}
|
||||
|
||||
return await self._vieter._get('/api/repos', params=params)
|
Loading…
Reference in New Issue