Skip to content

Commit 9c84698

Browse files
committed
docs: redo docs, use zensical, and follow diatrix
1 parent dc71adb commit 9c84698

29 files changed

Lines changed: 1078 additions & 274 deletions

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: |
3939
pip install -r requirements-docs.txt
4040
pip install -e .
41-
mkdocs build
41+
zensical build
4242
4343
- name: Deploy to GitHub Pages
4444
uses: peaceiris/actions-gh-pages@v4

.gitignore

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,6 @@ coverage.xml
6767
local_settings.py
6868
db.sqlite3
6969

70-
# Flask stuff:
71-
instance/
72-
.webassets-cache
73-
74-
# Scrapy stuff:
75-
.scrapy
76-
77-
# Sphinx documentation
78-
docs/_build/
79-
8070
# PyBuilder
8171
target/
8272

@@ -90,9 +80,6 @@ ipython_config.py
9080
# pyenv
9181
.python-version
9282

93-
# celery beat schedule file
94-
celerybeat-schedule
95-
9683
# SageMath parsed files
9784
*.sage.py
9885

@@ -112,7 +99,7 @@ venv.bak/
11299
# Rope project settings
113100
.ropeproject
114101

115-
# mkdocs documentation
102+
# zensical documentation
116103
/site
117104

118105
# mypy
@@ -125,5 +112,6 @@ dmypy.json
125112

126113
### Python Patch ###
127114
.venv/
115+
uv.lock
128116

