diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..ef9877f --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +per-file-ignores = tests/*:S101 diff --git a/.gitignore b/.gitignore index b246fb3..1d77a72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,3 @@ -# current database, edited all the time -ordr3.sqlite - -# production.ini and secrets -production.ini - -# development mail folder -mail/ - # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Makefile b/Makefile index e94ea94..8c6d3f6 100644 --- a/Makefile +++ b/Makefile @@ -57,23 +57,16 @@ lint: ## reformat with black and check style with flake8 flake8 ordr3 tests test: lint ## run tests quickly with the default Python - pytest tests -x --disable-warnings -m "not app" - -functest: lint ## run functional tests quickly with the default Python - pytest tests/functional -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 - pytest tests --cov=ordr3 - coverage html - $(BROWSER) htmlcov/index.html - -funcoverage: lint ## only functional test suite, check code coverage and open coverage report - pytest tests/functional --cov=ordr3 + pytest tests --cov=ordr3 -m "fun" coverage html $(BROWSER) htmlcov/index.html - tox: ## run fully isolated tests with tox tox @@ -83,12 +76,15 @@ install: ## install updated project.toml with flint devenv: ## setup development environment python3 -m venv --prompt ordr3 .venv .venv/bin/pip3 install --upgrade pip - .venv/bin/pip3 install flit + .venv/bin/pip3 install "flit>3.2" .venv/bin/flit install --pth-file repo: devenv ## complete project setup with development environment and git repo git init . + git branch -m main git add . git commit -m "import of project template" - + git remote add origin https://git.cpi.imtek.uni-freiburg.de/CPI/ordr3.git + git push -u origin main --no-verify + .venv/bin/pre-commit install --install-hooks diff --git a/pyproject.toml b/pyproject.toml index 3d96945..145b492 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,14 +4,17 @@ requires = ["flit"] build-backend = "flit.buildapi" -[tool.flit.metadata] -module = "ordr3" -dist-name = "ordr3" -author = "Holger Frey" -author-email = "frey@imtek.de" -home-page = "https://github.com/holgi/ordr3" -description-file = "README.md" -license = "Beerware" +[project] +name = "ordr3" +readme = "README.md" +description = "Our custom ordering system" +license = { file = "LICENSE" } +requires-python = ">=3.7" +dynamic = ["version"] + +authors = [ + {name = "Holger Frey", email = "frey@imtek.de"}, +] # see https://pypi.org/classifiers/ classifiers = [ @@ -23,58 +26,58 @@ classifiers = [ "License :: Freely Distributable", ] -requires = [ - "deform >= 2.0.8", - "passlib[argon2,bcrypt] >= 1.7.2", - "pyramid >= 1.10", - "pyramid_debugtoolbar >= 4.6.1", - "pyramid_jinja2 >= 2.7", - "pyramid_mailer >= 0.15.1", - "pyramid_tm >= 2.4", - "pyramid_retry >= 2.1", - "requests >= 2.23.0", - "sqlalchemy >= 1.3.15", +dependencies = [ + "deform", + "passlib[argon2,bcrypt] >= 1.7", + "pyramid >= 2.0", + "pyramid_debugtoolbar", + "pyramid_jinja2", + "pyramid_mailer", + "pyramid_tm", + "pyramid_retry", + "requests >= 2.23", + "sqlalchemy", "transaction >= 3.0.0", - "waitress >= 1.4.3", - "zope.sqlalchemy >= 1.3", + "waitress", + "zope.sqlalchemy", ] -requires-python = ">=3.7" -[tool.flit.metadata.requires-extra] +[project.urls] +Source = "https://git.cpi.imtek.uni-freiburg.de/CPI/ordr3.git" + +[project.entry-points."paste.app_factory"] +main = "ordr3:main" + +[project.optional-dependencies] test = [ "pytest >=4.0.0", "pytest-cov", "pytest-mock", + "pytest-randomly", "tox", - "WebTest >= 2.0.34", ] dev = [ "black", "flake8", "flake8-comprehensions", + "flake8-bandit", "isort >= 5.0.0", "keyring", "pre-commit", ] -[tool.flit.scripts] -migrate = "ordr3.scripts.migrate_db:main" - -[tool.flit.entrypoints."paste.app_factory"] -main = "ordr3:main" - [tool.black] line-length = 79 -py37 = true +target-version = ['py37','py38', 'py39'] include = '\.pyi?$' -exclude = ''' -/( - \.git - | \.tox - | \.venv - | build - | dist -)/ +extend-exclude = ''' +# A regex preceded with ^/ will apply only to files and directories +# in the root of the project. +^/.git +^/.tox +^/.venv +^/.build +^/.dist ''' [tool.isort] @@ -82,3 +85,11 @@ line_length=79 multi_line_output=3 length_sort="True" include_trailing_comma="True" + +[tool.pytest.ini_options] +markers = [ + "fun: marks tests as functional (deselect with '-m \"not fun\"')", +] +addopts = [ + "--strict-markers", +] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 170399a..0000000 --- a/requirements.txt +++ /dev/null @@ -1,87 +0,0 @@ -appdirs==1.4.4 -argon2-cffi==20.1.0 -attrs==20.2.0 -bcrypt==3.2.0 -beautifulsoup4==4.9.3 -black==20.8b1 -certifi==2020.6.20 -cffi==1.14.3 -cfgv==3.2.0 -Chameleon==3.8.1 -chardet==3.0.4 -click==7.1.2 -colander==1.8.2 -coverage==5.3 -cryptography==3.1.1 -deform==2.0.14 -distlib==0.3.1 -docutils==0.16 -filelock==3.0.12 -flake8==3.8.4 -flake8-comprehensions==3.2.3 -flit==3.0.0 -flit-core==3.0.0 -hupper==1.10.2 -identify==1.5.5 -idna==2.10 -iniconfig==1.0.1 -iso8601==0.1.13 -isort==5.5.4 -jeepney==0.4.3 -Jinja2==2.11.2 -keyring==21.4.0 -Mako==1.1.3 -MarkupSafe==1.1.1 -mccabe==0.6.1 -mypy-extensions==0.4.3 -nodeenv==1.5.0 -packaging==20.4 -passlib==1.7.2 -PasteDeploy==2.1.0 -pathspec==0.8.0 -peppercorn==0.6 -plaster==1.0 -plaster-pastedeploy==0.7 -pluggy==0.13.1 -pre-commit==2.7.1 -py==1.9.0 -pycodestyle==2.6.0 -pycparser==2.20 -pyflakes==2.2.0 -Pygments==2.7.1 -pyparsing==2.4.7 -pyramid==1.10.4 -pyramid-debugtoolbar==4.6.1 -pyramid-jinja2==2.8 -pyramid-mailer==0.15.1 -pyramid-mako==1.1.0 -pyramid-retry==2.1.1 -pyramid-tm==2.4 -pytest==6.1.1 -pytest-cov==2.10.1 -pytest-mock==3.3.1 -pytoml==0.1.21 -PyYAML==5.3.1 -regex==2020.9.27 -repoze.lru==0.7 -repoze.sendmail==4.4.1 -requests==2.24.0 -SecretStorage==3.1.2 -six==1.15.0 -soupsieve==2.0.1 -SQLAlchemy==1.3.19 -toml==0.10.1 -tox==3.20.0 -transaction==3.0.0 -translationstring==1.4 -typed-ast==1.4.1 -typing-extensions==3.7.4.3 -urllib3==1.25.10 -venusian==3.0.0 -virtualenv==20.0.33 -waitress==1.4.4 -WebOb==1.8.6 -WebTest==2.0.35 -zope.deprecation==4.4.0 -zope.interface==5.1.2 -zope.sqlalchemy==1.3