Closed twmr closed 1 year ago
I think the REGEX of file-expand-wildcards
needs to be set to t in pet-find-file-from-project-root
:
...
(car (file-expand-wildcards (concat (file-name-as-directory root) file) t t))))
That does not look like version 20220905.2004, this is what's on that version.
Indeed. I had an older version of pet.el in a folder called pet-20220905.2004
- don't know how this could have happened.
Good that this is fixed now.
One follow-up question (I can create a new ticket for that if you want):
In a project that uses a conda environment, which is specified in the environment.yml
, I would expect (pet-virtualenv-root)
to return directory of this conda-env, but what it does is that just returns /home/thomas/miniconda
and not /home/thomas/miniconda/envs/myprojectenv
. Is there a reason for the current behavior?
This sexp returns the correct prefix, but AFAICS it is not used anywhere in pet.el
(alist-get 'prefix (pet-environment))
.
Adding this code to (pet-virtualenv-root)
fixes this issue for me
(let ((venv-path
(cond
((pet-environment) (alist-get 'prefix (pet-environment))) ;;; this line is new
((when-let ((program (pet-use-conda-p))
(default-directory (file-name-directory (pet-environment-path))))
(condition-case err
....
Description
There is code in pet.el that tries to find an environment yaml in the project, for which the following regex is used "environment.ya?ml". This regex is passed to
(pet-find-file-from-project "environment.ya?ml")
, which returns nil when I run it inside a conda project. However, if I remove the regex and use "environment.yml" instead, it returns the filename:~/gitrepos/2022 $ (pet-find-file-from-project-root "environment.ya?ml") ~/gitrepos/2022 $ (pet-find-file-from-project-root "environment.yml") /home/thomas/gitrepos/2022/environment.yml
Reproduction steps
Expected behavior
~/gitrepos/2022 $ (pet-find-file-from-project-root "environment.ya?ml")
should return the expected file
PET version pet 20220905.2004
Emacs version 29.0.50 Desktop (please complete the following information):