shhh 0.0.0.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: shhh
3
+ Version: 0.0.0.dev0
4
+ Summary: Simple environment secret accessor for Python.
5
+ Author: Anatoly Frolov (anafro)
6
+ Author-email: anatolyfroloff@gmail.com
7
+ Requires-Python: >=3.13
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Description-Content-Type: text/markdown
12
+
13
+ # Shhh...
14
+
15
+ **Shhh** is a dead simple secret accessor, that retrieves environment
16
+ secrets, and secrets from files.
17
+
18
+ ## Installation
19
+
20
+ To install Shhh, use:
21
+
22
+ ```bash
23
+ pip install shhh
24
+ ```
25
+
26
+ With Poetry, do:
27
+
28
+ ```bash
29
+ poetry add shhh
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ The only function is **Shhh** is `get_secret`.
35
+ It returns an environment variable, unless a file exists on path provided in `XXX_FILE` variable.
36
+ For example:
37
+ ```py
38
+ username: str = get_secret("APP_USERNAME")
39
+ ```
40
+
41
+ ***Shhh** searches for a file on path provided in `APP_USERNAME_FILE` variable and, if it exists,
42
+ returns its content. Otherwise, returns the value of `APP_USERNAME` variable.
43
+
44
+ ## License
45
+
46
+ **Shhh** is licensed under MIT.
47
+
48
+ ------------------
49
+ Copyright (c) 2026 Anatoly Frolov (anafro). All Rights Reserved.\
50
+ `contact@anafro.ru`
51
+
@@ -0,0 +1,38 @@
1
+ # Shhh...
2
+
3
+ **Shhh** is a dead simple secret accessor, that retrieves environment
4
+ secrets, and secrets from files.
5
+
6
+ ## Installation
7
+
8
+ To install Shhh, use:
9
+
10
+ ```bash
11
+ pip install shhh
12
+ ```
13
+
14
+ With Poetry, do:
15
+
16
+ ```bash
17
+ poetry add shhh
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ The only function is **Shhh** is `get_secret`.
23
+ It returns an environment variable, unless a file exists on path provided in `XXX_FILE` variable.
24
+ For example:
25
+ ```py
26
+ username: str = get_secret("APP_USERNAME")
27
+ ```
28
+
29
+ ***Shhh** searches for a file on path provided in `APP_USERNAME_FILE` variable and, if it exists,
30
+ returns its content. Otherwise, returns the value of `APP_USERNAME` variable.
31
+
32
+ ## License
33
+
34
+ **Shhh** is licensed under MIT.
35
+
36
+ ------------------
37
+ Copyright (c) 2026 Anatoly Frolov (anafro). All Rights Reserved.\
38
+ `contact@anafro.ru`
@@ -0,0 +1,16 @@
1
+ [project]
2
+ name = "shhh"
3
+ version = "0.0.0-dev"
4
+ description = "Simple environment secret accessor for Python."
5
+ authors = [
6
+ {name = "Anatoly Frolov (anafro)",email = "anatolyfroloff@gmail.com"}
7
+ ]
8
+ readme = "README.md"
9
+ requires-python = ">=3.13"
10
+ dependencies = [
11
+ ]
12
+
13
+
14
+ [build-system]
15
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
16
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,18 @@
1
+ from os import environ as env
2
+ from pathlib import Path
3
+
4
+
5
+ def get_secret(name: str) -> str:
6
+ if name in env:
7
+ return env[name]
8
+
9
+ filename_env_key: str = f"{name}_FILE"
10
+
11
+ if filename_env_key in env:
12
+ environment_secret_filepath: Path = Path(env[filename_env_key])
13
+ with open(environment_secret_filepath, "r") as secret_file:
14
+ return secret_file.read()
15
+
16
+ raise ValueError(
17
+ f"Neither {name}, nor {filename_env_key} is present in environment variables."
18
+ )