diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3bca72c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +# These checks must pass before you may commit changes +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black diff --git a/BUILDING.md b/BUILDING.md index 6e66022..9036d91 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -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 @@ -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)* @@ -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. diff --git a/README.md b/README.md index 93c9fbf..7a0da6c 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. diff --git a/environment.yml b/environment.yml index c4d73e3..b4d90da 100644 --- a/environment.yml +++ b/environment.yml @@ -1,5 +1,5 @@ # When making changes to this file update requirements.txt also !! -# Usage: conda -v env update -n mausy5043-common --file environment.yml +# Usage: conda -v env update -n mausy5043-common --file environment.yml; pre-commit run --all-files channels: - conda-forge @@ -10,6 +10,7 @@ dependencies: - numpy - pandas - pandas-stubs + - pre-commit - pip # Not on conda channels: - pip: