togo 0.1.4__tar.gz → 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of togo might be problematic. Click here for more details.

Files changed (32) hide show
  1. togo-0.1.5/MANIFEST.in +4 -0
  2. {togo-0.1.4/togo.egg-info → togo-0.1.5}/PKG-INFO +25 -1
  3. {togo-0.1.4 → togo-0.1.5}/README.md +24 -0
  4. {togo-0.1.4 → togo-0.1.5}/pyproject.toml +8 -1
  5. togo-0.1.5/setup.py +74 -0
  6. {togo-0.1.4 → togo-0.1.5}/togo.c +13 -6
  7. {togo-0.1.4 → togo-0.1.5/togo.egg-info}/PKG-INFO +25 -1
  8. {togo-0.1.4 → togo-0.1.5}/togo.egg-info/SOURCES.txt +5 -1
  9. togo-0.1.5/vendor/geos/local/include/geos/export.h +51 -0
  10. togo-0.1.5/vendor/geos/local/include/geos_c.h +6742 -0
  11. togo-0.1.5/vendor/geos/local/lib/libgeos.a +0 -0
  12. togo-0.1.5/vendor/geos/local/lib/libgeos_c.a +0 -0
  13. togo-0.1.4/MANIFEST.in +0 -5
  14. togo-0.1.4/setup.py +0 -65
  15. {togo-0.1.4 → togo-0.1.5}/LICENSE +0 -0
  16. {togo-0.1.4 → togo-0.1.5}/setup.cfg +0 -0
  17. {togo-0.1.4 → togo-0.1.5}/tests/test_factories.py +0 -0
  18. {togo-0.1.4 → togo-0.1.5}/tests/test_geometries.py +0 -0
  19. {togo-0.1.4 → togo-0.1.5}/tests/test_geometry.py +0 -0
  20. {togo-0.1.4 → togo-0.1.5}/tests/test_line.py +0 -0
  21. {togo-0.1.4 → togo-0.1.5}/tests/test_point.py +0 -0
  22. {togo-0.1.4 → togo-0.1.5}/tests/test_poly.py +0 -0
  23. {togo-0.1.4 → togo-0.1.5}/tests/test_rect.py +0 -0
  24. {togo-0.1.4 → togo-0.1.5}/tests/test_ring.py +0 -0
  25. {togo-0.1.4 → togo-0.1.5}/tests/test_segment.py +0 -0
  26. {togo-0.1.4 → togo-0.1.5}/tg.c +0 -0
  27. {togo-0.1.4 → togo-0.1.5}/tg.h +0 -0
  28. {togo-0.1.4 → togo-0.1.5}/tgx.c +0 -0
  29. {togo-0.1.4 → togo-0.1.5}/tgx.h +0 -0
  30. {togo-0.1.4 → togo-0.1.5}/togo.egg-info/dependency_links.txt +0 -0
  31. {togo-0.1.4 → togo-0.1.5}/togo.egg-info/top_level.txt +0 -0
  32. {togo-0.1.4 → togo-0.1.5}/togo.pyx +0 -0
togo-0.1.5/MANIFEST.in ADDED
@@ -0,0 +1,4 @@
1
+ graft vendor
2
+ include *.pyx
3
+ include *.c
4
+ include *.h
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: togo
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Lightweight Python bindings for the TG geometry library
5
5
  Author-email: Giorgio Salluzzo <giorgio.salluzzo@gmail.com>
6
6
  License: MIT
@@ -242,6 +242,30 @@ from togo import TGIndex, set_polygon_indexing_mode
242
242
  set_polygon_indexing_mode(TGIndex.NATURAL) # or NONE, YSTRIPES
