Skip to content

Commit

Permalink
docs: add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pivoshenko committed Apr 25, 2024
1 parent 1828af7 commit a942ac3
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,8 @@ temp

# import linter
.import_linter_cache

# examples
!docs/examples/.env
!docs/examples/.env.dev
!docs/examples/.env.prod
Binary file removed docs/assets/demo.gif
Binary file not shown.
49 changes: 0 additions & 49 deletions docs/demo.tape

This file was deleted.

5 changes: 5 additions & 0 deletions docs/examples/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB__HOST=localhost
DB__DBNAME=local_lakehouse
DB__USER=volodymyr
DB__PASSWORD=super_secret_password
DB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}
5 changes: 5 additions & 0 deletions docs/examples/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB__HOST=dev.host
DB__DBNAME=dev_lakehouse
DB__USER=svc_team
DB__PASSWORD=super_secret_password
DB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}
5 changes: 5 additions & 0 deletions docs/examples/.env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB__HOST=prod.host
DB__DBNAME=prod_lakehouse
DB__USER=svc_team
DB__PASSWORD=super_secret_password
DB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}
42 changes: 42 additions & 0 deletions docs/examples/demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Output ../assets/demo.gif

Set FontSize 26
Set Width 1920
Set Height 1080
Set Margin 20
Set BorderRadius 10
Set TypingSpeed 0.5
Set Theme "Catppuccin Mocha"
Set WindowBar Colorful
Set Shell "zsh"

Type "echo 'Welcome to poetry-plugin-dotenv!'"
Enter
Sleep 5s
Ctrl+L

Type "ls -a"
Enter
Sleep 5s
Ctrl+L

Type "bat -p main.py"
Enter
Sleep 5s
Ctrl+L

Type "bat -p pyproject.toml"
Enter
Sleep 5s
Ctrl+L

Type "bat -p .env.dev"
Enter
Sleep 5s

Type "poetry run -vvv python main.py"
Enter
Sleep 5s
Ctrl+L

Ctrl+D
17 changes: 17 additions & 0 deletions docs/examples/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Example script.""" # noqa: INP001

from __future__ import annotations

import os


if __name__ == "__main__":
try:
print(f"Host: {os.environ['DB__HOST']!r}") # noqa: T201
print(f"Name: {os.environ['DB__DBNAME']!r}") # noqa: T201
print(f"Username: {os.environ['DB__USER']!r}") # noqa: T201
print(f"Password: {os.environ['DB__PASSWORD']!r}") # noqa: T201
print(f"Engine: {os.environ['DB__ENGINE']!r}") # noqa: T201

except KeyError:
print("Environment variables not set!") # noqa: T201

0 comments on commit a942ac3

Please sign in to comment.