thoth-station/micropipenv

v1.1.2 "micropipenv requirements" doesn't autodetect from poetry.lock

hanjos opened this issue · 3 comments

Describe the bug
micropipenv requirements (with no flags) doesn't autodetect the method; it fails outright if it's not Pipenv:

(venv) $ micropipenv requirements
File 'Pipfile.lock' not found in 'C:\\Users\\...\\app' or any parent directory

To Reproduce
Given a codebase using Poetry:

$ dir
07/10/2021  05:17 PM    <DIR>          .
07/10/2021  05:17 PM    <DIR>          ..
07/10/2021  04:22 PM               123 .gitignore
07/10/2021  04:22 PM            23,486 poetry.lock
07/10/2021  04:01 PM               783 pyproject.toml
07/10/2021  04:01 PM                13 README.md
07/10/2021  04:01 PM                 0 README.rst
07/10/2021  04:01 PM    <DIR>          tests
07/10/2021  04:01 PM    <DIR>          app

Run:

(venv) $  micropipenv requirements

with no flags inside an active virtual environment.

Expected behavior

Micropipenv detects that Poetry is use and produces a requirements list from poetry.lock, as stated in --help:

(venv) $ micropipenv requirements --help
usage: micropipenv requirements [-h] [--no-hashes] [--no-indexes] [--no-versions] [--only-direct] [--no-comments]
                                [--no-default] [--no-dev] [--method {pipenv,poetry}]

optional arguments:
  -h, --help            show this help message and exit
  --no-hashes           Do not include hashes in the generated output.
  --no-indexes          Do not include index configuration in the generated output.
  --no-versions         Do not include version information in the generated output, implies --no-hashes.
  --only-direct         Include only direct dependencies in the output, implies --no-hashes and --no-versions; this
                        requires 'toml' extras to be installed.
  --no-comments         Do not include comments differentiating sections.
  --no-default          Include only development dependencies, do not include default dependencies.
  --no-dev              Include only default dependencies, do not include develop dependencies.
  --method {pipenv,poetry}
                        Source of packages for the requirements file, perform detection if not provided.

Additional context
micropipenv 1.1.2, running on Windows 10

For additional info, micropipenv install seems to work fine.

A cursory look at the source code (from a non-Python programmer, so take it with some grains of salt...) suggests that requirements does no detection at all.

goern commented

/kind bug
/priority backlog
/assign @fridex

@hanjos thanks for the report. The issue should be fixed in the current main branch and will be part of the next release.