Skip to content

Commit

Permalink
introducing pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mausy5043 committed Jul 28, 2024
1 parent 2b76757 commit 06b779e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
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.
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,6 +10,7 @@ dependencies:
- numpy
- pandas
- pandas-stubs
- pre-commit
- pip
# Not on conda channels:
- pip:
Expand Down

0 comments on commit 06b779e

Please sign in to comment.