Show HN: Vomitorium – all of your project in 1 text file
npmjs.com
npmjs.com
- Dump all .py files into out.txt (for copy/paste into a LLM)
> find . -name "*.py" -exec cat {} + > out.txt
- Sort all .py files by number of lines
> find . -name '*.py' -exec wc -l {} + | sort -n
I see people creating all kinds of mounts and volumes but I just embed files inline under the configs top level key. I even embed shell scripts that way to do one shot/initialization tasks.
The goal is to just have one compose.yml file that the developer can spin up for a local development reproduction of what they need. It's quite nice.
Just add to your __init__.py files:
import importlib
def __getattr__(submodule_name):
return importlib.import_module('.' + submodule_name, __package__)
And then just import the root module and use it without ever needing to import individual submodules:import foo
def bar():
return foo.subfoo.bar() # foo.subfoo is imported when the function is first executed instead of when it is parsed, so no circular import happenI suspect that from the usage in the code, it knows that there is a module foo and a submodule subfoo with a function bar() in it, and it can look directly in the file for the definition of bar().
It would be another story if we used this opportunity to mangle the submodules names for example, but that the kind of hidden control flow that nobody want in his codebase.
Also, it is not some dark arts of import or something: it is pretty standard at this point since its one of the most sane way of breaking circular dependencies between your modules, and the feature of overloading a module __getattr__ was introduced specifically for this usecase. (I couldn't find the specific PEP that introduced it, sorry)
I want to figure out how to structure a codebase such that a failing test can spit out a CID for that failure such that it can be remotely recreated (you'd have to be running ipfs so that the remote party can pull the content from you, or maybe you push it to some kind of hub before you share it).
It would be the files relevant to that failure--both code files and data files, stdin, env vars... a reproducible build of a test result.
It would be handy for reporting bugs or getting LLM help. The remote party could respond with a similar "try this" hash which the tooling would then understand how to apply (fetching the necessary bits from their machine, or the hub). Sort of like how Unison resolves functions by cryptographic hash, except this is a link to a function call, so it's got inputs and outputs too.
Of course that's a long way from vomiting everything into a text file, I need to establish functional dependency at as small a granularity as possible, but this feels like the first step on a path that eventually gets us there.
The process could be
1. defining a new/temporary bundler entry point
2. copying the failing code into the file
3. Bundle without minification
It'd probably be best to reduce scope by limiting it to a specific testing framework and make it via an extension, i.e. jest
Whether to use nodejs or python or rust (and which version thereof) will be as much a part of the bundled function as its code. I figure I'll wrap nix so it can replicate the environments, then I'll just have to do the runtime stuff.
fd [filter options] -X cat
E.g. to combine all .js files into combined.js: fd -e js -X cat > combined.js shopt -s globstar
tail -n+1 **/*.py | pbcopyOr "shell archives", .shar files - https://en.wikipedia.org/wiki/Shar - they used to be kicked around in comp.sources.
Can you go 1 more step? Is there a way to not just dump someone's project into a plain text file, but sometime intelligently craft it into a ready to go prompt? I could use that!
Here's my user test: https://www.youtube.com/watch?v=sTPTJ4ladiI
It does this, and smartly, using tree-sitter, for quite a few tree-sitter supported languages.
[1] https://erlang.org/pipermail/erlang-questions/2011-May/05876...
We did this for a home-grown SoC with a gcc port for which there was no linker.
find /path/to/directory -type f -exec cat {} + > output.txt
>>> include
> A commonly held but erroneous notion is that Ancient Romans designated spaces called vomitoria for the purpose of literal vomiting, as part of a binge-and-purge cycle