From f96d68d0161b79d133a60b14661042dcb5245812 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Mon, 5 Feb 2024 20:12:02 -0500 Subject: [PATCH] Docs updates (#329) * Add doctoc * Document schemes argument --- .pre-commit-config.yaml | 10 ++++++++-- README.md | 22 +++++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b2a4c7..ecc2425 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,5 +16,11 @@ repos: - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.8.0 hooks: - - id: mypy - additional_dependencies: ["marshmallow>=3,<4"] + - id: mypy + additional_dependencies: ["marshmallow>=3,<4"] +- repo: https://github.com/thlorenz/doctoc.git + rev: v2.2.0 + hooks: + - id: doctoc + name: Add TOC for Markdown and RST files + files: README\.md diff --git a/README.md b/README.md index 9684ba7..fe0ccf1 100644 --- a/README.md +++ b/README.md @@ -10,26 +10,32 @@ It allows you to store configuration separate from your code, as per ## Contents + + + - [Features](#features) - [Install](#install) - [Basic usage](#basic-usage) - [Supported types](#supported-types) -- [Reading .env files](#reading-env-files) +- [Reading `.env` files](#reading-env-files) - [Reading a specific file](#reading-a-specific-file) - [Handling prefixes](#handling-prefixes) - [Variable expansion](#variable-expansion) - [Validation](#validation) - [Deferred validation](#deferred-validation) +- [URL schemes](#url-schemes) - [Serialization](#serialization) - [Defining custom parser behavior](#defining-custom-parser-behavior) - [Usage with Flask](#usage-with-flask) - [Usage with Django](#usage-with-django) -- [Why...?](#why) +- [Why\...?](#why%5C) - [Why envvars?](#why-envvars) - - [Why not os.environ?](#why-not-osenviron) + - [Why not `os.environ`?](#why-not-osenviron) - [Why another library?](#why-another-library) - [License](#license) + + ## Features - Type-casting @@ -252,6 +258,16 @@ env.seal() `env.seal()` validates all parsed variables and prevents further parsing (calling a parser method will raise an error). +## URL schemes + +`env.url()` supports non-standard URL schemes via the `schemes` argument. + +```python +REDIS_URL = env.url( + "REDIS_URL", "redis://redis:6379", schemes=["redis"], require_tld=False +) +``` + ## Serialization ```python