cloud-custodian / poetry-plugin-freeze

poetry plugin to freeze dependency versions in wheels
22 stars 4 forks source link

Failing in project without dependencies #20

Open DBS-ST-VIT opened 3 months ago

DBS-ST-VIT commented 3 months ago

The command poetry freeze-wheel is failing in projects without dependencies. Example:

[tool.poetry.dependencies]
python = "^3.9"

This happens, if you are using this in a generic pipeline template for much projects. Stdout/Stderr example:

freezing wheels
'NoneType' object is not iterable

Imho, this shouldnt be an (unhandled) error. A warning log message is okay, but the exit code should be 0 anyway.

DBS-ST-VIT commented 3 months ago

I contributed a fix in #21 - in my environment, this is working flawless.

@ajkerrigan @kapilt May you can have a look on this? This is production relevant for us. Thanks - and also thanks for this great project! :)

WhoAmI0501 commented 3 months ago

I am also facing this problem in a similar use case. As a workaround, i added some unused dummy dependencies to the projects, that are affected by this bug - but i think, that this workaround is very very hacky.

DBS-ST-VIT commented 3 months ago

I contributed a fix in https://github.com/cloud-custodian/poetry-plugin-freeze/pull/21 - in my environment, this is working flawless.

I also added some tests for my code, since i had some time left for that. The pytest output can be seen below:

========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.10.12, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/xxx/Desktop/poetry-plugin-freeze
plugins: cov-4.0.0, xdist-3.2.1
collected 6 items                                                                                                                                                                                        

tests/test_freeze.py ......                                                                                                                                                                        [100%]

---------- coverage: platform linux, python 3.10.12-final-0 ----------
Name                                   Stmts   Miss  Cover
----------------------------------------------------------
src/poetry_plugin_freeze/__init__.py       0      0   100%
src/poetry_plugin_freeze/app.py          208      6    97%
----------------------------------------------------------
TOTAL                                    208      6    97%

=========================================================================================== 6 passed in 2.29s ============================================================================================
enidisepic commented 3 months ago

+1 same issue here