Skip to main content

daniel_sources — pip-installable Python utility library

Python 3.10 or newer · Version 1.2.0 · import as import daniel_sources as ds

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.

Install from the ZIP (works now, even before PyPI publishing)

  1. Extract the ZIP. Open a terminal in the extracted folder containing pyproject.toml.
  2. Install it in your active Python environment:
python -m pip install .

Windows virtual environment (no activation required):

py -m venv .venv
.\.venv\Scripts\python.exe -m pip install .
.\.venv\Scripts\python.exe -c "import daniel_sources as ds; print(ds.hash('SHA256', 'hello'))"

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.

If you have the wheel instead (from the included dist folder):

python -m pip install .\dist\daniel_sources-1.2.0-py3-none-any.whl

Code examples

import daniel_sources as ds

print(ds.hash("SHA256", "hello"))
code = ds.generate_code()
key = ds.generate_encryption_key()
print(ds.decrypt(ds.encrypt("hello", key), key))

Virtual environments and .env files

Make a .env file beside your project (not inside the installed library):

STRIPE_SECRET_KEY=sk_test_your_own_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_own_signing_secret_here

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.

import os
import daniel_sources as ds  # loads .env in your project folder, if present

print("Stripe configured?", bool(os.getenv("STRIPE_SECRET_KEY")))
print(ds.hash("SHA256", "hello"))

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.

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.

Use pip install daniel_sources from anywhere

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.

To publish on PyPI yourself:

  1. Create a PyPI account at https://pypi.org/ and configure authentication (use a protected PyPI token or trusted publishing).

  2. Review the module, license/ownership and documentation: publishing makes the source public.

  3. From this folder, install packaging tools and build (the prebuilt archives in dist/ can be used instead):

    python -m pip install --upgrade build twine
    python -m build
    python -m twine check dist/*
    python -m twine upload dist/*
    
  4. Once your package is live on PyPI, in any new project / virtualenv:

    python -m pip install daniel_sources
    

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.

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.

Install/edit your local package while developing

python -m pip install -e .
python test_daniel_sources.py

Editable installs let you change daniel_sources.py and immediately use its changes in the same virtualenv. Publishing is not needed to develop locally.

Security and limits

  • Hashing with SHA256 is not password storage; use ds.password_hash and ds.password_verify for passwords.
  • Stripe helpers require real Stripe credentials and a server-side integration; webhook signatures must be verified before crediting purchases.
  • These helpers do not automatically handle web routes, model weights, Google OAuth, or live production deployment.
  • This distribution contains no real API tokens, private .env files, production database or user records.
  • 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.

Also see FUNCTION_INDEX.md, SOURCES.md, and docs/ORIGINAL_LIBRARY_GUIDE.md.

Metadata

Release files for daniel-sources 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for daniel-sources 1.2.0
File Size Uploaded
daniel_sources-1.2.0.tar.gz 32.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for daniel-sources 1.2.0
File Interpreter ABI Platform
daniel_sources-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.1 kB

Release files / daniel_sources-1.2.0.tar.gz

Download URL daniel_sources-1.2.0.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0090197c9f7c78f1be1d2500bc1c059dfe5a30e6cf91e649fd7a75c0b7b7c29d
BLAKE2b-256 checksum
How to use checksums
89f1f7212655c6e49045368ad96880e6cffdf5952b41194405055993e5454dc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / daniel_sources-1.2.0-py3-none-any.whl

Download URL daniel_sources-1.2.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
735b8867fb16be5972a42eb4843521bc7898d3b58256561f2f06d2e5eca0d0e2
BLAKE2b-256 checksum
How to use checksums
84978abaee068d332bab697dcbbca9effa62a8045da520d4bc4b749f0cba06bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page