Browse Source

modernized project layout and infrastructure

- bumped version to 0.8.0
- requires now at least Python 3.9
- tox tests run in Python verions 3.9 and 3.10
- moved package source to "src" directory
xmlparsing
Holger Frey 2 years ago
parent
commit
4e1d92ca41
  1. 7
      .pre-commit-config.yaml
  2. 30
      Makefile
  3. 66
      pyproject.toml
  4. 2
      src/sensospot_parser/__init__.py
  5. 0
      src/sensospot_parser/columns.py
  6. 0
      src/sensospot_parser/parameters.py
  7. 0
      src/sensospot_parser/parser.py
  8. 4
      tox.ini

7
.pre-commit-config.yaml

@ -3,6 +3,7 @@ repos:
rev: v2.4.0 rev: v2.4.0
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-byte-order-marker
- id: check-json - id: check-json
- id: check-merge-conflict - id: check-merge-conflict
- id: check-toml - id: check-toml
@ -12,7 +13,7 @@ repos:
hooks: hooks:
- id: isort-project - id: isort-project
name: isort_project name: isort_project
entry: isort -rc sensospot_parser entry: isort -rc src
language: system language: system
pass_filenames: false pass_filenames: false
- id: isort-test - id: isort-test
@ -22,12 +23,12 @@ repos:
pass_filenames: false pass_filenames: false
- id: black - id: black
name: black name: black
entry: black sensospot_parser tests entry: black src tests
language: system language: system
pass_filenames: false pass_filenames: false
- id: flake8 - id: flake8
name: flake8 name: flake8
entry: flake8 --ignore E231,W503 sensospot_parser tests entry: flake8 --ignore E231,W503 src tests
language: system language: system
pass_filenames: false pass_filenames: false
- id: pytest - id: pytest

30
Makefile

@ -51,16 +51,27 @@ 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 sensospot_parser isort src
isort tests isort tests
black sensospot_parser tests black src tests
flake8 --ignore E231,W503,E402 sensospot_parser tests flake8 --ignore E231,W503,E402 src tests
test: ## run tests quickly with the default Python test: lint ## run tests quickly, stop on first error
pytest tests -x --disable-warnings --failed-first pytest tests -x -l --last-failed --disable-warnings -m "not functional"
coverage: ## full test suite, check code coverage and open coverage report testfunctional: lint ## run functional tests, stop on first error
pytest tests --cov=sensospot_parser pytest tests -x -l -m "functional"
testall: lint ## run all tests
pytest tests -l
coverage: lint ## functional test suite, check code coverage and open coverage report
pytest tests --cov=sensospot_parser -l -m "functional"
coverage html
$(BROWSER) htmlcov/index.html
coverall: lint ## full test suite, check code coverage and open coverage report
pytest tests --cov=sensospot_parser -l
coverage html coverage html
$(BROWSER) htmlcov/index.html $(BROWSER) htmlcov/index.html
@ -73,14 +84,15 @@ install: ## install updated project.toml with flint
devenv: ## setup development environment devenv: ## setup development environment
python3 -m venv --prompt sensospot .venv python3 -m venv --prompt sensospot .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 add . git add .
git commit -m "import of project template" git commit -m "import of project template"
git branch -m main
git remote add origin https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_parser.git git remote add origin https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_parser.git
git push -u origin master --no-verify git push -u origin main --no-verify
.venv/bin/pre-commit install --install-hooks .venv/bin/pre-commit install --install-hooks

66
pyproject.toml

@ -1,36 +1,42 @@
[build-system] [build-system]
requires = ["flit"] requires = ["flit_core>=3.2,<4"]
build-backend = "flit.buildapi" build-backend = "flit_core.buildapi"
[tool.flit.metadata] [project]
module = "sensospot_parser" name = "sensospot_parser"
dist-name = "sensospot_parser" readme = "README.md"
author = "Holger Frey" license = { file = "LICENSE" }
author-email = "frey@imtek.de" requires-python = ">=3.9"
home-page = "https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_parser.git" dynamic = ["version", "description"]
description-file = "README.md"
license = "Beerware" authors = [
{name = "Holger Frey", email = "frey@imtek.de"},
]
# see https://pypi.org/classifiers/ # see https://pypi.org/classifiers/
classifiers = [ classifiers = [
"Development Status :: 2 - Pre-Alpha", "Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3 :: Only",
"License :: Freely Distributable", "License :: Freely Distributable",
] ]
requires = [ dependencies = [
"pandas >=1.0.0", "pandas >=1.0.0",
"defusedxml >=0.6.0", "defusedxml >=0.6.0",
"tables >=3.6.1", "tables >=3.6.1",
"click", "click",
] ]
[project.urls]
Source = "https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_parser.git"
requires-python = ">=3.7" [project.scripts]
sensospot_parse = "sensospot_parser:main"
[tool.flit.metadata.requires-extra] [project.optional-dependencies]
test = [ test = [
"pytest >=4.0.0", "pytest >=4.0.0",
"pytest-cov", "pytest-cov",
@ -42,26 +48,24 @@ dev = [
"black", "black",
"flake8", "flake8",
"flake8-comprehensions", "flake8-comprehensions",
"isort", "flake8-bandit",
"isort >= 5.0.0",
"keyring", "keyring",
"pre-commit", "pre-commit",
] ]
[tool.flit.scripts]
sensospot_parse = "sensospot_parser:main"
[tool.black] [tool.black]
line-length = 79 line-length = 79
target-version = ['py37'] target-version = ['py39', 'py310']
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]
@ -69,3 +73,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 = [
"functional: marks tests as functional (deselect with '-m \"not functional\"')",
]
addopts = [
"--strict-markers",
]

2
sensospot_parser/__init__.py → src/sensospot_parser/__init__.py

@ -3,7 +3,7 @@
Parsing the numerical output from Sensovations Sensospot image analysis. Parsing the numerical output from Sensovations Sensospot image analysis.
""" """
__version__ = "0.7.0" __version__ = "0.8.0"
import sys import sys

0
sensospot_parser/columns.py → src/sensospot_parser/columns.py

0
sensospot_parser/parameters.py → src/sensospot_parser/parameters.py

0
sensospot_parser/parser.py → src/sensospot_parser/parser.py

4
tox.ini

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py37 envlist = py39, py310
isolated_build = True isolated_build = True
[testenv] [testenv]
@ -11,4 +11,4 @@ deps =
pip>=20.0.2 pip>=20.0.2
changedir = {toxinidir}/tests changedir = {toxinidir}/tests
commands = pytest --cov=sensovation_data_parser commands = pytest --cov=sensovation_parser

Loading…
Cancel
Save