Skip to content

Commit

Permalink
Merge pull request #202 from unicef/develop
Browse files Browse the repository at this point in the history
v2.1
  • Loading branch information
domdinicola authored Apr 4, 2023
2 parents 1a1125b + 28d1899 commit b731d15
Show file tree
Hide file tree
Showing 114 changed files with 3,070 additions and 2,076 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ max-line-length = 120

exclude =
*/migrations,

ignore =
W503,
# line break before binary operator
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
stages: [commit]
- repo: https://github.com/ambv/black
rev: 23.1.0
hooks:
- id: black
args: [--config=backend/pyproject.toml]
exclude: "migrations|snapshots"
stages: [commit]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config=backend/.flake8]
additional_dependencies: [flake8-bugbear==22.9.23]
stages: [ commit ]
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dist: xenial
dist: jammy
language: python

python:
- 3.9
- "3.11"

env:
global:
Expand All @@ -12,17 +12,18 @@ env:
- INSIGHT_URL=https://uniapis.unicef.org/biapi/v1/
- SHAREPOINT_CONNECTION=user
jobs:
- DJANGO=4.0
- DJANGO=4.1

services:
- postgres

addons:
postgresql: "10"
apt:
sources:
- sourceline: 'ppa:chris-lea/redis-server'
packages:
- postgresql-10
- postgresql-client-10

services:
- redis
- redis-tools
- redis-server

install:
- pip install tox codecov
Expand Down
14 changes: 11 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Release 2.1
----------------
* updated to python 3.11
* updated to django 4.2
* updated office365 2.4
* introduced black and precommit


Release 2.0.3
----------------
* update vaccine type metadata
* updated vaccine type metadata


Release 2.0.2
Expand Down Expand Up @@ -182,7 +190,7 @@ Release 0.6
----------------
* handled not by donor libraries
* allowed download of different file extentions (other than pdf)
* tweaked init-setup
* tweaked init_setup
* tweaked static-metadata
* added retracted field
* added tenant model
Expand Down Expand Up @@ -224,7 +232,7 @@ Release 0.2
* increased coverage
* added static endpoint (/api/metadata/static/)
* added business area endpoint (/api/roles/business-area/)
* tweaked init-setup
* tweaked init_setup
* added my profile API


Expand Down
10 changes: 6 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = "*"
coverage = "*"
drf-api-checker = "*"
factory-boy = "*"
Expand All @@ -14,6 +15,7 @@ ipython = "*"
isort = "*"
mock = "*"
pdbpp = "*"
pre_commit = "*"
pytest = "*"
pytest-coverage = "*"
pytest-django = "*"
Expand All @@ -33,7 +35,7 @@ bleach = {extras = ["css"],version = "*"}
celery = "*"
dj-database-url = "*"
dj-static = "*"
Django = "<4.1"
Django = "*"
django-adminactions = "*"
django-celery-beat = "*"
django-celery-email = "*"
Expand All @@ -53,10 +55,10 @@ djangorestframework-xml = "*"
django-rest-framework-social-oauth2 = "*"
gunicorn = "*"
newrelic = "*"
psycopg2-binary = "*"
psycopg2-binary = "*" # psycopg = "*"
sentry-sdk = "*"
requests = "*"
sharepoint-rest-api = "0.15"
sharepoint-rest-api = "*"
social-auth-app-django = "*"
social-auth-core = {extras = ["azuread"],version = "*"}
unicef-djangolib = "*"
Expand All @@ -68,4 +70,4 @@ uwsgi = "*"
django-picklefield = "*"

[requires]
python_version = "3.9"
python_version = "3.11"
1,705 changes: 1,001 additions & 704 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Troubleshoot
Get Started
--------------------
* populate your .env file from template .env_template
* python manage.py init-setup --all
* python manage.py init_setup --all


Development Release
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=2.0
ARG BASE_IMAGE=2.1

FROM unicef/donor-reporting-portal-backend:${BASE_IMAGE}-base

Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9.13-alpine3.16
FROM python:3.11.2-alpine3.16

ARG PIPENV_ARGS

Expand Down Expand Up @@ -55,11 +55,11 @@ RUN apk add --no-cache --virtual .postgis-rundeps-edge \
RUN apk add --no-cache --virtual .donor_reporting_portal-build-deps \
freetype-dev \
fontconfig-dev \
freetype-dev \
jpeg-dev \
lcms2-dev \
libffi-dev \
libressl-dev \
libc-dev \
libressl \
linux-headers \
musl-dev \
openjpeg-dev \
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.flat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9.13-alpine3.15
FROM python:3.11.2-alpine3.16