243
243
  ```
244
244
 
245
+ ## Integration with tgx and libgeos
246
+
247
+ Togo integrates with the [tgx](https://github.com/tidwall/tgx) extension and [libgeos](https://libgeos.org/) to provide advanced geometry operations, such as topological unions and conversions between TG and GEOS geometry formats. This allows you to leverage the speed of TG for basic operations and the flexibility of GEOS for more complex tasks.
248
+
249
+ ### Example: Unary Union (GEOS integration)
250
+
251
+ The `unary_union` method demonstrates this integration. It combines multiple geometries into a single geometry using GEOS's topological union, with all conversions handled automatically:
252
+
253
+ ```python
254
+ from togo import Geometry, Point, Poly, Ring
255
+
256
+ # Create several polygons
257
+ poly1 = Poly(Ring([(0,0), (2,0), (2,2), (0,2), (0,0)]))
258
+ poly2 = Poly(Ring([(1,1), (3,1), (3,3), (1,3), (1,1)]))
259
+
260
+ # Perform unary union (requires tgx and libgeos)
261
+ union = Geometry.unary_union([poly1, poly2])
262
+
263
+ # The result is a single geometry representing the union of the input polygons
264
+ print(union.to_wkt())
265
+ ```
266
+
267
+ This operation uses `tgx` to convert `TG` geometries to `GEOS`, applies the union in `libgeos`, and converts the result back to `TG` format for further use in `ToGo`.
268
+
245
269
  ## Performance Considerations
246
270
 
247
271
  - Togo is optimized for speed and memory efficiency
@@ -222,6 +222,30 @@ from togo import TGIndex, set_polygon_indexing_mode
222
222
  set_polygon_indexing_mode(TGIndex.NATURAL) # or NONE, YSTRIPES
223
223
  ```
224
224
 
