Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation with direct use of MkDocs #398

Merged
merged 1 commit into from Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -1,6 +1,7 @@
include LICENSE *.md *.yml *.toml

include tox.ini
recursive-include docs *.md
recursive-include tests *.py

include .bumpversion.cfg
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
1 change: 1 addition & 0 deletions docs/contributing.md
1 change: 1 addition & 0 deletions docs/index.md
3 changes: 3 additions & 0 deletions docs/reference.md
@@ -0,0 +1,3 @@
# Reference

::: dotenv
23 changes: 23 additions & 0 deletions mkdocs.yml
@@ -0,0 +1,23 @@
site_name: python-dotenv
repo_url: https://github.com/theskumar/python-dotenv
edit_uri: ""
theme:
name: material
palette:
primary: green
markdown_extensions:
- mdx_truly_sane_lists
plugins:
- mkdocstrings:
handlers:
python:
rendering:
show_root_heading: yes
show_submodules: no
separate_signature: yes
- search
nav:
- Home: index.md
- Changelog: changelog.md
- Contributing: contributing.md
- Reference: reference.md
5 changes: 0 additions & 5 deletions pyproject.toml

This file was deleted.

9 changes: 7 additions & 2 deletions requirements.txt
@@ -1,11 +1,16 @@
black~=22.3.0
bumpversion
click
flake8>=2.2.3
ipython
mdx_truly_sane_lists~=1.2
mkdocs-include-markdown-plugin~=3.3.0
mkdocs-material~=8.2.9
mkdocstrings[python]~=0.18.1
mkdocs~=1.3.0
pytest-cov
pytest>=3.9
sh>=1.09
tox
wheel
twine
portray
wheel
35 changes: 17 additions & 18 deletions src/dotenv/main.py
Expand Up @@ -198,10 +198,10 @@ def unset_key(
encoding: Optional[str] = "utf-8",
) -> Tuple[Optional[bool], str]:
"""
Removes a given key from the given .env
Removes a given key from the given `.env` file.

If the .env path given doesn't exist, fails
If the given key doesn't exist in the .env, fails
If the .env path given doesn't exist, fails.
If the given key doesn't exist in the .env, fails.
"""
if not os.path.exists(dotenv_path):
logger.warning("Can't delete from %s - it doesn't exist.", dotenv_path)
Expand Down Expand Up @@ -316,16 +316,17 @@ def load_dotenv(
) -> bool:
"""Parse a .env file and then load all the variables found as environment variables.

- *dotenv_path*: absolute or relative path to .env file.
- *stream*: Text stream (such as `io.StringIO`) with .env content, used if
`dotenv_path` is `None`.
- *verbose*: whether to output a warning the .env file is missing. Defaults to
`False`.
- *override*: whether to override the system environment variables with the variables
in `.env` file. Defaults to `False`.
- *encoding*: encoding to be used to read the file.
Parameters:
dotenv_path: Absolute or relative path to .env file.
stream: Text stream (such as `io.StringIO`) with .env content, used if
`dotenv_path` is `None`.
verbose: Whether to output a warning the .env file is missing.
override: Whether to override the system environment variables with the variables
from the `.env` file.
encoding: Encoding to be used to read the file.

If both `dotenv_path` and `stream`, `find_dotenv()` is used to find the .env file.
If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the
.env file.
"""
if dotenv_path is None and stream is None:
dotenv_path = find_dotenv()
Expand Down Expand Up @@ -356,12 +357,10 @@ def dotenv_values(
`{"foo": None}`

Parameters:

- `dotenv_path`: absolute or relative path to the .env file.
- `stream`: `StringIO` object with .env content, used if `dotenv_path` is `None`.
- `verbose`: whether to output a warning if the .env file is missing. Defaults to
`False`.
- `encoding`: encoding to be used to read the file. Defaults to `"utf-8"`.
dotenv_path: Absolute or relative path to the .env file.
stream: `StringIO` object with .env content, used if `dotenv_path` is `None`.
verbose: Whether to output a warning if the .env file is missing.
encoding: Encoding to be used to read the file.

If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the
.env file.
Expand Down