Commit ca4f0b83 authored by Anders Lindh Olsson's avatar Anders Lindh Olsson 🎱
Browse files

Merge branch 'e3-795_improve_packaging' into 'master'

E3-795: Improve packaging

See merge request !1
parents f84e504b e0174e49
Pipeline #114874 passed with stages
in 11 minutes and 17 seconds
[flake8]
# E501: let black handle line length
# W503 is incompatible with PEP 8
ignore = E501,W503
......@@ -3,12 +3,12 @@ repos:
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v0.961
hooks:
- id: mypy
additional_dependencies:
......@@ -24,3 +24,9 @@ repos:
exclude: tests/|pyproject.toml|setup.py
additional_dependencies:
- toml
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
"""Module for the main application."""
import logging
import sentry_sdk
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
from . import pipelines, recipe_mr
from .bot import GitLabBot
from . import settings
from conda_bot import pipelines, recipe_mr, settings
from conda_bot.bot import GitLabBot
uvicorn_logger = logging.getLogger("uvicorn.error")
logger = logging.getLogger("conda_bot")
......
"""Module for the Starlette bot."""
from typing import Any, Optional, Sequence, Union
import cachetools
import httpx
import gidgetlab
import gidgetlab.abc
import gidgetlab.routing
from typing import Any, Optional, Sequence, Union
from starlette.datastructures import Secret
import httpx
from gidgetlab import httpx as gl_httpx
from gidgetlab import sansio
from starlette.applications import Starlette
from starlette.responses import Response, PlainTextResponse
from starlette.requests import Request
from starlette.routing import Route
from starlette.background import BackgroundTask
from starlette.datastructures import Secret
from starlette.exceptions import HTTPException
from gidgetlab import sansio
from gidgetlab import httpx as gl_httpx
from starlette.requests import Request
from starlette.responses import PlainTextResponse, Response
from starlette.routing import Route
class GitLabBot(Starlette):
......
"""Module for interacting with pipeline hooks."""
import gidgetlab.routing
from typing import Any
import gidgetlab.routing
from gidgetlab.abc import GitLabAPI
from gidgetlab.sansio import Event
from gidgetlab_cli.models import Project
from .tasks import trigger_reverse_dependencies_pipelines
from conda_bot.tasks import trigger_reverse_dependencies_pipelines
router = gidgetlab.routing.Router()
......
"""Module for manipulating merge requests."""
import gidgetlab.routing
from typing import Any
import gidgetlab.routing
from gidgetlab.abc import GitLabAPI
from gidgetlab.sansio import Event
from gidgetlab_cli.models import Project
from .tasks import create_recipe_merge_request
from .settings import EXCLUDE_RECIPE_MR_PROJECTS
from conda_bot.settings import EXCLUDE_RECIPE_MR_PROJECTS
from conda_bot.tasks import create_recipe_merge_request
router = gidgetlab.routing.Router()
......
"""Module for storing as well as loading settings."""
from starlette.config import Config
from starlette.datastructures import Secret, URL, CommaSeparatedStrings
from starlette.datastructures import URL, CommaSeparatedStrings, Secret
config = Config(".env")
......
"""Module for tasks used by other functions in this package."""
import logging
from packaging.version import Version, InvalidVersion
from gidgetlab.httpx import GitLabAPI
from gidgetlab_cli.models import Project
from gidgetlab_cli import api
from . import util
from .settings import (
from gidgetlab_cli.models import Project
from packaging.version import InvalidVersion, Version
from conda_bot import util
from conda_bot.settings import (
CONDA_CHANNEL,
CONDA_PLATFORM,
RECIPE_NAMESPACE,
......
......@@ -2,20 +2,21 @@
import hashlib
import io
import re
import httpx
import logging
import re
from typing import Any, Dict, List, Optional
import conda.exports
import httpx
import networkx
from typing import List, Dict, Any, Optional
from pydantic import BaseModel
from gidgetlab import GitLabException
from gidgetlab.httpx import GitLabAPI
from ruamel_yaml import YAML
from gidgetlab_cli.models import Project, GitLabId
from gidgetlab_cli import api
from .exceptions import InvalidRecipe
from gidgetlab_cli.models import GitLabId, Project
from pydantic import BaseModel
from ruamel_yaml import YAML
from conda_bot.exceptions import InvalidRecipe
logger = logging.getLogger(__name__)
......
......@@ -2,5 +2,5 @@
target_version = ['py37']
[build-system]
requires = ["setuptools >= 42", "wheel", "setuptools_scm[toml]>=3.4"]
requires = ["setuptools >= 42", "wheel"]
build-backend = "setuptools.build_meta"
[bdist_wheel]
universal = 1
[metadata]
name = conda-bot
author = Benjamin Bertrand
description = GitLab bot to manage conda repositories
url = https://gitlab.esss.lu.se/ics-infrastructure/conda-bot
license = MIT license
version = 0.8.1
keywords = gitlab
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
[options]
packages = find:
zip_safe = False
include_package_data = True
python_requires = >=3.8
install_requires =
aiocache
cachetools
gidgetlab[httpx]
gunicorn
networkx
pydantic
sentry-sdk
starlette
uvicorn
[options.extras_require]
tests =
pytest>=3.0.0
pytest-cov
pytest-asyncio
pytest-mock
respx==0.15.1
[flake8]
exclude = docs
# E501,E203: black
# W503: PEP8
ignore = E501, W503, E203
[mypy]
plugins = pydantic.mypy
......
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
# This file exists only to support editable mode
from setuptools import setup
requirements = [
"aiocache",
"cachetools",
"gidgetlab[httpx]",
"gunicorn",
"networkx",
"pydantic",
"sentry-sdk",
"starlette",
"uvicorn",
]
test_requirements = [
"pytest>=3.0.0",
"pytest-cov",
"pytest-asyncio",
"pytest-mock",
"respx==0.15.1",
]
setup(
name="conda-bot",
author="Benjamin Bertrand",
author_email="benjamin.bertrand@ess.eu",
description="GitLab bot to manage conda repositories",
url="https://gitlab.esss.lu.se/ics-infrastructure/conda-bot",
license="MIT license",
version="0.8.0",
install_requires=requirements,
tests_require=test_requirements,
packages=find_packages(exclude=("tests", "tests.*")),
include_package_data=True,
keywords="gitlab",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
extras_require={"tests": test_requirements},
python_requires=">=3.8.0",
)
setup()
from conda_bot.app import app
from starlette.testclient import TestClient
from conda_bot.app import app
def test_dummy_webhook():
"""Check that the bot can process a webhook request"""
......
import pytest
import gidgetlab.routing
from unittest.mock import Mock
import gidgetlab.routing
import pytest
from starlette.testclient import TestClient
from conda_bot.bot import GitLabBot
......
import pytest
from gidgetlab import sansio
from conda_bot import pipelines
from gidgetlab_cli.models import Project
from conda_bot import pipelines
from .utils import FakeGitLab
......
import pytest
from gidgetlab import sansio
from gidgetlab_cli.models import Project
from conda_bot import recipe_mr
from .utils import FakeGitLab
......
import logging
import pytest
from gidgetlab_cli.models import Project
from conda_bot import tasks
from .utils import FakeGitLab
......
import pytest
import networkx
from pathlib import Path
import httpx
import networkx
import pytest
import respx
from pathlib import Path
from ruamel_yaml import YAML
from gidgetlab_cli.models import Project
from conda_bot import util, exceptions
from .utils import FakeGitLab
from ruamel_yaml import YAML
from conda_bot import exceptions, util
from .utils import FakeGitLab
TEST_REPO = Path(__file__).parent.resolve() / "data" / "conda_repo"
TEST_CHANNEL = f"file://{TEST_REPO}"
......
"""Utilities for tests"""
import json
import urllib
import pathlib
import urllib
SAMPLES_PATH = pathlib.Path(__file__).parent / "data" / "samples"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment