cityjson / cjio

CityJSON/io: Python CLI to process and manipulate CityJSON files
MIT License
119 stars 31 forks source link

Deprecated Click Group.resultcallback #140

Closed pcace closed 2 years ago

pcace commented 2 years ago

Describe the bug cjio seems to not run on win11 with the following errormessage:

PS C:\Users\user> pip install 'cjio[export,reproject]'
Collecting cjio[export,reproject]
  Using cached cjio-0.7.3-py2.py3-none-any.whl (44 kB)
Requirement already satisfied: Click in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from cjio[export,reproject]) (8.1.3)
Requirement already satisfied: pyproj in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from cjio[export,reproject]) (3.2.1)
Requirement already satisfied: numpy in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from cjio[export,reproject]) (1.22.4)
Requirement already satisfied: mapbox-earcut in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from cjio[export,reproject]) (1.0.0)
Requirement already satisfied: pandas in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from cjio[export,reproject]) (1.4.2)
Requirement already satisfied: colorama in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from Click->cjio[export,reproject]) (0.4.4)
Requirement already satisfied: pytz>=2020.1 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from pandas->cjio[export,reproject]) (2022.1)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from pandas->cjio[export,reproject]) (2.8.2)
Requirement already satisfied: certifi in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from pyproj->cjio[export,reproject]) (2022.5.18.1)
Requirement already satisfied: six>=1.5 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from python-dateutil>=2.8.1->pandas->cjio[export,reproject]) (1.16.0)
Installing collected packages: cjio
Successfully installed cjio-0.7.3
PS C:\Users\user> cjio
Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\user\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\Scripts\cjio.exe\__main__.py", line 4, in <module>
  File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\cjio\cjio.py", line 58, in <module>
    @cli.resultcallback()
AttributeError: 'Group' object has no attribute 'resultcallback'
PS C:\Users\user>

tried with python3.7, 3.8 and 3.9

cjio version What does cjio --version print? Or did you install from a git branch?

 cjio --version
Traceback (most recent call last):
  File "c:\users\johannes\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\johannes\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Johannes\AppData\Local\Programs\Python\Python38\Scripts\cjio.exe\__main__.py", line 4, in <module>
  File "c:\users\johannes\appdata\local\programs\python\python38\lib\site-packages\cjio\cjio.py", line 58, in <module>
    @cli.resultcallback()
AttributeError: 'Group' object has no attribute 'resultcallback'

Desktop (please complete the following information):

balazsdukai commented 2 years ago

This affects Click >=8.1.0, see https://click.palletsprojects.com/en/8.1.x/changes/#version-8-1-0

balazsdukai commented 2 years ago

@pcace as a temporary workaround you could downgrade your Click library to < 8.1.0, until cjio is upgraded with the Click API changes.

kannes commented 2 years ago

On Ubuntu 20.04 this gave me:

$ pip install cjio
Collecting cjio
  Downloading cjio-0.7.4-py2.py3-none-any.whl (44 kB)
     |████████████████████████████████| 44 kB 2.1 MB/s 
Requirement already satisfied: Click in ./.local/lib/python3.8/site-packages (from cjio) (7.1.2)
Installing collected packages: cjio
Successfully installed cjio-0.7.4

$ cjio 
Traceback (most recent call last):
  File "/home/me/.local/bin/cjio", line 5, in <module>
    from cjio.cjio import cli
  File "/home/me/.local/lib/python3.8/site-packages/cjio/cjio.py", line 58, in <module>
    @cli.result_callback()
TypeError: 'NoneType' object is not callable

I could fix it with pip install --upgrade click which gave me click-8.1.3. I guess cjio needs to specify a new minimum click version?

hugoledoux commented 2 years ago

hmmm, I had tested this on macOS and it works with click=8.0.3, strange.

But still forcing 8.1 in future release (b7d85c27ae2e7ca88e4e3ad06e3b969ebf4f8cb8), thanks for reporting

kannes commented 2 years ago

Guess it happened between version 7 and that 8.1. :) Thanks!