Skip to main content

EduLinq Python Utilities

Common utilities used by EduLinq Python projects.

Installation / Requirements

This project requires Python >= 3.9.

The project can be installed from PyPi with:

pip3 install edq-utils

Standard Python requirements are listed in pyproject.toml. The project and Python dependencies can be installed from source with:

pip3 install .

Configuration System

This project provides a configuration system that supplies options (e.g., username, password) to a command-line interface (CLI) tool. The configuration system follows a tiered order, allowing options to be specified and overridden from both files and command-line options. The order that configuration sources are processed should be set by the tool using this library. A description of each configuration source (and the order they are loaded) is output in the help prompt from the --help flag.

Configuration Sources

In addition to CLI options, the configuration system loads options from JSON files located across multiple directories. By default, configuration files are named edq-config.json. This value is customizable, but this document will assume the default is used.

For example, a configuration file containing the user and pass options might look like this:

{
    "user": "alice",
    "pass": "password123"
}

The table below summarizes the configuration sources provided by this library.

Source Description
CLI (Implicit) Loaded from the command line as a flag that is NOT --config.
CLI (Explicit) Loaded from the command line via the --config flag.
CLI File Loaded from one or more explicitly provided configuration files through the CLI.
Global Loaded from a file in a user-specific location, which is platform-dependent.
Local Loaded from a file in the current directory.
Project Loaded from a file in the current or nearest ancestor directory.

The system produces an error if a configuration file is unreadable (but not missing), or if a CLI-specified file is unreadable or missing.

CLI Configuration

CLI configurations are options specified directly on the command line, these are useful for quick option overrides without editing config files. Explicit configuration options are passed to the command line using the --config flag in this format <key>=<value>. The provided values overrides the values from configuration files. Configuration options are structured as key value pairs and keys cannot contain the "=" character. All other options specified on the command-line are considered "implicit" options.

Below is an example of specifying a configuration option directly from the CLI:

python3 -m edq.cli.config.list --config user=alice --config pass=password123

CLI-Specified Config Files

CLI config files are options specified on the command line via a file. These are useful for a common set of options you don’t need every time, such as login credentials for different user. Any files passed via --config-file will be loaded in the order they appear on the command line. Options from later files override options from previous files.

Below is an example of a CLI specified configuration paths:

python3 -m edq.cli.config.list --config-file ./edq-config.json --config-file ~/.secrets/edq-config.json

Global Configuration

Global configurations are options that are user specific and stick with the user between projects, these are well suited for options like login credentials. The global configuration file defaults to <platform-specific user configuration location>/edq-config.json. The configuration location is chosen according to the XDG standard (implemented by platformdirs). Below are examples of user-specific configuration file paths for different operating systems:

  • Linux -- /home/<user>/.config/edq-config.json
  • Mac -- /Users/<user>/Library/Application Support/edq-config.json
  • Windows -- C:\Users\<user>\AppData\Local\edq-config.json

The default global configuration location can be changed by passing a path to --config-global through the command line.

Below is an example command for specifying a global configuration path from the CLI:

python3 -m edq.cli.config.list --config-global  ~/.config/custom-config.json

Local Configuration

Local configurations are options that are specific to a directory. These options are generally used for special cases. Users should generally prefer project sources instead of local ones.

Project Configuration

Project configurations are options that are specific to a project or directory, like a project's build directory. Project configuration files are searched in multiple locations, starting with the current directory and moving up to each ancestor. The first file found is used. This source is very useful for setting project-specific options in your project's root.

CLI Config Options

The table below lists common configuration CLI options available for CLI tools using this library.

CLI Option Description
--config-global Override the global config file location.
--config-file Load configuration options from a CLI specified file.
--config Provide additional options to a CLI command.
--help Display standard help text and the default global configuration file path for the current platform.

Metadata

Release files for edq-utils 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edq-utils 1.0.3
File Size Uploaded
edq_utils-1.0.3.tar.gz 128.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for edq-utils 1.0.3
File Interpreter ABI Platform
edq_utils-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 284.7 kB

Release files / edq_utils-1.0.3.tar.gz

Download URL edq_utils-1.0.3.tar.gz
Size 128.0 kB
Tags Source
SHA-256 checksum
How to use checksums
987f0a4757c87738e485003c0e2b7c0f4f80f4ae63fff6a73945f8d898a559bb
BLAKE2b-256 checksum
How to use checksums
a3f9bb7944cf19ea6ec9eaf4ed092bc1e3622bf047a31c661fa423b76198da05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / edq_utils-1.0.3-py3-none-any.whl

Download URL edq_utils-1.0.3-py3-none-any.whl
Size 156.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd839ad6d2c869048fe5d629c9b2a061d2a6db00152efc8602b91b5045ba9512
BLAKE2b-256 checksum
How to use checksums
81339bb08b98fbd2aef49a0363c6611df63e95bcfc1c386646e162f2762874b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page