Standard Search
About 149 results
https://rednafi.com/python/module-getattr/ · 3 Nov 2024
Speed up Python module imports with __getattr__ from PEP 562 for lazy loading, deprecation warnings, and dynamic attribute access.
https://marko.tech/journal/guide-to-hugging-face · 28 Oct 2024
A comprehensive guide to installing and using Hugging Face models.
https://rednafi.com/python/testing-http-requests/ · 2 Sep 2024
Test HTTP requests in Python with pytest-httpx for full mocking, respx for pattern matching, or VCR.py for recording real responses.
https://rednafi.com/python/pytest-param/ · 28 Aug 2024
Write readable parametrized tests with pytest.param for better test names, conditional skips, custom IDs, and structured test data.
https://rednafi.com/python/log-context-propagation/ · 6 Aug 2024
Automatically tag Python logs with request context using middleware and contextvars for distributed tracing in ASGI web applications.
https://rednafi.com/python/no-hijack-root-logger/ · 3 Aug 2024
Avoid configuring Python's root logger in libraries; use named loggers with NullHandler to let application code control logging behavior.
https://pdewey.com/blog/neural-net-viz · 13 May 2024
### Introduction Recently, I just finished a semester-long project in which a colleague and I investigated how neural networks learn using visualizations. As a computer and data scientist, this topic has fascinated me for a while. We spend so much time co...
https://rednafi.com/python/typeguard-vs-typeis/ · 27 Apr 2024
Understand TypeIs vs TypeGuard in Python: TypeIs provides more intuitive type narrowing by narrowing both positive and negative branches.
https://rednafi.com/python/patch-pydantic-settings-in-pytest/ · 27 Jan 2024
Mock pydantic_settings in pytest tests by patching the settings class to prevent flaky tests from environment variable dependencies.
https://rednafi.com/misc/eschewing-black-box-api-calls/ · 15 Jan 2024
Why you should define API response structures explicitly. Compare approaches in Python, JavaScript, and Go with Pydantic, Zod, and structs.