Closed janoc closed 2 years ago
What's in your pyproject.toml
file?
Pretty much the default as generated by poetry new
except for the graphics.py
dependency. But the same thing happens also on my work projects with much bigger pyproject.toml
[tool.poetry]
name = "Bezier"
version = "0.1.0"
description = ""
authors = ["Jan Ciger <jan.ciger@xxx.xxx>"]
[tool.poetry.dependencies]
python = "^3.8"
"graphics.py" = "^5.0.1"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
What's in your pet-pyproject-cache
and exec-path
? Is pyproject.toml
in the root of your project?
Layout of my project:
.
├── bezier
│ ├── __init__.py
│ └── main.py
├── .flake8
├── .git
│ ├── branches
│ ├── config
│ ├── description
│ ├── HEAD
│ ├── hooks
│ │ ├── applypatch-msg.sample
│ │ ├── commit-msg.sample
│ │ ├── fsmonitor-watchman.sample
│ │ ├── post-update.sample
│ │ ├── pre-applypatch.sample
│ │ ├── pre-commit.sample
│ │ ├── pre-merge-commit.sample
│ │ ├── prepare-commit-msg.sample
│ │ ├── pre-push.sample
│ │ ├── pre-rebase.sample
│ │ ├── pre-receive.sample
│ │ ├── push-to-checkout.sample
│ │ └── update.sample
│ ├── info
│ │ └── exclude
│ ├── objects
│ │ ├── info
│ │ └── pack
│ └── refs
│ ├── heads
│ └── tags
├── .gitignore
├── poetry.lock
├── .projectile
├── pyproject.toml
├── README.rst
└── tests
├── __init__.py
└── test_bezier.py
pet-pyproject-cache
is nil
exec-path
is:
(/usr/local/bin /usr/bin /bin /usr/local/games /usr/games /usr/local/sbin /usr/sbin /usr/lib64/qt5/bin /home/janoc/scripts /home/janoc/.local/bin /home/janoc/.cabal/bin /home/janoc/.platformio/penv/bin /home/janoc/src/ele/avr/arduino/arduino /sbin /usr/sbin /usr/local/bin /opt/java/jdk/bin /opt/java/jdk/jre/bin /opt/android-sdk-linux/tools /opt/dar-2.4.0/bin /opt/arm/arm-none-eabi/bin /opt/gcc-arm-none-eabi/bin /opt/openocd/bin /media/u/build/arm/raspberry-pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin /opt/avr-toolchain/bin /opt/OpenSceneGraph/bin /opt/emacs/bin /opt/rtags/bin /opt/the_silver_searcher/bin /opt/node/bin /opt/racket/bin/ /opt/kconfig-frontends/bin /opt/icestorm/bin /opt/clang/bin /opt/lisp/sbcl/bin /opt/DotNet /opt/fpga/verilator/bin /opt/fpga/gtkwave/bin /opt/emacs-29/libexec/emacs/29.0.50/x86_64-pc-linux-gnu)
Yeah but pet-virtualenv-root
uses pet-use-poetry-p
to try to see whether it should look for poetry
- and that returns always nil
, so it doesn't even try.
I have tried to debug it but I don't quite understand the logic behind that let-alist
call there, so that's where I am stuck with it. If I remove/comment those lines out, pet-use-poetry-p
returns the path to poetry
and pet-virtualenv-root
works as expected too.
Hmm, that's very strange. Either pet-project-root
can't detect your project root or pet-parse-config-file
can't parse your pyproject.toml
for whatever reason. I'd turn on pet-debug
and see what comes up in the *Messages*
buffer or edebug pet-parse-config-file
and see what's up. It's very hard for me to debug here.
BTW, just making sure, you do have dasel
or tomljson
installed and they are on your exec-path
right?
(executable-find "dasel")
returns "/usr/local/bin/dasel"
and setting pet-debug
to t
before enabling pet-mode
doesn't produce any relevant output in the "Messages" apart from the usual stuff - turning on LSP mode.
Could you at least tell me what is that let-alist
attempting to do there? Maybe that would give me a pointer at where to look.
I am surprised that you can't reproduce it, though.
let-alist
just allows you to select into an alist path, if that's returning nil, that means something is wrong with parsing pyproject.yaml
, i.e. either it was not found or there was some syntax error. pet-pyproject
parses the TOML file into JSON, and then json-parse-string
parses it into an elisp association list.
BTW, you seem to be using some old version of pet, install from main and tell me if you still have the same error.
Ha, that seems to have fixed the issue. After updating I am getting poetry
recognized now.
My pet
was probably a week or so old - I have installed it right after you have posted it on reddit and didn't think to update as it was still quite recent.
OK then I guess I can close this. I will test it tomorrow on my work machine with a different project as well, if it still/again doesn't work then I will reopen this.
Thanks for your help!
Hello,
I can't manage to get
(pet-use-poetry-p)
to ever detectpoetry
.The problem seems to be in this block that always returns nil:
The
string-match-p
always returns nil, so theand
shortcircuits and the executable is never found, despitepoetry
being in the path. If I remove everything apart from theexecutable-find
, then everything works as expected.How to reproduce:
virtualenvs.in-project
settings has default valuenull
and thus virtualenvs are not created inside of the project directory (otherwise the code finds the.venv
directory instead of going through thepoetry
detection).emacs
and enablepet-mode
.(pet-use-poetry-p)
will evaluate tonil
pet-virtualenv-root
isnil