selfie-lib - snapshot testing *and* caching/memoization (useful for testing against genAI)
# What My Project Does
selfie-lib is a snapshot testing library ([docs](https://selfie.dev/py/get-started#quickstart), [source](https://github.com/diffplug/selfie)), with a few novel features. At its most basic, it functions like `print` but it writes into your sourcecode instead of the console. You write a test like this:
expect_selfie(primes_under(15)).to_be_TODO()
When you run the test, selfie automatically rewrites the test code by calling `repl()` on the result of `primes_under(15)`, e.g.
expect_selfie(primes_under(15)).to_be([2, 3, 5, 7, 11, 13])
Now that the method call is `to_be` instead of `to_be_TODO`, this will throw an `AssertionError` if the `primes_under(15)` call ever changes its output.
That's standard snapshot testing stuff, the other things it can do are
* save snapshots inline with the source code or on disk
* [https://selfie.dev/py/facets#harmonizing-disk-and-inline-literals](https://selfie.dev/py/facets#harmonizing-disk-and-inline-literals)
* you can use snapshots to cache/memoize the results of slow & non-deterministic APIs (e.g generative AI), and build other test infrastructure on top of that snapshotted data
* [https://selfie.dev/py/cache#example](https://selfie.dev/py/cache#example)
# Target Audience
**People who test their code with** `print`. Just replace `print` with `expect_selfie(...).to_be_TODO()` and you can turn that `print` into a repeatable test.
**People who are building applications with nondeterministic or slow components, such as generative AI.** You don't want to hit the model for every unit test on the
/r/Python
https://redd.it/1hfwri1
# What My Project Does
selfie-lib is a snapshot testing library ([docs](https://selfie.dev/py/get-started#quickstart), [source](https://github.com/diffplug/selfie)), with a few novel features. At its most basic, it functions like `print` but it writes into your sourcecode instead of the console. You write a test like this:
expect_selfie(primes_under(15)).to_be_TODO()
When you run the test, selfie automatically rewrites the test code by calling `repl()` on the result of `primes_under(15)`, e.g.
expect_selfie(primes_under(15)).to_be([2, 3, 5, 7, 11, 13])
Now that the method call is `to_be` instead of `to_be_TODO`, this will throw an `AssertionError` if the `primes_under(15)` call ever changes its output.
That's standard snapshot testing stuff, the other things it can do are
* save snapshots inline with the source code or on disk
* [https://selfie.dev/py/facets#harmonizing-disk-and-inline-literals](https://selfie.dev/py/facets#harmonizing-disk-and-inline-literals)
* you can use snapshots to cache/memoize the results of slow & non-deterministic APIs (e.g generative AI), and build other test infrastructure on top of that snapshotted data
* [https://selfie.dev/py/cache#example](https://selfie.dev/py/cache#example)
# Target Audience
**People who test their code with** `print`. Just replace `print` with `expect_selfie(...).to_be_TODO()` and you can turn that `print` into a repeatable test.
**People who are building applications with nondeterministic or slow components, such as generative AI.** You don't want to hit the model for every unit test on the
/r/Python
https://redd.it/1hfwri1
selfie.dev
Selfie Python Snapshot Testing | Get started
Zero-config inline and disk snapshots for Python. Add a single dependency and you're all set.
[Project] /dev/push - An open source Vercel for Python apps
**What My Project Does**
[/dev/push](https://github.com/hunvreus/devpush) is an open source deployment platform that lets you deploy Python apps with a UX similar to Vercel/Render. It handles git-based deployments, environment variables, real-time logs, custom domains...
**Target Audience**
Python developers who want an easier way to self-host and deploy apps. It’s ready for use (I run it for my own apps) but still in beta. Bug reports and feedback is welcome.
**Comparison**
Unlike Vercel or Render, /dev/push is fully open source and self-hosted. You can install and run it on your own Debian/Ubuntu server with a single command, without relying on a third-party platform. Compared to Coolify or CapRover, it’s lighter and more focused on delivering a polished UX.
**How to get started**
You can install it on a any Debian/Ubuntu server with a single command:
curl -fsSL https://raw.githubusercontent.com/hunvreus/devpush/main/scripts/prod/install.sh | sudo bash
More info on installation steps: [https://devpu.sh/docs/installation/#quickstart](https://devpu.sh/docs/installation/#quickstart)
**Links**
* GitHub: [https://github.com/hunvreus/devpush](https://github.com/hunvreus/devpush)
* Docs: [https://devpu.sh/docs](https://devpu.sh/docs)
* Website: [https://devpu.sh](https://devpu.sh)
/r/Python
https://redd.it/1ncgwas
**What My Project Does**
[/dev/push](https://github.com/hunvreus/devpush) is an open source deployment platform that lets you deploy Python apps with a UX similar to Vercel/Render. It handles git-based deployments, environment variables, real-time logs, custom domains...
**Target Audience**
Python developers who want an easier way to self-host and deploy apps. It’s ready for use (I run it for my own apps) but still in beta. Bug reports and feedback is welcome.
**Comparison**
Unlike Vercel or Render, /dev/push is fully open source and self-hosted. You can install and run it on your own Debian/Ubuntu server with a single command, without relying on a third-party platform. Compared to Coolify or CapRover, it’s lighter and more focused on delivering a polished UX.
**How to get started**
You can install it on a any Debian/Ubuntu server with a single command:
curl -fsSL https://raw.githubusercontent.com/hunvreus/devpush/main/scripts/prod/install.sh | sudo bash
More info on installation steps: [https://devpu.sh/docs/installation/#quickstart](https://devpu.sh/docs/installation/#quickstart)
**Links**
* GitHub: [https://github.com/hunvreus/devpush](https://github.com/hunvreus/devpush)
* Docs: [https://devpu.sh/docs](https://devpu.sh/docs)
* Website: [https://devpu.sh](https://devpu.sh)
/r/Python
https://redd.it/1ncgwas
GitHub
GitHub - hunvreus/devpush: Like Vercel, but open source and for all languages.
Like Vercel, but open source and for all languages. - hunvreus/devpush