Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Build
env:
MAJOR: 0
MINOR: 0
PYTHON_VERSION: 3.10.1
PYTHON_VERSION: 3.11.0

#
# Establish when the workflow is run
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Calculate Build Context
run: |
MRMAT_VERSION="${MAJOR}.${MINOR}.${GITHUB_RUN_NUMBER}"
if [ "$GITHUB_EVENT_NAME" == 'pull_request_target' && GITHUB_BASE_REF == 'main']; then
if [ "$GITHUB_EVENT_NAME" == 'pull_request_target' -a "$GITHUB_BASE_REF" == 'main' ]; then
MRMAT_IS_RELEASE=true
echo "::warning ::Building release ${MRMAT_VERSION}"
echo "MRMAT_IS_RELEASE=true" >> $GITHUB_ENV
Expand All @@ -69,12 +69,10 @@ jobs:

- name: Build
run: |
export PYTHONUSERBASE=${HOME}/.local
pip install --user wheel
pip install --user -r requirements.txt
${PYTHONUSERBASE}/bin/pylint ${GITHUB_WORKSPACE}/mrmat_python_api_flask
PYTHONPATH=${GITHUB_WORKSPACE} python -m pytest --cov=mrmat_python_api_flask
PYTHONPATH=${GITHUB_WORKSPACE} python -m build --wheel -n
pylint ${GITHUB_WORKSPACE}/src/python/mrmat_python_api_flask
PYTHONPATH=${GITHUB_WORKSPACE}/src/python python -m pytest
python -m build --wheel -n

- name: Upload test results
uses: actions/upload-artifact@v2
Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ coverage.xml
.pytest_cache/
pytestdebug.log

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
Expand Down Expand Up @@ -245,6 +241,3 @@ dmypy.json
.prof

# End of https://www.toptal.com/developers/gitignore/api/jetbrains,python


.coverage
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/mrmat-python-api-flask.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/pylint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions .idea/runConfigurations/docker__nostromo_.xml

This file was deleted.

24 changes: 24 additions & 0 deletions .idea/runConfigurations/lint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ disable=abstract-method,
wrong-import-order,
xrange-builtin,
zip-builtin-not-iterating,
missing-module-docstring


[REPORTS]
Expand All @@ -155,12 +156,6 @@ disable=abstract-method,
# mypackage.mymodule.MyReporterClass.
output-format=text

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]". This option is deprecated
# and it will be removed in Pylint 2.0.
files-output=no

# Tells whether to display a full report or only the messages
reports=no

