Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic environment path #417

Open
madh-van opened this issue Apr 10, 2022 · 6 comments
Open

dynamic environment path #417

madh-van opened this issue Apr 10, 2022 · 6 comments

Comments

@madh-van
Copy link

I am using a package manager (guix) that generates virual environments dynamically; and would be accessable via environment variable $PYTHONPATH;

Do you see any value in adding support for the enviorment variable to .dumbjump ? or language specific defaults environment vairables to the default search path (for example python will have $PYTHONPATH; this would be the case for conda environments as well if I am not wrong)

(corner case worth considering will be for remote projects via tramp)

Forgive me if I missed something from the documentation; or if this is already addressed.

Thank you for your time.

@jacktasia
Copy link
Owner

Thanks for opening this! Out of curiosity does echo "+$PYTHONPATH" >> .dumbjump (in your project directory root) actually work? Curious to hear that before thinking about handling it dynamically.

@madh-van
Copy link
Author

madh-van commented Apr 15, 2022

Unfortunately no. I suspect its because of the contents on the folder are simlink to other build folders by the package manager.

ls -l  /gnu/store/r4029jlr3bwvds2wgy9gmkddb8h4x87f-profile/lib/python3.8/site-packages
total 11
lrwxrwxrwx   1 root           root      121 1970-01-01  1970 Jinja2-2.11.2-py3.8.egg-info -> /gnu/store/6z2ri6yzpagh5pc32m8gn95lzarxkims-python-jinja2-2.11.2/lib/python3.8/site-packages/Jinja2-2.11.2-py3.8.egg-info
[...]

[EDIT]
I missed setting the arguments to follow link with rg; and yes that works manually now:)

For reproducibility;

(setq dumb-jump-rg-search-args "--pcre2 --follow")
(setq dumb-jump-force-searcher 'rg)
(setq dumb-jump-prefer-searcher 'rg)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)

@phikal
Copy link
Contributor

phikal commented Apr 15, 2022

Are you using a path directly into /gnu/store or are you using ~/.guix-profile/...? I believe the latter is preferable, because the /gnu/store profiles could get deleted after a while.

@madh-van
Copy link
Author

madh-van commented Apr 15, 2022

@phikal; you are right about the /gnu/store/ paths being subjected to garbage collection, but correct me if I am wrong

but the ~/.guix-(home|profile)/ is meant for guix (home| install); where as the project specific environment/packages from guix shell only provides you with the environment variable to /gnu/store/.

@phikal
Copy link
Contributor

phikal commented Apr 15, 2022

Seems like that is the case:

$ guix shell hello
...
$ which hello
/gnu/store/sgx9l505s7gw1axqnyqvz7iabgsni243-profile/bin/hello

That means if you update your system, then the profile would be re-generated, which would also break the hard-coded /gnu/store path. So some kind of general functionality for respecting environmental would be required.

@madh-van
Copy link
Author

I agree and removing the complexity of guix from this issue; I think including paths from programming language specific environment variable as the default search path along with current project root path would be
beneficial in my view.

Here comes the opinionated part; especially when you don't want to pollute the root directory with yet another .*rc config file.

(open to hear other view point on this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants