Repository: muety/pyquadkey2 (language: python)

Issue:
Can´t install pyquadkey2 in Windows 10 Python 3.11.8
C:\Users\xxxx>pip install pyquadkey2
Collecting pyquadkey2
  Using cached pyquadkey2-0.2.2.tar.gz (60 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyquadkey2
  Building wheel for pyquadkey2 (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyquadkey2 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\pyquadkey2
      copying src\pyquadkey2\__init__.py -> build\lib.win-amd64-cpython-311\pyquadkey2
      creating build\lib.win-amd64-cpython-311\pyquadkey2\quadkey
      copying src\pyquadkey2\quadkey\util.py -> build\lib.win-amd64-cpython-311\pyquadkey2\quadkey
      copying src\pyquadkey2\quadkey\__init__.py -> build\lib.win-amd64-cpython-311\pyquadkey2\quadkey
      running build_ext
      building 'tilesystem' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\pyquadkey2
      creating build\temp.win-amd64-cpython-311\Release\src\pyquadkey2\quadkey
      creating build\temp.win-amd64-cpython-311\Release\src\pyquadkey2\quadkey\tilesystem
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcsrc/pyquadkey2/quadkey/tilesystem/tilesystem.c /Fobuild\temp.win-amd64-cpython-311\Release\src/pyquadkey2/quadkey/tilesystem/tilesystem.obj
      tilesystem.c
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c(3747): warning C4244: '=': conversi¢n de 'Py_ssize_t' a 'int'; posible p‚rdida de datos
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c(4128): warning C4244: '=': conversi¢n de 'long' a 'char'; posible p‚rdida de datos
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c(4313): warning C4244: '=': conversi¢n de 'Py_ssize_t' a 'int'; posible p‚rdida de datos
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c(7421): error C2037: a la izquierda de 'f_lineno' se especifica '_frame' struct/union sin definir
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyquadkey2
Failed to build pyquadkey2
ERROR: Could not build wheels for pyquadkey2, which is required to install pyproject.toml-based projects

![image](https://github.com/muety/pyquadkey2/assets/125850862/f9614a69-a91c-4f6c-997e-ca2a2d779f94)

Cannot install in python 3.11
Hi there - great project, really like it! It looks like it doesn't install with python 3.11 (at least on Apple Silicon) though:

```
Building wheels for collected packages: pyquadkey2
  Building wheel for pyquadkey2 (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-14.2-arm64-cpython-311
      creating build/lib.macosx-14.2-arm64-cpython-311/pyquadkey2
      copying src/pyquadkey2/__init__.py -> build/lib.macosx-14.2-arm64-cpython-311/pyquadkey2
      creating build/lib.macosx-14.2-arm64-cpython-311/pyquadkey2/quadkey
      copying src/pyquadkey2/quadkey/util.py -> build/lib.macosx-14.2-arm64-cpython-311/pyquadkey2/quadkey
      copying src/pyquadkey2/quadkey/__init__.py -> build/lib.macosx-14.2-arm64-cpython-311/pyquadkey2/quadkey
      running build_ext
      building 'tilesystem' extension
      creating build/temp.macosx-14.2-arm64-cpython-311
      creating build/temp.macosx-14.2-arm64-cpython-311/src
      creating build/temp.macosx-14.2-arm64-cpython-311/src/pyquadkey2
      creating build/temp.macosx-14.2-arm64-cpython-311/src/pyquadkey2/quadkey
      creating build/temp.macosx-14.2-arm64-cpython-311/src/pyquadkey2/quadkey/tilesystem
      clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/brendan/Projects/poibox/.venv/include -I/Users/brendan/.pyenv/versions/3.11.7/include/python3.11 -c src/pyquadkey2/quadkey/tilesystem/tilesystem.c -o build/temp.macosx-14.2-arm64-cpython-311/src/pyquadkey2/quadkey/tilesystem/tilesystem.o
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c:5488:43: warning: 'ob_shash' is deprecated [-Wdeprecated-declarations]
                  hash1 = ((PyBytesObject*)s1)->ob_shash;
                                                ^
      /Users/brendan/.pyenv/versions/3.11.7/include/python3.11/cpython/bytesobject.h:7:5: note: 'ob_shash' has been explicitly marked deprecated here
          Py_DEPRECATED(3.11) Py_hash_t ob_shash;
          ^
      /Users/brendan/.pyenv/versions/3.11.7/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c:5489:43: warning: 'ob_shash' is deprecated [-Wdeprecated-declarations]
                  hash2 = ((PyBytesObject*)s2)->ob_shash;
                                                ^
      /Users/brendan/.pyenv/versions/3.11.7/include/python3.11/cpython/bytesobject.h:7:5: note: 'ob_shash' has been explicitly marked deprecated here
          Py_DEPRECATED(3.11) Py_hash_t ob_shash;
          ^
      /Users/brendan/.pyenv/versions/3.11.7/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c:7421:5: error: incomplete definition of type 'struct _frame'
          __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/pyquadkey2/quadkey/tilesystem/tilesystem.c:603:62: note: expanded from macro '__Pyx_PyFrame_SetLineNumber'
        #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
                                                            ~~~~~~~^
      /Users/brendan/.pyenv/versions/3.11.7/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'struct _frame'
      typedef struct _frame PyFrameObject;
                     ^
      2 warnings and 1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyquadkey2
  Running setup.py clean for pyquadkey2
Failed to build pyquadkey2
ERROR: Could not build wheels for pyquadkey2, which is required to install pyproject.toml-based projects
```


Discussion / hints:

Fix patch:
diff --git a/requirements.txt b/requirements.txt
index 25638cf..29d1e6f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,1 +1,1 @@
-Cython==3.0a10
\ No newline at end of file
+Cython==3.0.9
diff --git a/setup.py b/setup.py
index a2313a4..b06b3d5 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@
 
 setup(
     name='pyquadkey2',
-    version='0.2.2',
+    version='0.3.2',
     description='Python implementation of geographical tiling using QuadKeys as proposed by Microsoft',
     long_description=long_description,
     long_description_content_type='text/markdown',


Test patch:
diff --git a/tests/tilesystem/test_tilesystem.py b/tests/tilesystem/test_tilesystem.py
index c236fac..d10bd77 100644
--- a/tests/tilesystem/test_tilesystem.py
+++ b/tests/tilesystem/test_tilesystem.py
@@ -1,8 +1,9 @@
 import sys
+import os
 import unittest
 from unittest import TestCase
 
-sys.path.append('../src')
+sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../src'))
 
 from pyquadkey2.quadkey import TileAnchor
 from pyquadkey2.quadkey.tilesystem import tilesystem