Repository navigation
build(direnv): Make direnv .envrc idempotent so it doesn't do all that work all the time - #7520
Conversation
…t work all the time
stasadev
left a comment
There was a problem hiding this comment.
direnv: loading ~/workspace/ddev/.envrc
Initializing python nodeenv...
Requirement already satisfied: nodeenv in ./.gotmp/env/python/lib/python3.13/site-packages (1.9.1)
I don't see any of this, my ~/.bashrc contains:
export DIRENV_LOG_FORMAT=
But without it, I see only this line:
direnv: loading ~/code/ddev/ddev/.envrc
If this change can improve that behavior, I'm fine with it.
P.S. The current PR adds some logic instead of replacing it.
|
Does your system take several seconds in the switch? What do you think about a global location for these tools, instead of project location? |
No. And I didn't try this PR yet because of added changes.
If it can be done in a different way, I would like to see it. |
|
Actually, I would probably just make a script that does the install work into a global location in the PATH, and not update it very often, instead of tieing it to a specific repository/branch/directory. |
|
I cleaned up the duplication, maybe you can experiment with it now. However, I'd still rather this be a script in the scripts directory that sets up the venv on the system instead of per project. I don't remember seeing a project where that would be a problem. If you're OK with this one, let's get it in so I can continue to use direnv without pain, and then I'll pursue a system-venv setup as an alternate technique in an alternate PR. |
stasadev
left a comment
There was a problem hiding this comment.
Works for me.
There is no direnv in our docs, I think a mention would be nice, somewhere in https://ddev.readthedocs.io/en/stable/developers/building-contributing/
d1a065e to
8178161
Compare
|
Added docs. |
stasadev
left a comment
There was a problem hiding this comment.
This looks good, but I found out that we already have docs here:
- https://ddev--7520.org.readthedocs.build/en/7520/developers/testing-docs/#preview-changes
- https://ddev--7520.org.readthedocs.build/en/7520/developers/testing-docs/#check-markdown-for-errors
I would either move it there, or add crosslinks.
The Issue
Every time I switch into a ddev directory (a lot) I get several seconds of useless work being done:
How This PR Solves The Issue
Make it check to see if things are already properly installed and not do them in that case.
Manual Testing Instructions
Rendered at https://ddev--7520.org.readthedocs.build/en/7520/developers/building-contributing/#helpers-for-mkdocs-linkspector-markdownlint
Use it in .envrc
Questions
Why are we even installing these things in the project instead of an external directory like ~/.cache? It's conceivably possible that some dependency of mkdocs could change, but it doesn't seem like it ever happens. I think that's the key question. And in that case... does it need to be done in .envrc at all?
Comments
Assisted by ChatGPT