Skip to content

Commit

Permalink
global: addition of annual-reports
Browse files Browse the repository at this point in the history
  • Loading branch information
drjova committed Oct 27, 2023
1 parent d68487b commit b22d3dd
Show file tree
Hide file tree
Showing 23 changed files with 2,422 additions and 9 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203, E704
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
directory:
- matomo-api
- Library-Notification-Service
- annual-reports
2 changes: 2 additions & 0 deletions .github/workflows/push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ jobs:
image-name: cern-sis/matomo-api
- directory: Library-Notification-Service
image-name: cern-sis/library-notifications-service
- directory: annual-reports
image-name: cern-sis/annual-reports
3 changes: 3 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
if [ ${{ inputs.directory }} == 'matomo-api' ]; then
docker-compose -f matomo-api/docker-compose-tests.yaml up -d
fi
if [ ${{ inputs.directory }} == 'annual-reports' ]; then
docker-compose -f annual-reports/docker-compose.yml up -d
fi
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.DS_Store
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile=black
known_third_party = api,backoff,cli,click,freezegun,models,psycopg2,pytest,requests,sqlalchemy,structlog
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ repos:
- id: check-added-large-files
- id: flake8

- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.1
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: seed-isort-config

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.20
hooks:
- id: isort
- id: isort

- repo: https://github.com/python/black
rev: stable
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion Library-Notification-Service/.python-version

This file was deleted.

21 changes: 21 additions & 0 deletions annual-reports/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.8

WORKDIR /matomo

ENV PATH="/root/.local/bin:${PATH}"
ENV PYTHONBUFFERED=0 \
POETRY_VIRTUALENVS_CREATE=false


ARG POETRY_VERSION
ENV POETRY_VERSION="${POETRY_VERSION:-1.6.1}"
RUN curl -sSL https://install.python-poetry.org \
| python3 - --git https://github.com/python-poetry/poetry.git#{$POETRY_VERSION} \
&& poetry --version


COPY poetry.lock pyproject.toml ./
COPY src ./src

RUN poetry install
CMD poetry run python src/cli.py
24 changes: 24 additions & 0 deletions annual-reports/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Annual Reports

## Installation
```
poetry install
docker-compose up -d
export DB_PASSWORD=annual
export DB_USER=annual
export DB_NAME=annual
export DB_HOST=localhost
export DB_PORT=5432
```

## Run
### With specific years
```
poetry run python src/cli.py -y 2022 -y 2023
```

### For all years
```
poetry run python src/cli.py
```
12 changes: 12 additions & 0 deletions annual-reports/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.1'

services:
db:
ports:
- "5432:5432"
image: postgres:14
restart: always
environment:
POSTGRES_PASSWORD: annual
POSTGRES_USER: annual
POSTGRES_DB: annual
1,183 changes: 1,183 additions & 0 deletions annual-reports/poetry.lock

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions annual-reports/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[tool.poetry]
name = "Annual Reports"
version = "0.1.0"
description = ""
authors = ["CERN SIS TS"]
packages = [
{ include = "*", from = "src" },
]

[tool.poetry.dependencies]
python = "^3.8"
requests = "^2.31.0"
click = "^8.1.7"
pytest = "^7.4.2"
pytest-vcr = "^1.0.2"
urllib3 = "1.26.7"
freezegun = "^1.2.2"
sqlalchemy = "^2.0.22"
sqlalchemy-utils = "^0.41.1"
structlog = "^23.2.0"
backoff = "^2.2.1"
psycopg2 = "^2.9.9"

[tool.poetry.dev-dependencies]

[tool.poetry.group.dev.dependencies]
ipdb = "^0.13.13"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Empty file added annual-reports/src/__init__.py
Empty file.
Loading

0 comments on commit b22d3dd

Please sign in to comment.