Geomancy validates deployment and development environments
Project description
geomancy
The geomancy
tool makes it easy to check and validate environments, such
as development, testing and production.
Currently, geomancy
can check that:
- environment variables are properly set
- file and directory paths exist
- executables are available and, optionally, of the correct version
- check grouping and conditional evaluation
- supports setting values with environment variable substitution.
ex:
checkPath: {HOME}/.geomancy.toml
The following is an example geomancy
run with an example checks file.
$ geo examples/geomancy.toml
========================= examples/geomancy.toml =========================
checks (10 checks)
[✔] Environment (2 checks)
[✔] Check environment variable '{PATH}'...passed
[✔] Check environment variable '{USER}'...passed
Paths (4 checks)
[✔] ChecksFile (3 checks)
[✔] Check path 'examples/geomancy.toml'...passed
[✔] Check path 'examples/pyproject.toml'...passed
[!] Check path '.missing__.txt'...missing
[✔] Executables (1 checks)
[✔] Check executable 'python3>=3.11'...passed
========================= 11 checks passed in 0.00s ======================
Usage
-
Create a file containing checks. Either
.geomancy.toml
in the project root. See theexamples
directory for examples.
or
pyproject.toml
with check in the[tool.geomancy]
section.
-
Run the geo
$ geo
Format
Check Groups
Check groups are sections which contain one or more sub-checks.
name | description |
---|---|
desc | (Optional) The description for the check section |
condition | (Optional) Either 'all' to require that all sub-checks pass or 'any' to require that only one sub-check passes.Default: 'all' |
Examples
The following is a check group ChecksFile
with 2 checks, Geomancy
and
Pyproject
.
[checks.ChecksFile]
desc = "Checks that at least one checks file exists"
condition = "any"
[checks.ChecksFile.Geomancy]
desc = "Check for 'geomancy.toml' file"
checkPath = "examples/geomancy.toml"
type = "file"
[checks.ChecksFile.Pyproject]
desc = "Check for 'pyproject.toml' file"
checkPath = "examples/pyproject.toml"
type = "file"
The following is the same check group, but in abbreviated format.
[checks.ChecksFile]
condition = "any"
Geomancy = {checkPath = "examples/geomancy.toml", type = "file"}
Pyproject = {checkPath = "examples/pyproject.toml", type = "file"}
Checks
checkEnv
Check the existence and, optionally, the value of an environment variable.
name | description |
---|---|
checkEnv | Environment variable to check, wrapped in curly braces for substitution. aliases: checkEnv , CheckEnv |
desc | (Optional) The description for the check |
regex | (Optional) A regular expression to check against the environment variable value |
Examples
[checks.Environment.Username]
desc = "The current username"
checkEnv = "{USER}"
regex = "[a-z_][a-z0-9_-]*[$]?"
checkExec
Check the existence and, optionally, the version of available executables or commands.
name | description |
---|---|
checkExec | Executable to check. Additionally, an optional version check can be added with a test operator. aliases: checkExec , CheckExec |
desc | (Optional) The description for the check |
Examples
[checks.Executables.Ls]
desc = "List files"
checkExec = "ls"
[checks.Executables.Python]
desc = "Python interpreter (version 3.11 or higher)"
checkExec = "python3>=3.11"
checkPath
Check the existence and type of a path.
name | description |
---|---|
checkPath | Path to check, which may include environment varaibles wrapped in curly braces for substitution. aliases: checkPath , CheckPath |
desc | (Optional) The description for the check |
type | (Optional) Additionally check whether the path corresponds to a valid 'file' or 'dir' . |
Examples
[checks.Environment.Pyproject]
desc = "A project's pyprojectfile"
checkPath = "./pyproject.toml"
path_type = "file"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for geomancy-0.6.1b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e396b521f673c084954f2e3db79ab64697d5d870f5d6a1af43ca3035d5c371b2 |
|
MD5 | 1965d97c99cc9ada0a0374b143d403aa |
|
BLAKE2b-256 | 29fbb28a9eecd2a8a4b6f8850eb83d01cbc861266dd82dcd7063662ea92fefe4 |