Skip to content

Commit

Permalink
update to v1.8 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mausy5043 authored Aug 17, 2024
2 parents 9456883 + bf737ee commit 91eb3af
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 90 deletions.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# These checks must pass before you may commit changes
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
- id: requirements-txt-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ disable=raw-checker-failed,
too-many-locals,
too-many-branches,
too-many-statements,
logging-fstring-interpolation,
logging-fstring-interpolation,
import-error,
invalid-name,
missing-function-docstring,
Expand Down
12 changes: 6 additions & 6 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## Versionnumbers

We try to follow [semantic versioning](semver.org).
* We don't have `0` MINOR or PATCH versionnumbers. Patterns `x.0.z` and `x.y.0` do not exist.
* We don't have `0` MINOR or PATCH versionnumbers. Patterns `x.0.z` and `x.y.0` do not exist.
* Testing versions are identified by odd-numbered MINOR versions
* Stable/production versions are identified by even-numbered MINOR versions
* MAJOR versions increase only when significant changes are made
* MAJOR versions increase only when significant changes are made

## Building the package for testing

Expand All @@ -16,7 +16,7 @@ Preferably changes are done on a separate branch.
1. Make the necessary changes...
1. In `./pyproject.toml` change the versionnumber under `[project]/version`
* For testing we change the MINOR version to the next **odd** value
* The first PATCH version always starts on x.y.1 and increases by +1 with every new build
* The first PATCH version always starts on x.y.1 and increases by +1 with every new build
* Builds with the same versionnumber can't be uploaded to PyPi, so it's not like we have a choice
1. Run `./mkbld -b`
1. Run `./mkbld -t` *(installation instructions are displayed on the terminal after the upload)*
Expand Down Expand Up @@ -45,7 +45,7 @@ To distribute a new production version the package must be built and uploaded to
1. After succesfull testing of the distribution package create a new tag on the `master` branch

## Available commands for package building
`./mkbld --build|-b` builds the distribution files
`./mkbld --dist|-d` uploads the distribution files to PyPi
`./mkbld --test|-t` uploads the dictribution files to TestPyPi
`./mkbld --build|-b` builds the distribution files
`./mkbld --dist|-d` uploads the distribution files to PyPi
`./mkbld --test|-t` uploads the dictribution files to TestPyPi
`./mkbld --discard` **discards all changes to the local copy** of the repo and pulls the current state of the repo from GitHub.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This is a Python3 library of functions and classes, mainly for personal use.

## Requirements

**NOTE: user action required !!**
Before trying to use the SQLITE3 functions in this package make sure you have installed the sqlite3 server/client and
**NOTE: user action required !!**
Before trying to use the SQLITE3 functions in this package make sure you have installed the sqlite3 server/client and
the default Python package that comes with it.

