daniel-sources 1.2.0__py3-none-any.whl
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,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: daniel_sources
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Reusable Python utilities for hashing, encryption, Stripe Checkout, documents, and quiz projects
|
|
5
|
+
Author: Daniel
|
|
6
|
+
Keywords: utilities,hashing,stripe,quizzes,pdf,environment
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: cryptography>=42.0
|
|
18
|
+
Requires-Dist: Werkzeug>=3.0
|
|
19
|
+
Requires-Dist: PyJWT>=2.9
|
|
20
|
+
Requires-Dist: requests>=2.31
|
|
21
|
+
Requires-Dist: stripe>=12.0
|
|
22
|
+
Requires-Dist: pypdf>=5.0
|
|
23
|
+
Requires-Dist: python-docx>=1.1
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0
|
|
25
|
+
|
|
26
|
+
# daniel_sources — pip-installable Python utility library
|
|
27
|
+
|
|
28
|
+
**Python 3.10 or newer** · **Version 1.2.0** · import as `import daniel_sources as ds`
|
|
29
|
+
|
|
30
|
+
This is a reusable standalone module adapted from your KleeQuiz production + developer source code. It includes hashing/password helpers, JWTs, encryption, random codes, email, Stripe Checkout/webhook utilities, PDFs and DOCX, quizzes, SQLite API-key/credits helpers, and the Developer API client.
|
|
31
|
+
|
|
32
|
+
## Install from the ZIP (works now, even before PyPI publishing)
|
|
33
|
+
|
|
34
|
+
1. Extract the ZIP. Open a terminal in the extracted folder containing `pyproject.toml`.
|
|
35
|
+
2. Install it in your active Python environment:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
python -m pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Windows virtual environment (no activation required):**
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
py -m venv .venv
|
|
45
|
+
.\.venv\Scripts\python.exe -m pip install .
|
|
46
|
+
.\.venv\Scripts\python.exe -c "import daniel_sources as ds; print(ds.hash('SHA256', 'hello'))"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This automatically installs all eight declared third-party dependencies, *into the selected Python environment*: `cryptography`, `Werkzeug`, `PyJWT`, `requests`, `stripe`, `pypdf`, `python-docx`, and `python-dotenv`. Dependencies may require an internet connection if pip hasn't cached them. You do **not** need to install a separate requirements file.
|
|
50
|
+
|
|
51
|
+
**If you have the wheel instead** (from the included `dist` folder):
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
python -m pip install .\dist\daniel_sources-1.2.0-py3-none-any.whl
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Code examples
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import daniel_sources as ds
|
|
61
|
+
|
|
62
|
+
print(ds.hash("SHA256", "hello"))
|
|
63
|
+
code = ds.generate_code()
|
|
64
|
+
key = ds.generate_encryption_key()
|
|
65
|
+
print(ds.decrypt(ds.encrypt("hello", key), key))
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Virtual environments and `.env` files
|
|
69
|
+
|
|
70
|
+
Make a `.env` file beside your project (not inside the installed library):
|
|
71
|
+
|
|
72
|
+
```dotenv
|
|
73
|
+
STRIPE_SECRET_KEY=sk_test_your_own_key_here
|
|
74
|
+
STRIPE_WEBHOOK_SECRET=whsec_your_own_signing_secret_here
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`import daniel_sources` automatically loads the `.env` file in your **current working directory**, without overwriting existing environment variables. It does not look inside other projects or search parent folders. This is separate from the Python virtual environment `.venv` folder.
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import os
|
|
81
|
+
import daniel_sources as ds # loads .env in your project folder, if present
|
|
82
|
+
|
|
83
|
+
print("Stripe configured?", bool(os.getenv("STRIPE_SECRET_KEY")))
|
|
84
|
+
print(ds.hash("SHA256", "hello"))
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If you keep configuration in a nonstandard file or need to reload it after import, use `ds.load_env("config/dev.env")`. Use `ds.load_env(".env", override=True)` only when you intentionally want the file to replace process variables.
|
|
88
|
+
|
|
89
|
+
To turn import-time loading **off**, set `DANIEL_SOURCES_AUTO_DOTENV=0` *before importing* the library (e.g. in your Windows terminal: `$env:DANIEL_SOURCES_AUTO_DOTENV="0"`). No network access or payment occurs on import. **Never commit real secrets to GitHub.**
|
|
90
|
+
|
|
91
|
+
## Use `pip install daniel_sources` from anywhere
|
|
92
|
+
|
|
93
|
+
The exact command `pip install daniel_sources` works **only after** the package name has been claimed and this distribution has been uploaded to the public Python Package Index (PyPI), or an equivalent configured private index. This ZIP is **not yet published**. The included wheel and source distribution are ready to publish.
|
|
94
|
+
|
|
95
|
+
To publish on PyPI yourself:
|
|
96
|
+
|
|
97
|
+
1. Create a PyPI account at https://pypi.org/ and configure authentication (use a protected PyPI token or trusted publishing).
|
|
98
|
+
2. Review the module, license/ownership and documentation: publishing makes the **source public**.
|
|
99
|
+
3. From this folder, install packaging tools and build (the prebuilt archives in `dist/` can be used instead):
|
|
100
|
+
|
|
101
|
+
```powershell
|
|
102
|
+
python -m pip install --upgrade build twine
|
|
103
|
+
python -m build
|
|
104
|
+
python -m twine check dist/*
|
|
105
|
+
python -m twine upload dist/*
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
4. Once your package is live on PyPI, in any new project / virtualenv:
|
|
109
|
+
|
|
110
|
+
```powershell
|
|
111
|
+
python -m pip install daniel_sources
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
After every source update, increment the version in `pyproject.toml` and `__version__` before publishing again, then users can upgrade with `python -m pip install --upgrade daniel_sources`.
|
|
115
|
+
|
|
116
|
+
If the name is already reserved when you publish, choose a distinct PyPI distribution name (e.g., `daniel-sources-kleequiz`); the *import* can still be `import daniel_sources as ds`.
|
|
117
|
+
|
|
118
|
+
## Install/edit your local package while developing
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
python -m pip install -e .
|
|
122
|
+
python test_daniel_sources.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Editable installs let you change `daniel_sources.py` and immediately use its changes in the same virtualenv. Publishing is not needed to develop locally.
|
|
126
|
+
|
|
127
|
+
## Security and limits
|
|
128
|
+
|
|
129
|
+
- Hashing with SHA256 is **not** password storage; use `ds.password_hash` and `ds.password_verify` for passwords.
|
|
130
|
+
- Stripe helpers require real Stripe credentials and a server-side integration; webhook signatures must be verified before crediting purchases.
|
|
131
|
+
- These helpers do not automatically handle web routes, model weights, Google OAuth, or live production deployment.
|
|
132
|
+
- This distribution contains no real API tokens, private `.env` files, production database or user records.
|
|
133
|
+
- Publishing the package publicly is your decision: inspect all code for any information you don't want publicly available and decide on your license before upload.
|
|
134
|
+
|
|
135
|
+
Also see `FUNCTION_INDEX.md`, `SOURCES.md`, and `docs/ORIGINAL_LIBRARY_GUIDE.md`.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
daniel_sources.py,sha256=WFbhhBTU5nOTPGzT1N8lzVMFOX2KV6zKdWxR_zfUza4,60328
|
|
2
|
+
daniel_sources-1.2.0.dist-info/METADATA,sha256=8r4X5qLuIijvTf6UsSmwoeWk1E76SMg5_BH06l65X-M,6412
|
|
3
|
+
daniel_sources-1.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
4
|
+
daniel_sources-1.2.0.dist-info/top_level.txt,sha256=9_r20oMh3AZxp7eIbO7WGKZ7lWjvFp8pzKRLxxcBvhw,15
|
|
5
|
+
daniel_sources-1.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
daniel_sources
|