Expand Down Expand Up @@ -279,12 +274,6 @@ ignore-long-lines=(?x)(
# else.
single-line-if-stmt=yes

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=

# Maximum number of lines in a module
max-module-lines=99999

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 MrMatOrg
Copyright (c) 2021 Mathieu Imfeld

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MrMat :: Python :: API :: Flask

[![Build](https://github.com/MrMatOrg/mrmat-python-api-flask/actions/workflows/build.yml/badge.svg)](https://github.com/MrMatOrg/mrmat-python-api-flask/actions/workflows/build.yml)
[![Build](https://github.com/MrMatAP/mrmat-python-api-flask/actions/workflows/build.yml/badge.svg)](https://github.com/MrMatAP/mrmat-python-api-flask/actions/workflows/build.yml)

Boilerplate (and playground) for a code-first Python Flask API, with all the bells and whistles we've come to expect:

Expand Down Expand Up @@ -84,8 +84,8 @@ You have the choice of running this
You can, of course, run this as a Flask app straight from the project directory:

```shell
$ export FLASK_APP=mrmat_python_api_flask
$ flask run
$ cd src/python
$ FLASK_APP=mrmat_python_api_flask flask run
* Serving Flask app 'mrmat_python_api_flask' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Expand Down Expand Up @@ -355,4 +355,4 @@ following form. The DISCOVERY_URL must point to the URL where the IdP publishes
}
```

>The client requires configuration with OIDC secrets and currently implements the Device code flow
>The client requires configuration with OIDC secrets and currently implements the Device code flow
13 changes: 13 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported Versions

I'd be surprised if you'd want support for this. But be my guest raising an issue...

| Version | Supported |
| ------- | ------------------ |
| all | :white_check_mark: |

## Reporting a Vulnerability

Raise an issue straight on this repository.
69 changes: 68 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
[build-system]
requires = ['setuptools', 'wheel']
requires = [
'setuptools>=42.0.0',
'wheel >= 0.36.0',
'pylint~=2.15.5', # MIT
'pytest~=7.2.0', # GPL-2.0-or-later
'pytest-cov~=4.0.0', # MIT
'pyjwt~=2.6.0', # MIT
'python-keycloak~=2.6.0' # MIT
]
build-backend = 'setuptools.build_meta'

[project]
name = "mrmat-python-api-flask"
description = "Boilerplate code for an API using Flask"
urls = { "Sources" = "https://github.com/MrMatAP/mrmat-python-api-flask" }
keywords = ["experimental"]
readme = "README.md"
license = { text = "MIT" }
authors = [
{ "name" = "Mathieu Imfeld", "email" = "imfeldma+9jqerw@gmail.com" }
]
maintainers = [
{ "name" = "Mathieu Imfeld", "email" = "imfeldma+9jqerw@gmail.com" }
]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT",
"Programming Language :: Python :: 3.11"
]
requires-python = ">=3.10"
dependencies = [
"rich~=12.6.0",
"Flask~=2.2.2",
"Flask-SQLAlchemy~=3.0.2",
"Flask-Migrate~=4.0.0",
"flask-smorest~=0.40.0",
"Flask-Marshmallow~=0.14.0",
"marshmallow-sqlalchemy~=0.28.1",
"psycopg2-binary~=2.9.5",
"Flask-OIDC~=1.4.0"
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = { attr = "ci.version "}

[tool.setuptools.packages.find]
where = ["src/python"]
include = ["mrmat_python_api_flask*"]
namespaces = true

[tool.setuptools.package-data]
"*" = ["*.mo", "migrations/*", "templates/*", "static/*"]

[project.scripts]
mrmat-python-api-flask = "mrmat_python_api_flask.cui:main"
mrmat-python-api-flask-client = "mrmat_python_api_flask.client:main"

# If you are debugging your tests using PyCharm then comment out the coverage options
# in addopts
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--cov=mrmat_python_api_flask --cov-report=term --cov-report=xml:build/coverage.xml --junit-xml=build/junit.xml"
testpaths = ["tests"]
junit_family = "xunit2"
log_cli = 1
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format="%Y-%m-%d %H:%M:%S"
12 changes: 0 additions & 12 deletions pytest.ini

This file was deleted.

33 changes: 18 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@

# Build/Test requirements

build~=0.7.0 # MIT
wheel~=0.37.1 # MIT
pylint~=2.12.2 # GPL-2.0-or-later
pytest~=7.0.1 # MIT
pytest-cov~=3.0.0 # MIT
pyjwt~=2.3.0 # MIT
python-keycloak~=0.27.0 # MIT
setuptools>=42.0.0
build>=0.9.0 # MIT
wheel>=0.36.0 # MIT
pylint~=2.15.5 # MIT
pytest~=7.2.0 # GPL-2.0-or-later
pytest-cov~=4.0.0 # MIT
pyjwt~=2.6.0 # MIT
python-keycloak~=2.6.0 # MIT

# Runtime requirements

rich~=11.2.0 # MIT
Flask~=2.0.3 # BSD 3-Clause
Flask-SQLAlchemy~=2.5.1 # BSD 3-Clause
Flask-Migrate~=3.1.0 # MIT
flask-smorest~=0.37.0 # MIT
rich~=12.6.0 # MIT
Flask~=2.2.2 # BSD 3-Clause
Flask-SQLAlchemy~=3.0.2 # BSD 3-Clause
Flask-Migrate~=4.0.0 # MIT
flask-smorest~=0.40.0 # MIT
Flask-Marshmallow~=0.14.0 # MIT
marshmallow-sqlalchemy~=0.27.0 # MIT
psycopg2-binary~=2.9.3 # LGPL with exceptions
marshmallow-sqlalchemy~=0.28.1 # MIT
psycopg2-binary~=2.9.5 # LGPL with exceptions
Flask-OIDC~=1.4.0 # MIT
requests_oauthlib~=1.3.1 # ISC

# Do we need these?
#requests_oauthlib~=1.3.1 # ISC
itsdangerous<=2.0.1 # BSD 3-Clause Must affix so JSONWebSignatureSerializer is known
Loading