ARG BUILD_DATE
ARG PIPENV_ARGS
Expand Down Expand Up @@ -41,11 +41,11 @@ RUN apk add --no-cache --virtual .postgis-rundeps-edge \
RUN apk add --no-cache --virtual .donor_reporting_portal-build-deps \
freetype-dev \
fontconfig-dev \
freetype-dev \
jpeg-dev \
lcms2-dev \
libffi-dev \
libressl-dev \
libc-dev \
libressl \
linux-headers \
musl-dev \
openjpeg-dev \
Expand Down
2 changes: 1 addition & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DATABASE_URL?=
DOCKER_PASS?=
DOCKER_USER?=
TARGET?=2.0.0
TARGET?=2.1.0
BASE?=$(shell echo "${TARGET}" | sed "s/\([0-9]\)\.\([0-9]\)\.\(.*\)/\1.\2/g" )
# below vars are used internally
BUILD_OPTIONS?=
Expand Down
8 changes: 4 additions & 4 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ elif [[ "$*" == "beat" ]];then
--pidfile run/celerybeat.pid

elif [[ "$*" == "w2" ]];then
django-admin db-isready --wait --timeout 60
django-admin db_isready --wait --timeout 60

elif [[ "$*" == "donor_reporting_portal" ]];then
rm -f /var/donor_reporting_portal/run/*

django-admin diffsettings --output unified
# django-admin makemigrations --check --dry-run

django-admin db-isready --wait --timeout 60
django-admin db_isready --wait --timeout 60
django-admin check --deploy
django-admin remove_stale_contenttypes --noinput
django-admin init-setup --all --verbosity 2
django-admin db-isready --wait --timeout 300
django-admin init_setup --all --verbosity 2
django-admin db_isready --wait --timeout 300
echo "uwsgi --static-map ${STATIC_URL}=${STATIC_ROOT}"
# exec gosu donor_reporting_portal uwsgi --static-map ${STATIC_URL}=${STATIC_ROOT}
# newrelic-admin run-program
Expand Down
3 changes: 1 addition & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

SRC = os.path.abspath("src")
sys.path.insert(0, SRC)
if sys.argv[1] == 'test':
if sys.argv[1] == "test":
os.chdir(os.path.join(SRC, "donor_reporting_portal"))


if __name__ == "__main__":

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "donor_reporting_portal.config.settings")

from django.core.management import execute_from_command_line
Expand Down
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.black]
line-length = 120
exclude = '''
/(
\.git
| \.tox
| \.venv
| _build
| build
| dist
| migrations
)/
'''
41 changes: 20 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
from setuptools import find_packages, setup

ROOT = os.path.realpath(os.path.dirname(__file__))
init = os.path.join(ROOT, 'src', 'donor_reporting_portal', '__init__.py')
_version_re = re.compile(r'__version__\s+=\s+(.*)')
_name_re = re.compile(r'NAME\s+=\s+(.*)')
init = os.path.join(ROOT, "src", "donor_reporting_portal", "__init__.py")
_version_re = re.compile(r"__version__\s+=\s+(.*)")
_name_re = re.compile(r"NAME\s+=\s+(.*)")

sys.path.insert(0, os.path.join(ROOT, 'src'))
sys.path.insert(0, os.path.join(ROOT, "src"))

with open(init, 'rb') as f:
content = f.read().decode('utf-8')
with open(init, "rb") as f:
content = f.read().decode("utf-8")
VERSION = str(ast.literal_eval(_version_re.search(content).group(1)))
NAME = str(ast.literal_eval(_name_re.search(content).group(1)))

Expand All @@ -24,24 +24,23 @@
setup(
name=NAME,
version=VERSION,
author='UNICEF',
author_email='[email protected]',
url='',
description='',
long_description=open(os.path.join(ROOT, 'README.rst')).read(),
package_dir={'': 'src'},
packages=find_packages('src'),
author="UNICEF",
author_email="[email protected]",
url="",
description="",
long_description=open(os.path.join(ROOT, "README.rst")).read(),
package_dir={"": "src"},
packages=find_packages("src"),
zip_safe=False,
dependency_links=list(dependency_links),
license='BSD',
license="BSD",
include_package_data=True,
classifiers=[
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Framework :: Django',
'Framework :: Django :: 4.0',
'Framework :: Flake8',
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Framework :: Django",
"Framework :: Django :: 4.0",
"Framework :: Flake8",
],
)
4 changes: 2 additions & 2 deletions src/donor_reporting_portal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME = 'donor-reporting-portal'
VERSION = __version__ = '2.0.3'
NAME = "donor-reporting-portal"
VERSION = __version__ = "2.1"
Loading

0 comments on commit b731d15

Please sign in to comment.