Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from ESSS/update-deps
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
cauebs authored Nov 14, 2023
2 parents 2e5c9bb + 5dafa5b commit 4b7dcf8
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 63 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Create a virtual environment for Python 3.10, activate it, then execute:

.. code-block:: console
pip install piptools
pip install pip-tools
pip-sync
pre-commit install
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-e file:.#egg=jenkins_to_github_notify
attrs
fastapi
github3.py
mypy
Expand Down
118 changes: 60 additions & 58 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,130 +1,132 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
#
-e file:.#egg=jenkins_to_github_notify
# via -r requirements.in
anyio==3.6.1
# via starlette
atomicwrites==1.4.1
# via pytest
attrs==21.4.0
# via pytest
certifi==2022.6.15
annotated-types==0.6.0
# via pydantic
anyio==3.7.1
# via
# fastapi
# starlette
attrs==23.1.0
# via -r requirements.in
certifi==2023.7.22
# via requests
cffi==1.15.1
cffi==1.16.0
# via cryptography
cfgv==3.3.1
cfgv==3.4.0
# via pre-commit
charset-normalizer==2.1.0
charset-normalizer==3.3.2
# via requests
click==8.1.3
click==8.1.7
# via uvicorn
colorama==0.4.5
# via
# click
# pytest
cryptography==37.0.4
cryptography==41.0.5
# via pyjwt
distlib==0.3.5
distlib==0.3.7
# via virtualenv
fastapi==0.79.0
exceptiongroup==1.1.3
# via
# anyio
# pytest
fastapi==0.104.1
# via -r requirements.in
filelock==3.7.1
filelock==3.13.1
# via virtualenv
github3-py==3.2.0
github3-py==4.0.1
# via -r requirements.in
h11==0.13.0
h11==0.14.0
# via uvicorn
identify==2.5.2
identify==2.5.31
# via pre-commit
idna==3.3
idna==3.4
# via
# anyio
# requests
iniconfig==1.1.1
iniconfig==2.0.0
# via pytest
multi-key-dict==2.0.3
# via python-jenkins
mypy==0.971
mypy==1.7.0
# via -r requirements.in
mypy-extensions==0.4.3
mypy-extensions==1.0.0
# via mypy
nodeenv==1.7.0
nodeenv==1.8.0
# via pre-commit
packaging==21.3
packaging==23.2
# via pytest
pbr==5.9.0
pbr==6.0.0
# via python-jenkins
platformdirs==2.5.2
platformdirs==3.11.0
# via virtualenv
pluggy==1.0.0
pluggy==1.3.0
# via pytest
pre-commit==2.20.0
pre-commit==3.5.0
# via -r requirements.in
py==1.11.0
# via pytest
pycparser==2.21
# via cffi
pydantic==1.9.1
pydantic==2.5.0
# via fastapi
pyjwt[crypto]==2.4.0
# via github3-py
pyparsing==3.0.9
# via packaging
pytest==7.1.2
pydantic-core==2.14.1
# via pydantic
pyjwt[crypto]==2.8.0
# via
# github3-py
# pyjwt
pytest==7.4.3
# via
# pytest-datadir
# pytest-mock
# pytest-regressions
pytest-datadir==1.3.1
pytest-datadir==1.5.0
# via pytest-regressions
pytest-mock==3.8.2
pytest-mock==3.12.0
# via -r requirements.in
pytest-regressions==2.3.1
pytest-regressions==2.5.0
# via -r requirements.in
python-dateutil==2.8.2
# via github3-py
python-dotenv==0.20.0
python-dotenv==1.0.0
# via -r requirements.in
python-jenkins==1.7.0
python-jenkins==1.8.2
# via -r requirements.in
pyyaml==6.0
pyyaml==6.0.1
# via
# pre-commit
# pytest-regressions
requests==2.28.1
requests==2.31.0
# via
# github3-py
# python-jenkins
six==1.16.0
# via
# python-dateutil
# python-jenkins
# virtualenv
sniffio==1.2.0
sniffio==1.3.0
# via anyio
starlette==0.19.1
starlette==0.27.0
# via fastapi
toml==0.10.2
# via pre-commit
tomli==2.0.1
# via
# mypy
# pytest
typing-extensions==4.3.0
typing-extensions==4.8.0
# via
# fastapi
# mypy
# pydantic
# pydantic-core
# uvicorn
uritemplate==4.1.1
# via github3-py
urllib3==1.26.10
urllib3==2.1.0
# via requests
uvicorn==0.18.2
uvicorn==0.24.0.post1
# via -r requirements.in
virtualenv==20.15.1
virtualenv==20.24.6
# via pre-commit

# The following packages are considered to be unsafe in a requirements file:
Expand Down
13 changes: 9 additions & 4 deletions src/jenkins_to_github_notify/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
delegating to other modules the actual work.
"""
import logging
from contextlib import asynccontextmanager
from typing import AsyncIterator

from dotenv import dotenv_values
from fastapi import FastAPI
Expand All @@ -14,13 +16,12 @@
from jenkins_to_github_notify.notify import validate_event
from jenkins_to_github_notify.notify import validate_secret

app = FastAPI()
config: dict[str, str] = {}
logger = logging.getLogger("app")
config: dict[str, str] = {}


@app.on_event("startup")
async def startup_event() -> None:
@asynccontextmanager
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
"""Fail early during startup in case any variable is missing."""
for key, value in dotenv_values(".env").items():
assert isinstance(value, str), f"Unexpected type in config value: {value!r} {type(value)}"
Expand All @@ -29,6 +30,10 @@ async def startup_event() -> None:
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)-8s")
logger.setLevel(logging.INFO)
logger.info("Configuration validated.")
yield


app = FastAPI(lifespan=lifespan)


@app.get("/jobs/notify")
Expand Down

0 comments on commit 4b7dcf8

Please sign in to comment.