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

30
Makefile

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

66
pyproject.toml

@ -1,36 +1,42 @@ @@ -1,36 +1,42 @@
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"
requires = ["flit_core>=3.2,<4"]
build-backend = "flit_core.buildapi"
[tool.flit.metadata]
module = "sensospot_parser"
dist-name = "sensospot_parser"
author = "Holger Frey"
author-email = "frey@imtek.de"
home-page = "https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_parser.git"
description-file = "README.md"
license = "Beerware"
[project]
name = "sensospot_parser"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.9"
dynamic = ["version", "description"]
authors = [
{name = "Holger Frey", email = "frey@imtek.de"},
]
# see https://pypi.org/classifiers/
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"License :: Freely Distributable",
]
requires = [
dependencies = [
"pandas >=1.0.0",
"defusedxml >=0.6.0",
"tables >=3.6.1",
"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 = [
"pytest >=4.0.0",
"pytest-cov",
@ -42,26 +48,24 @@ dev = [ @@ -42,26 +48,24 @@ dev = [
"black",
"flake8",
"flake8-comprehensions",
"isort",
"flake8-bandit",
"isort >= 5.0.0",
"keyring",
"pre-commit",
]
[tool.flit.scripts]
sensospot_parse = "sensospot_parser:main"
[tool.black]
line-length = 79
target-version = ['py37']
target-version = ['py39', 'py310']
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]
@ -69,3 +73,11 @@ line_length=79 @@ -69,3 +73,11 @@ line_length=79
multi_line_output=3
length_sort="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 @@ @@ -3,7 +3,7 @@
Parsing the numerical output from Sensovations Sensospot image analysis.
"""
__version__ = "0.7.0"
__version__ = "0.8.0"
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 @@ @@ -1,5 +1,5 @@
[tox]
envlist = py37
envlist = py39, py310
isolated_build = True
[testenv]
@ -11,4 +11,4 @@ deps = @@ -11,4 +11,4 @@ deps =
pip>=20.0.2
changedir = {toxinidir}/tests
commands = pytest --cov=sensovation_data_parser
commands = pytest --cov=sensovation_parser

Loading…
Cancel
Save