225
+ ## Integration with tgx and libgeos
226
+
227
+ Togo integrates with the [tgx](https://github.com/tidwall/tgx) extension and [libgeos](https://libgeos.org/) to provide advanced geometry operations, such as topological unions and conversions between TG and GEOS geometry formats. This allows you to leverage the speed of TG for basic operations and the flexibility of GEOS for more complex tasks.
228
+
229
+ ### Example: Unary Union (GEOS integration)
230
+
231
+ The `unary_union` method demonstrates this integration. It combines multiple geometries into a single geometry using GEOS's topological union, with all conversions handled automatically:
232
+
233
+ ```python
234
+ from togo import Geometry, Point, Poly, Ring
235
+
236
+ # Create several polygons
237
+ poly1 = Poly(Ring([(0,0), (2,0), (2,2), (0,2), (0,0)]))
238
+ poly2 = Poly(Ring([(1,1), (3,1), (3,3), (1,3), (1,1)]))
239
+
240
+ # Perform unary union (requires tgx and libgeos)
241
+ union = Geometry.unary_union([poly1, poly2])
242
+
243
+ # The result is a single geometry representing the union of the input polygons
244
+ print(union.to_wkt())
245
+ ```
246
+
247
+ This operation uses `tgx` to convert `TG` geometries to `GEOS`, applies the union in `libgeos`, and converts the result back to `TG` format for further use in `ToGo`.
248
+
225
249
  ## Performance Considerations
226
250
 
227
251
  - Togo is optimized for speed and memory efficiency
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
8
8
 
9
9
  [project]
10
10
  name = "togo"
11
- version = "0.1.4"
11
+ version = "0.1.5"
12
12
  description = "Lightweight Python bindings for the TG geometry library"
13
13
  readme = "README.md"
14
14
  authors = [
@@ -36,3 +36,10 @@ pythonpath = ["."]
36
36
 
37
37
  [tool.cython-lint]
38
38
  max-line-length = 100
39
+
40
+ [tool.cibuildwheel]
41
+ #skip = ["*-musllinux_*"]
42
+ build-verbosity = 1
43
+ before-build = "bash tools/prepare_vendor.sh"
44
+ # Compute platform ID from CIBW_BUILD and point LD_LIBRARY_PATH at the right vendor dir for repair
45
+ repair-wheel-command = "PLATFORM_ID=$(echo \"$CIBW_BUILD\" | cut -d- -f2-); LD_LIBRARY_PATH=/project/vendor/geos/${PLATFORM_ID}/lib auditwheel repair -w {dest_dir} {wheel}"
togo-0.1.5/setup.py ADDED
@@ -0,0 +1,74 @@
1
+ import os
2
+
3
+ from setuptools import setup, Extension
4
+ from Cython.Build import cythonize
5
+
6
+
7
+ def _platform_id():
8
+ tag = os.environ.get("CIBW_BUILD", "local")
9
+ return tag.split("-", 1)[1] if "-" in tag else tag
10
+
11
+
12
+ extra_compile_args = [
13
+ "-ffunction-sections", # Enable function-level sections
14
+ "-fdata-sections", # Enable data-level sections
15
+ ]
16
+ # Avoid gc-sections when statically linking C++ libs with RTTI/vtables
17
+ extra_link_args = [
18
+ # intentionally no --gc-sections
19
+ "-lstdc++", # Link against C++ standard library
20
+ ]
21
+
22
+ # Enable optional AddressSanitizer build via env var ASAN=1
23
+ if os.environ.get("ASAN") == "1":
24
+ # Favor debuggability over speed
25
+ extra_compile_args += [
26
+ "-O1",
27
+ "-g",
28
+ "-fno-omit-frame-pointer",
29
+ "-fsanitize=address",
30
+ ]
31
+ extra_link_args += [
32
+ "-fsanitize=address",
33
+ ]
34
+
35
+ repo_root = os.path.abspath(os.path.dirname(__file__))
36
+ plat_id = _platform_id()
37
+
38
+ # Prefer platform-specific vendor path, fall back to legacy flat layout
39
+ cand_include = os.path.join(repo_root, "vendor", "geos", plat_id, "include")
40
+ cand_lib = os.path.join(repo_root, "vendor", "geos", plat_id, "lib")
41
+ if os.path.isdir(cand_include) and os.path.isdir(cand_lib):
42
+ geos_include = cand_include
43
+ geos_lib = cand_lib
44
+ else:
45
+ geos_include = os.path.join(repo_root, "vendor", "geos", "include")
46
+ geos_lib = os.path.join(repo_root, "vendor", "geos", "lib")
47
+
48
+ setup(
49
+ ext_modules=cythonize(
50
+ [
51
+ Extension(
52
+ "togo",
53
+ sources=["togo.pyx", "tg.c", "tgx.c"],
54
+ include_dirs=[
55
+ ".", # For tg.h and tgx.h
56
+ geos_include,
57
+ ],
58
+ # Link static archives as whole-archive to keep all needed RTTI/vtables
59
+ extra_compile_args=extra_compile_args,
60
+ extra_link_args=[
61
+ "-Wl,--whole-archive",
62
+ os.path.join(geos_lib, "libgeos_c.a"),
63
+ os.path.join(geos_lib, "libgeos.a"),
64
+ "-Wl,--no-whole-archive",
65
+ ]
66
+ + extra_link_args,
67
+ )
68
+ ]
69
+ ),
70
+ # Explicitly disable auto-discovery in flat layout
71
+ packages=[],
72
+ py_modules=[],
73
+ license="MIT",
74
+ )
@@ -4,17 +4,24 @@
4
4
  {
5
5
  "distutils": {
6
6
  "depends": [
7
- "/usr/include/geos_c.h",
7
+ "/home/employee/repos/togo/vendor/geos/local/include/geos_c.h",
8
8
  "tg.h",
9
9
  "tgx.h"
10
10
  ],
11
+ "extra_compile_args": [
12
+ "-ffunction-sections",
13
+ "-fdata-sections"
14
+ ],
15
+ "extra_link_args": [
16
+ "-Wl,--whole-archive",
17
+ "/home/employee/repos/togo/vendor/geos/local/lib/libgeos_c.a",
18
+ "/home/employee/repos/togo/vendor/geos/local/lib/libgeos.a",
19
+ "-Wl,--no-whole-archive",
20
+ "-lstdc++"
21
+ ],
11
22
  "include_dirs": [
12
23
  ".",
13
- "/usr/include",
14
- "/usr/include/geos"
15
- ],
16
- "libraries": [
17
- "geos_c"
24
+ "/home/employee/repos/togo/vendor/geos/local/include"
18
25
  ],
19
26
  "name": "togo",
20
27
  "sources": [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: togo
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Lightweight Python bindings for the TG geometry library
5
5
  Author-email: Giorgio Salluzzo <giorgio.salluzzo@gmail.com>
6
6
  License: MIT
@@ -242,6 +242,30 @@ from togo import TGIndex, set_polygon_indexing_mode
242
242
  set_polygon_indexing_mode(TGIndex.NATURAL) # or NONE, YSTRIPES
243
243
  ```
244
244
 
245
+ ## Integration with tgx and libgeos
246
+
247
+ Togo integrates with the [tgx](https://github.com/tidwall/tgx) extension and [libgeos](https://libgeos.org/) to provide advanced geometry operations, such as topological unions and conversions between TG and GEOS geometry formats. This allows you to leverage the speed of TG for basic operations and the flexibility of GEOS for more complex tasks.
248
+
249
+ ### Example: Unary Union (GEOS integration)
250
+
251
+ The `unary_union` method demonstrates this integration. It combines multiple geometries into a single geometry using GEOS's topological union, with all conversions handled automatically:
252
+
253
+ ```python
254
+ from togo import Geometry, Point, Poly, Ring
255
+
256
+ # Create several polygons
257
+ poly1 = Poly(Ring([(0,0), (2,0), (2,2), (0,2), (0,0)]))
258
+ poly2 = Poly(Ring([(1,1), (3,1), (3,3), (1,3), (1,1)]))
259
+
260
+ # Perform unary union (requires tgx and libgeos)
261
+ union = Geometry.unary_union([poly1, poly2])
262
+
263
+ # The result is a single geometry representing the union of the input polygons
264
+ print(union.to_wkt())
265
+ ```
266
+
267
+ This operation uses `tgx` to convert `TG` geometries to `GEOS`, applies the union in `libgeos`, and converts the result back to `TG` format for further use in `ToGo`.
268
+
245
269
  ## Performance Considerations
246
270
 
247
271
  - Togo is optimized for speed and memory efficiency
@@ -21,4 +21,8 @@ tests/test_segment.py
21
21
  togo.egg-info/PKG-INFO
22
22
  togo.egg-info/SOURCES.txt
23
23
  togo.egg-info/dependency_links.txt
24
- togo.egg-info/top_level.txt
24
+ togo.egg-info/top_level.txt
25
+ vendor/geos/local/include/geos_c.h
26
+ vendor/geos/local/include/geos/export.h
27
+ vendor/geos/local/lib/libgeos.a
28
+ vendor/geos/local/lib/libgeos_c.a
@@ -0,0 +1,51 @@
1
+ /**********************************************************************
2
+ *
3
+ * GEOS - Geometry Engine Open Source
4
+ * http://geos.osgeo.org
5
+ *
6
+ * Copyright (C) 2009 Ragi Y. Burhum <ragi@burhum.com>
7
+ *
8
+ * This is free software; you can redistribute and/or modify it under
9
+ * the terms of the GNU Lesser General Public Licence as published
10
+ * by the Free Software Foundation.
11
+ * See the COPYING file for more information.
12
+ *
13
+ **********************************************************************/
14
+ #pragma once
15
+
16
+ #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || \
17
+ defined( __BCPLUSPLUS__) || defined( __MWERKS__)
18
+
19
+ # if defined(GEOS_DLL_EXPORT)
20
+ # define GEOS_DLL __declspec(dllexport)
21
+ # elif defined(GEOS_DLL_IMPORT)
22
+ # define GEOS_DLL extern __declspec(dllimport)
23
+ # else
24
+ # define GEOS_DLL
25
+ # endif
26
+ #else
27
+ # define GEOS_DLL
28
+ #endif
29
+
30
+
31
+ #if defined(_MSC_VER)
32
+ # pragma warning(disable: 4251) // identifier : class type needs to have dll-interface to be used by clients of class type2
33
+ #endif
34
+
35
+
36
+ /**********************************************************************
37
+ * Portability macros
38
+ **********************************************************************/
39
+
40
+ #ifdef _MSC_VER
41
+ #include <sal.h>
42
+ #define GEOS_PRINTF_FORMAT _Printf_format_string_
43
+ #define GEOS_PRINTF_FORMAT_ATTR(format_param, dots_param) /**/
44
+ #elif __GNUC__
45
+ #define GEOS_PRINTF_FORMAT /**/
46
+ #define GEOS_PRINTF_FORMAT_ATTR(format_param, dots_param) \
47
+ __attribute__((format(printf, format_param, dots_param)))
48
+ #else
49
+ #define GEOS_PRINTF_FORMAT /**/
50
+ #define GEOS_PRINTF_FORMAT_ATTR(format_param, dots_param) /**/
51
+ #endif