129117
# End of https://www.gitignore.io/api/python

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,9 @@ os.PathLike]` instead of just `os.PathLike` (#347 by [@bbc2]).
488488
[@JYOuyang]: https://github.com/JYOuyang
489489
[@burnout-projects]: https://github.com/burnout-projects
490490
[@cpackham-atlnz]: https://github.com/cpackham-atlnz
491+
492+
<!-- Releases -->
493+
491494
[Unreleased]: https://github.com/theskumar/python-dotenv/compare/v1.2.2...HEAD
492495
[1.2.2]: https://github.com/theskumar/python-dotenv/compare/v1.2.1...v1.2.2
493496
[1.2.1]: https://github.com/theskumar/python-dotenv/compare/v1.2.0...v1.2.1

CONTRIBUTING.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Contributing
2-
============
1+
# Contributing
32

43
All the contributions are welcome! Please open [an
54
issue](https://github.com/theskumar/python-dotenv/issues/new) or send us
@@ -18,18 +17,15 @@ or with [tox](https://pypi.org/project/tox/) installed:
1817

1918
$ tox
2019

21-
2220
Use of pre-commit is recommended:
2321

2422
$ uv run precommit install
2523

26-
27-
Documentation is published with [mkdocs]():
24+
Documentation is published with [zensical](https://zensical.org/) and follows
25+
the approach established by [Diátaxis](https://diataxis.fr/):
2826

2927
```shell
30-
$ uv pip install -r requirements-docs.txt
31-
$ uv pip install -e .
32-
$ uv run mkdocs serve
28+
$ make serve-docs
3329
```
3430

3531
Open http://127.0.0.1:8000/ to view the documentation locally.

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ coverage:
3333

3434
coverage-html: coverage
3535
coverage html
36+
37+
serve-docs:
38+
uv pip install -r requirements-docs.txt
39+
uv pip install -e .
40+
uv run zensical serve

README.md

Lines changed: 4 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,7 @@ python-dotenv reads key-value pairs from a `.env` file and can set them as
77
environment variables. It helps in the development of applications following the
88
[12-factor](https://12factor.net/) principles.
99

10-
- [Getting Started](#getting-started)
11-
- [Other Use Cases](#other-use-cases)
12-
- [Load configuration without altering the environment](#load-configuration-without-altering-the-environment)
13-
- [Parse configuration as a stream](#parse-configuration-as-a-stream)
14-
- [Load .env files in IPython](#load-env-files-in-ipython)
15-
- [Command-line Interface](#command-line-interface)
16-
- [File format](#file-format)
17-
- [Multiline values](#multiline-values)
18-
- [Variable expansion](#variable-expansion)
19-
- [Related Projects](#related-projects)
20-
- [Acknowledgements](#acknowledgements)
10+
> **[Read the full documentation](https://theskumar.github.io/python-dotenv/)**
2111
2212
## Getting Started
2313

@@ -73,163 +63,9 @@ like `${DOMAIN}`, as bare variables such as `$DOMAIN` are not expanded.
7363
You will probably want to add `.env` to your `.gitignore`, especially if it
7464
contains secrets like a password.
7565

76-
See the section "[File format](#file-format)" below for more information about what you can write in a `.env` file.
77-
78-
## Other Use Cases
79-
80-
### Load configuration without altering the environment
81-
82-
The function `dotenv_values` works more or less the same way as `load_dotenv`,
83-
except it doesn't touch the environment, it just returns a `dict` with the
84-
values parsed from the `.env` file.
85-
86-
```python
87-
from dotenv import dotenv_values
88-
89-
config = dotenv_values(".env") # config = {"USER": "foo", "EMAIL": "foo@example.org"}
90-
```
91-
92-
This notably enables advanced configuration management:
93-
94-
```python
95-
import os
96-
from dotenv import dotenv_values
97-
98-
config = {
99-
**dotenv_values(".env.shared"), # load shared development variables
100-
**dotenv_values(".env.secret"), # load sensitive variables
101-
**os.environ, # override loaded values with environment variables
102-
}
103-
```
104-
105-
### Parse configuration as a stream
106-
107-
`load_dotenv` and `dotenv_values` accept [streams][python_streams] via their
108-
`stream` argument. It is thus possible to load the variables from sources other
109-
than the filesystem (e.g. the network).
110-
111-
```python
112-
from io import StringIO
113-
114-
from dotenv import load_dotenv
115-
116-
config = StringIO("USER=foo\nEMAIL=foo@example.org")
117-
load_dotenv(stream=config)
118-
```
119-
120-
### Load .env files in IPython
121-
122-
You can use dotenv in IPython. By default, it will use `find_dotenv` to search for a
123-
`.env` file:
124-
125-
```python
126-
%load_ext dotenv
127-
%dotenv
128-
```
129-
130-
You can also specify a path:
131-
132-
```python
133-
%dotenv relative/or/absolute/path/to/.env
134-
```
135-
136-
Optional flags:
137-
138-
- `-o` to override existing variables.
139-
- `-v` for increased verbosity.
140-
141-
### Disable load_dotenv
142-
143-
Set `PYTHON_DOTENV_DISABLED=1` to disable `load_dotenv()` from loading .env
144-
files or streams. Useful when you can't modify third-party package calls or in
145-
production.
146-
147-
## Command-line Interface
148-
149-
A CLI interface `dotenv` is also included, which helps you manipulate the `.env`
150-
file without manually opening it.
151-
152-
```shell
153-
$ pip install "python-dotenv[cli]"
154-
$ dotenv set USER foo
155-
$ dotenv set EMAIL foo@example.org
156-
$ dotenv list
157-
USER=foo
158-
EMAIL=foo@example.org
159-
$ dotenv list --format=json
160-
{
161-
"USER": "foo",
162-
"EMAIL": "foo@example.org"
163-
}
164-
$ dotenv run -- python foo.py
165-
```
166-
167-
Run `dotenv --help` for more information about the options and subcommands.
168-
169-
## File format
170-
171-
The format is not formally specified and still improves over time. That being
172-
said, `.env` files should mostly look like Bash files. Reading from FIFOs (named
173-
pipes) on Unix systems is also supported.
174-
175-
Keys can be unquoted or single-quoted. Values can be unquoted, single- or
176-
double-quoted. Spaces before and after keys, equal signs, and values are
177-
ignored. Values can be followed by a comment. Lines can start with the `export`
178-
directive, which does not affect their interpretation.
179-
180-
Allowed escape sequences:
181-
182-
- in single-quoted values: `\\`, `\'`
183-
- in double-quoted values: `\\`, `\'`, `\"`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v`
184-
185-
### Multiline values
186-
187-
It is possible for single- or double-quoted values to span multiple lines. The
188-
following examples are equivalent:
189-
190-
```bash
191-
FOO="first line
192-
second line"
193-
```
194-
195-
```bash
196-
FOO="first line\nsecond line"
197-
```
198-
199-
### Variable without a value
200-
201-
A variable can have no value:
202-
203-
```bash
204-
FOO
205-
```
206-
207-
It results in `dotenv_values` associating that variable name with the value
208-
`None` (e.g. `{"FOO": None}`. `load_dotenv`, on the other hand, simply ignores
209-
such variables.
210-
211-
This shouldn't be confused with `FOO=`, in which case the variable is associated
212-
with the empty string.
213-
214-
### Variable expansion
215-
216-
python-dotenv can interpolate variables using POSIX variable expansion.
217-
218-
With `load_dotenv(override=True)` or `dotenv_values()`, the value of a variable
219-
is the first of the values defined in the following list:
220-
221-
- Value of that variable in the `.env` file.
222-
- Value of that variable in the environment.
223-
- Default value, if provided.
224-
- Empty string.
225-
226-
With `load_dotenv(override=False)`, the value of a variable is the first of the
227-
values defined in the following list:
228-
229-
- Value of that variable in the environment.
230-
- Value of that variable in the `.env` file.
231-
- Default value, if provided.
232-
- Empty string.
66+
See the [file format specification](https://theskumar.github.io/python-dotenv/reference/file-format/)
67+
for full details on `.env` syntax, multiline values, escape sequences, and
68+
variable expansion.
23369

23470
## Related Projects
23571

docs/changelog.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--8<-- "CHANGELOG.md"

docs/contributing.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--8<-- "contributing.md"

0 commit comments

Comments
 (0)