replit / upm

⠕ Universal Package Manager - Python, Node.js, Ruby, Emacs Lisp.
https://repl.it
Other
1.05k stars 89 forks source link

feat/python guess inside ifstat #240

Closed blast-hardcheese closed 6 months ago

blast-hardcheese commented 6 months ago

Why

It's reasonably common for Python libraries to include gate imports behind if, def, and try statements. Let's try adding if/elif/else and see whether this is even a direction we want to proceed with.

What changed

Altered query to reflect the if_statement structure. Extended test to cover this new case.

Test plan

See whether imports gated behind if statements are caught by upm guess

blast-hardcheese commented 6 months ago

Before this gets merged, we should probably ensure that upm acknowledges poetry dependency groups. I don't know if it's worth attempting to guess alternative names for requirements.txt, though it may be beneficial to add support for Pipfile/pipenv.

I don't think pip-tools offers a huge lift, since upm already does enough of what pip-compile does today.

cdmistman commented 6 months ago

I don't know if it's worth attempting to guess alternative names for requirements.txt, though it may be beneficial to add support for Pipfile/pipenv.

i think as long as we support other dependency groups with poetry it should be fine. i think the majority of repls use poetry

blast-hardcheese commented 6 months ago

please reformat with standard lisp formatting

Open to any suggestion as to how to make maintaining query formatting easier. Are there standard formatters you recommend for folk that don't know what "standard lisp formatting" looks like?