www-data 1 year ago
parent
commit
aca35b03d4
  1. 2
      .flake8
  2. 3
      .gitignore
  3. 8
      CONTRIBUTING.md
  4. 37
      Dockerfile
  5. 16
      Makefile
  6. 73
      pyproject.toml
  7. 2
      superx_budget/pyramid/__init__.py

2
.flake8

@ -0,0 +1,2 @@
[flake8]
per-file-ignores = tests/*:S101

3
.gitignore vendored

@ -45,7 +45,6 @@ htmlcov/
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*,cover *,cover
mail/
# Translations # Translations
*.mo *.mo
@ -63,5 +62,3 @@ target/
# Mac Stuff # Mac Stuff
.DS_Store .DS_Store
# Pyramid
production.ini

8
CONTRIBUTING.md

@ -11,7 +11,7 @@ Types of Contributions
### Report Bugs ### Report Bugs
Report bugs at https://github.com/holgi/superx_budget/issues. Report bugs at https://git.cpi.imtek.uni-freiburg.de/CPI/superx-budget-overview.git/issues.
If you are reporting a bug, please include: If you are reporting a bug, please include:
@ -31,13 +31,13 @@ and "help wanted" is open to whoever wants to implement it.
### Write Documentation ### Write Documentation
superx_budget could always use more documentation, whether as part of the SuperX Budget could always use more documentation, whether as part of the
official superx_budget docs, in docstrings, or even on the web in blog posts, official SuperX Budget docs, in docstrings, or even on the web in blog posts,
articles, and such. articles, and such.
### Submit Feedback ### Submit Feedback
The best way to send feedback is to file an issue at https://github.com/holgi/superx_budget/issues. The best way to send feedback is to file an issue at https://git.cpi.imtek.uni-freiburg.de/CPI/superx-budget-overview.git/issues.
If you are proposing a feature: If you are proposing a feature:

37
Dockerfile

@ -0,0 +1,37 @@
FROM ubuntu:latest
# update to the latest packages
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get upgrade -y
# add user that will be used to install and run the application
RUN groupadd -g 1000 deploy
RUN useradd -m -u 1000 -g deploy deploy
# install required packages for debugging
# RUN apt-get install -y vim curl lsof
#
# CUSTOM PART IS BELOW HERE
#
# install required packages
RUN apt-get install -y python3 python3-pip
# switch to the created user and install the application
USER deploy
ENV PATH "$PATH:/home/deploy/.local/bin"
COPY . /app
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install gunicorn
RUN pip install wheel
RUN pip install flit
RUN flit install --pth-file
CMD ["gunicorn", "--paster", "/app/production.ini", "-b", "0.0.0.0:8000"]

16
Makefile

@ -51,16 +51,19 @@ clean-test: ## remove test and coverage artifacts
rm -fr htmlcov/ rm -fr htmlcov/
lint: ## reformat with black and check style with flake8 lint: ## reformat with black and check style with flake8
isort -rc superx_budget isort superx_budget
isort -rc tests isort tests
black superx_budget tests black superx_budget tests
flake8 superx_budget tests flake8 superx_budget tests
test: lint ## run tests quickly with the default Python test: lint ## run tests quickly with the default Python
pytest tests -x --disable-warnings -m "not app" pytest tests -x --disable-warnings -m "not fun"
testall: lint ## run tests quickly with the default Python
pytest tests
coverage: lint ## full test suite, check code coverage and open coverage report coverage: lint ## full test suite, check code coverage and open coverage report
pytest tests --cov=superx_budget pytest tests --cov=superx_budget -m "fun"
coverage html coverage html
$(BROWSER) htmlcov/index.html $(BROWSER) htmlcov/index.html
@ -73,12 +76,15 @@ install: ## install updated project.toml with flint
devenv: ## setup development environment devenv: ## setup development environment
python3 -m venv --prompt superx_budget .venv python3 -m venv --prompt superx_budget .venv
.venv/bin/pip3 install --upgrade pip .venv/bin/pip3 install --upgrade pip
.venv/bin/pip3 install flit .venv/bin/pip3 install "flit>3.2"
.venv/bin/flit install --pth-file .venv/bin/flit install --pth-file
repo: devenv ## complete project setup with development environment and git repo repo: devenv ## complete project setup with development environment and git repo
git init . git init .
git branch -m main
git add . git add .
git commit -m "import of project template" git commit -m "import of project template"
git remote add origin https://git.cpi.imtek.uni-freiburg.de/CPI/superx-budget-overview.git
git push -u origin main --no-verify
.venv/bin/pre-commit install --install-hooks .venv/bin/pre-commit install --install-hooks

73
pyproject.toml

@ -4,14 +4,17 @@
requires = ["flit"] requires = ["flit"]
build-backend = "flit.buildapi" build-backend = "flit.buildapi"
[tool.flit.metadata] [project]
module = "superx_budget" name = "superx_budget"
dist-name = "superx_budget" readme = "README.md"
author = "Holger Frey" description = "Creating a budget overview from a SuperX export."
author-email = "frey@imtek.de" license = { file = "LICENSE" }
home-page = "https://github.com/holgi/superx_budget" requires-python = ">=3.7"
description-file = "README.md" dynamic = ["version"]
license = "Beerware"
authors = [
{name = "Holger Frey", email = "frey@imtek.de"},
]
# see https://pypi.org/classifiers/ # see https://pypi.org/classifiers/
classifiers = [ classifiers = [
@ -23,47 +26,51 @@ classifiers = [
"License :: Freely Distributable", "License :: Freely Distributable",
] ]
requires = [ dependencies = [
"openpyxl >= 3.0.0", "openpyxl >= 3.0.0",
"pyramid >= 1.10", "pyramid >= 2.0",
"pyramid_jinja2 >= 2.7", "pyramid_jinja2",
"pyramid_mailer >= 0.15.1", "pyramid_mailer",
"waitress >= 1.4.3", "waitress",
"passlib[argon2]",
] ]
requires-python = ">=3.7"
[tool.flit.metadata.requires-extra] [project.entry-points."paste.app_factory"]
main = "superx_budget:main"
[project.urls]
Source = "https://git.cpi.imtek.uni-freiburg.de/CPI/superx-budget-overview.git"
[project.optional-dependencies]
test = [ test = [
"passlib[argon2] >= 1.7.2",
"pytest >=4.0.0", "pytest >=4.0.0",
"pytest-cov", "pytest-cov",
"pytest-mock", "pytest-mock",
"pytest-randomly",
"tox", "tox",
] ]
dev = [ dev = [
"black", "black",
"flake8", "flake8",
"flake8-comprehensions", "flake8-comprehensions",
"isort", "flake8-bandit",
"isort >= 5.0.0",
"keyring", "keyring",
"pre-commit", "pre-commit",
] ]
[tool.flit.entrypoints."paste.app_factory"]
main = "superx_budget:main"
[tool.black] [tool.black]
line-length = 79 line-length = 79
py37 = true target-version = ['py37','py38', 'py39']
include = '\.pyi?$' include = '\.pyi?$'
exclude = ''' extend-exclude = '''
/( # A regex preceded with ^/ will apply only to files and directories
\.git # in the root of the project.
| \.tox ^/.git
| \.venv ^/.tox
| build ^/.venv
| dist ^/.build
)/ ^/.dist
''' '''
[tool.isort] [tool.isort]
@ -71,3 +78,11 @@ line_length=79
multi_line_output=3 multi_line_output=3
length_sort="True" length_sort="True"
include_trailing_comma="True" include_trailing_comma="True"
[tool.pytest.ini_options]
markers = [
"fun: marks tests as functional (deselect with '-m \"not fun\"')",
]
addopts = [
"--strict-markers",
]

2
superx_budget/pyramid/__init__.py

@ -5,7 +5,7 @@ from pathlib import Path
from pyramid.view import notfound_view_config from pyramid.view import notfound_view_config
from pyramid.config import Configurator from pyramid.config import Configurator
from pyramid.session import JSONSerializer, SignedCookieSessionFactory from pyramid.session import JSONSerializer, SignedCookieSessionFactory
from pyramid.security import Allow, Everyone, Authenticated from pyramid.authorization import Allow, Everyone, Authenticated
from pyramid.httpexceptions import HTTPFound from pyramid.httpexceptions import HTTPFound
from ..overview import create_overview # noqa: F401 from ..overview import create_overview # noqa: F401

Loading…
Cancel
Save