Development of this package is done in Python 3.9. The package is considered forwards compatible at least upto Python 3.11 and probably also beyond. Backwards compatibility is not guaranteed; if it works on Python 3.7 or before consider yourself lucky. [Python versions that are end-of-life](https://devguide.python.org/versions/) are not supported.
Expand All @@ -23,11 +23,11 @@ python3 -m pip install mausy5043-common


## Functions provided
`cat(filename)` : Read a file into a variable.
`syslog_trace(trace, logerr, out2console)` : Log messages to console and/or system log.
`moisture(temperature, relative_humidity, pressure)` : Calculate the moisture content of air given T [degC], RH [%] and P [hPa].
`wet_bulb_temperature(temperature, relative_humidity)` : Calculate the wet bulb temperature of the air given T [degC] and RH [%].
`cat(filename)` : Read a file into a variable.
`syslog_trace(trace, logerr, out2console)` : Log messages to console and/or system log.
`moisture(temperature, relative_humidity, pressure)` : Calculate the moisture content of air given T [degC], RH [%] and P [hPa].
`wet_bulb_temperature(temperature, relative_humidity)` : Calculate the wet bulb temperature of the air given T [degC] and RH [%].

## Classes provided
`GracefulKiller` : A simple version of [this one](https://pypi.org/project/GracefulKiller/).
`GracefulKiller` : A simple version of [this one](https://pypi.org/project/GracefulKiller/).
`SqlDatabase` : A class to interact with SQLite3 databases.
11 changes: 10 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# When making changes to this file update requirements.txt also !!
# Usage:
# conda -v env update --file environment.yml; pre-commit run --all-files; pycheck

name: mausy5043-common

channels:
- conda-forge
- defaults

dependencies:
- python=3.10
- python=3.11
- numpy
- pandas
- pandas-stubs
- pre-commit
- pip
# Not on conda channels:
- pip:
- pylint
7 changes: 4 additions & 3 deletions mkbld
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ build_app(){
### build package
echo
echo "Building..."
rm dist/*
python3 -m build
rm -r dist/*
rm -r ./*.egg-info
python3 -m build --outdir ./dist # not needed by default: --sdist --wheel
}

test_app() {
Expand All @@ -31,7 +32,7 @@ test_app() {
python3 -m twine upload --repository testpypi dist/*
echo ""
echo "To test installing this package use:"
echo "python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps --upgrade ${PACKAGE_NAME}"
echo "python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ --no-deps --upgrade ${PACKAGE_NAME}"
}

dist_app() {
Expand Down
77 changes: 65 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,89 @@
# Project: mausy5043-common

# Hatchling https://packaging.python.org/en/latest/key_projects/#hatch

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "mausy5043-common"
description = "Common python functions"
version = "1.6.2" # latest production version
version = "1.8.1" # latest production version
# version = "1.5.4" # latest test version
dependencies = [
"numpy",
"pandas",
]
description = "Common python functions"
readme = "README.md"
requires-python = ">=3.9"
license = "MIT"
authors = [
{ name="Mausy5043" },
]
license = "MIT"
readme = "README.md"
requires-python = ">=3.8"
keywords = [
"private",
"Raspberry Pi",
"Debian Linux"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
]
dependencies = [
"numpy",
"pandas",
]

[tool.hatch.build.targets.wheel.force-include]
"./pyproject.toml" = "mausy5043_common/pyproject.toml"

[project.urls]
"Homepage" = "https://github.com/Mausy5043/mausy5043-common"
"Bug Tracker" = "https://github.com/Mausy5043/mausy5043-common/issues"

[tool.setuptools.package-data]
"mausy5043-common" = ["py.typed"]
# [tool.setuptools.package-data]
# "mausy5043-common" = ["py.typed"]

[tool.autopep8]
max_line_length = 98
in-place = true
recursive = true
aggressive = 1

[tool.bandit]
skips = []

[tool.black]
line-length = 98
target-version = ["py39", "py310", "py311", "py312"]

[tool.flake8]
max_line_length = 98
ignore = [
# function too complex: is what we do ;-)
"C901",
# line too long: is checked by pylint
"E501",
# line break before binary: is against policy.
"W503",
]

[tool.mypy]
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
strict_equality = true
check_untyped_defs = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_untyped_calls = true
no_implicit_reexport = true

[tool.pydocstyle]
inherit = false
convention = 'google'
match = '.*\\.py'
add-ignore = 'D'
extra_checks = true
2 changes: 0 additions & 2 deletions src/mausy5043_common/funfile.pyi

This file was deleted.

4 changes: 0 additions & 4 deletions src/mausy5043_common/funmeteo.pyi

This file was deleted.

3 changes: 3 additions & 0 deletions src/mausy5043_common/libsignals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# TODO: migrate to https://pypi.org/project/GracefulKiller/

import signal
import warnings

warnings.warn("This module is deprecated. Use https://pypi.org/project/GracefulKiller/ instead.")


class GracefulKiller: # pylint: disable=R0903
Expand Down
4 changes: 0 additions & 4 deletions src/mausy5043_common/libsignals.pyi

This file was deleted.

17 changes: 0 additions & 17 deletions src/mausy5043_common/libsqlite3.pyi

This file was deleted.

33 changes: 0 additions & 33 deletions tox.ini

This file was deleted.

0 comments on commit 91eb3af

Please sign in to comment.