Skip to content

Commit d098763

Browse files
authored
Modernised and cleaned up (#23)
* Upgraded to Python 3.10.5 container * Local backup * Modernised surroundings * We do need itsdangerous * Removed duplicate keyword * Adjusted path to badge * Added test dependencies * Migrations are part of the package again
1 parent 27029a4 commit d098763

File tree

19 files changed

+126
-174
lines changed

19 files changed

+126
-174
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: Build
99
env:
1010
MAJOR: 0
1111
MINOR: 0
12-
PYTHON_VERSION: 3.10.1
12+
PYTHON_VERSION: 3.11.0
1313

1414
#
1515
# Establish when the workflow is run
@@ -44,7 +44,7 @@ jobs:
4444
- name: Calculate Build Context
4545
run: |
4646
MRMAT_VERSION="${MAJOR}.${MINOR}.${GITHUB_RUN_NUMBER}"
47-
if [ "$GITHUB_EVENT_NAME" == 'pull_request_target' && GITHUB_BASE_REF == 'main']; then
47+
if [ "$GITHUB_EVENT_NAME" == 'pull_request_target' -a "$GITHUB_BASE_REF" == 'main' ]; then
4848
MRMAT_IS_RELEASE=true
4949
echo "::warning ::Building release ${MRMAT_VERSION}"
5050
echo "MRMAT_IS_RELEASE=true" >> $GITHUB_ENV
@@ -69,12 +69,10 @@ jobs:
6969

7070
- name: Build
7171
run: |
72-
export PYTHONUSERBASE=${HOME}/.local
73-
pip install --user wheel
7472
pip install --user -r requirements.txt
75-
${PYTHONUSERBASE}/bin/pylint ${GITHUB_WORKSPACE}/src/python/mrmat_python_api_flask
76-
PYTHONPATH=${GITHUB_WORKSPACE}/src/python python -m pytest --cov=mrmat_python_api_flask
77-
PYTHONPATH=${GITHUB_WORKSPACE} python -m build --wheel -n
73+
pylint ${GITHUB_WORKSPACE}/src/python/mrmat_python_api_flask
74+
PYTHONPATH=${GITHUB_WORKSPACE}/src/python python -m pytest
75+
python -m build --wheel -n
7876
7977
- name: Upload test results
8078
uses: actions/upload-artifact@v2

.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ coverage.xml
159159
.pytest_cache/
160160
pytestdebug.log
161161

162-
# Translations
163-
*.mo
164-
*.pot
165-
166162
# Django stuff:
167163
*.log
168164
local_settings.py
@@ -245,6 +241,3 @@ dmypy.json
245241
.prof
246242

247243
# End of https://www.toptal.com/developers/gitignore/api/jetbrains,python
248-
249-
250-
.coverage

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/mrmat-python-api-flask.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.pylintrc

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ disable=abstract-method,
9090
map-builtin-not-iterating,
9191
misplaced-comparison-constant,
9292
missing-function-docstring,
93-
missing-module-docstring,
9493
metaclass-assignment,
9594
next-method-called,
9695
next-method-defined,
@@ -147,6 +146,7 @@ disable=abstract-method,
147146
wrong-import-order,
148147
xrange-builtin,
149148
zip-builtin-not-iterating,
149+
missing-module-docstring
150150

151151

152152
[REPORTS]
@@ -156,12 +156,6 @@ disable=abstract-method,
156156
# mypackage.mymodule.MyReporterClass.
157157
output-format=text
158158

159-
# Put messages in a separate file for each module / package specified on the
160-
# command line instead of printing them on stdout. Reports (if any) will be
161-
# written in a file name "pylint_global.[txt|html]". This option is deprecated
162-
# and it will be removed in Pylint 2.0.
163-
files-output=no
164-
165159
# Tells whether to display a full report or only the messages
166160
reports=no
167161

@@ -280,12 +274,6 @@ ignore-long-lines=(?x)(
280274
# else.
281275
single-line-if-stmt=yes
282276

283-
# List of optional constructs for which whitespace checking is disabled. `dict-
284-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
285-
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
286-
# `empty-line` allows space-only lines.
287-
no-space-check=
288-
289277
# Maximum number of lines in a module
290278
max-module-lines=99999
291279

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 MrMatOrg
3+
Copyright (c) 2021 Mathieu Imfeld
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MrMat :: Python :: API :: Flask
22

3-
[![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)
3+
[![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)
44

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

SECURITY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
I'd be surprised if you'd want support for this. But be my guest raising an issue...
6+
7+
| Version | Supported |
8+
| ------- | ------------------ |
9+
| all | :white_check_mark: |
10+
11+
## Reporting a Vulnerability
12+
13+
Raise an issue straight on this repository.

pyproject.toml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
11
[build-system]
2-
requires = ['setuptools', 'wheel']
2+
requires = [
3+
'setuptools>=42.0.0',
4+
'wheel >= 0.36.0',
5+
'pylint~=2.15.5', # MIT
6+
'pytest~=7.2.0', # GPL-2.0-or-later
7+
'pytest-cov~=4.0.0', # MIT
8+
'pyjwt~=2.6.0', # MIT
9+
'python-keycloak~=2.6.0' # MIT
10+
]
311
build-backend = 'setuptools.build_meta'
12+
13+
[project]
14+
name = "mrmat-python-api-flask"
15+
description = "Boilerplate code for an API using Flask"
16+
urls = { "Sources" = "https://github.com/MrMatAP/mrmat-python-api-flask" }
17+
keywords = ["experimental"]
18+
readme = "README.md"
19+
license = { text = "MIT" }
20+
authors = [
21+
{ "name" = "Mathieu Imfeld", "email" = "[email protected]" }
22+
]
23+
maintainers = [
24+
{ "name" = "Mathieu Imfeld", "email" = "[email protected]" }
25+
]
26+
classifiers = [
27+
"Development Status :: 3 - Alpha",
28+
"License :: OSI Approved :: MIT",
29+
"Programming Language :: Python :: 3.11"
30+
]
31+
requires-python = ">=3.10"
32+
dependencies = [
33+
"rich~=12.6.0",
34+
"Flask~=2.2.2",
35+
"Flask-SQLAlchemy~=3.0.2",
36+
"Flask-Migrate~=4.0.0",
37+
"flask-smorest~=0.40.0",
38+
"Flask-Marshmallow~=0.14.0",
39+
"marshmallow-sqlalchemy~=0.28.1",
40+
"psycopg2-binary~=2.9.5",
41+
"Flask-OIDC~=1.4.0"
42+
]
43+
dynamic = ["version"]
44+
45+
[tool.setuptools.dynamic]
46+
version = { attr = "ci.version "}
47+
48+
[tool.setuptools.packages.find]
49+
where = ["src/python"]
50+
include = ["mrmat_python_api_flask*"]
51+
namespaces = true
52+
53+
[tool.setuptools.package-data]
54+
"*" = ["*.mo", "migrations/*", "templates/*", "static/*"]
55+
56+
[project.scripts]
57+
mrmat-python-api-flask = "mrmat_python_api_flask.cui:main"
58+
mrmat-python-api-flask-client = "mrmat_python_api_flask.client:main"
59+
60+
# If you are debugging your tests using PyCharm then comment out the coverage options
61+
# in addopts
62+
[tool.pytest.ini_options]
63+
minversion = "6.0"
64+
addopts = "--cov=mrmat_python_api_flask --cov-report=term --cov-report=xml:build/coverage.xml --junit-xml=build/junit.xml"
65+
testpaths = ["tests"]
66+
junit_family = "xunit2"
67+
log_cli = 1
68+
log_cli_level = "INFO"
69+
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
70+
log_cli_date_format="%Y-%m-%d %H:%M:%S"

0 commit comments

Comments
 (0)