sailpy 0.9.10__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.
Files changed (51) hide show
  1. sailpy-0.9.10/CMakeLists.txt +121 -0
  2. sailpy-0.9.10/LICENSE +21 -0
  3. sailpy-0.9.10/MANIFEST.in +25 -0
  4. sailpy-0.9.10/PKG-INFO +690 -0
  5. sailpy-0.9.10/README.md +681 -0
  6. sailpy-0.9.10/sailpy/__init__.py +131 -0
  7. sailpy-0.9.10/sailpy/__main__.py +67 -0
  8. sailpy-0.9.10/sailpy/examples/01_quickstart.py +71 -0
  9. sailpy-0.9.10/sailpy/examples/02_memory_io.py +253 -0
  10. sailpy-0.9.10/sailpy/examples/03_features_and_options.py +333 -0
  11. sailpy-0.9.10/sailpy/examples/04_numpy_integration.py +124 -0
  12. sailpy-0.9.10/sailpy/examples/05_multiframe.py +108 -0
  13. sailpy-0.9.10/sailpy/examples/06_probe.py +87 -0
  14. sailpy-0.9.10/sailpy/examples/07_codec_info.py +102 -0
  15. sailpy-0.9.10/sailpy/examples/08_logging.py +121 -0
  16. sailpy-0.9.10/sailpy/examples/09_image_transformations.py +89 -0
  17. sailpy-0.9.10/sailpy/examples/10_enum_usage.py +134 -0
  18. sailpy-0.9.10/sailpy/examples/11_advanced_saving.py +177 -0
  19. sailpy-0.9.10/sailpy/examples/12_image_viewer.py +414 -0
  20. sailpy-0.9.10/sailpy/examples/__init__.py +29 -0
  21. sailpy-0.9.10/sailpy/py.typed +3 -0
  22. sailpy-0.9.10/sailpy.egg-info/SOURCES.txt +48 -0
  23. sailpy-0.9.10/setup.cfg +4 -0
  24. sailpy-0.9.10/setup.py +219 -0
  25. sailpy-0.9.10/src/codec_bindings.cpp +211 -0
  26. sailpy-0.9.10/src/core_bindings.cpp +272 -0
  27. sailpy-0.9.10/src/enums_bindings.cpp +415 -0
  28. sailpy-0.9.10/src/image_bindings.cpp +826 -0
  29. sailpy-0.9.10/src/log_bindings.cpp +134 -0
  30. sailpy-0.9.10/src/options_bindings.cpp +92 -0
  31. sailpy-0.9.10/src/sail_python.cpp +52 -0
  32. sailpy-0.9.10/tests/test_basic.py +153 -0
  33. sailpy-0.9.10/tests/test_codec_info.py +187 -0
  34. sailpy-0.9.10/tests/test_core_classes.py +421 -0
  35. sailpy-0.9.10/tests/test_edge_cases.py +258 -0
  36. sailpy-0.9.10/tests/test_features.py +311 -0
  37. sailpy-0.9.10/tests/test_image_formats.py +283 -0
  38. sailpy-0.9.10/tests/test_image_transformations.py +565 -0
  39. sailpy-0.9.10/tests/test_loading_api.py +139 -0
  40. sailpy-0.9.10/tests/test_loading_api_advanced.py +178 -0
  41. sailpy-0.9.10/tests/test_logging.py +205 -0
  42. sailpy-0.9.10/tests/test_multiframe.py +246 -0
  43. sailpy-0.9.10/tests/test_numpy_integration.py +313 -0
  44. sailpy-0.9.10/tests/test_options.py +345 -0
  45. sailpy-0.9.10/tests/test_pixel_formats.py +211 -0
  46. sailpy-0.9.10/tests/test_regression.py +170 -0
  47. sailpy-0.9.10/tests/test_roundtrip.py +315 -0
  48. sailpy-0.9.10/tests/test_saving_api.py +112 -0
  49. sailpy-0.9.10/tests/test_saving_api_advanced.py +491 -0
  50. sailpy-0.9.10/tests/test_threading.py +177 -0
  51. sailpy-0.9.10/tests/test_to_bytes.py +218 -0
@@ -0,0 +1,121 @@
1
+ cmake_minimum_required(VERSION 3.18) # Require CMake 3.18 or later for SAIL
2
+ project(sail-python)
3
+
4
+ # Require C++14 (for pybind11)
5
+ set(CMAKE_CXX_STANDARD 14)
6
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
7
+
8
+ # Use Python executable if provided, otherwise find it
9
+ if (PYTHON_EXECUTABLE)
10
+ set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
11
+ endif()
12
+ find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
13
+ find_package(pybind11 CONFIG)
14
+
15
+ if (NOT pybind11_FOUND)
16
+ message(STATUS "pybind11 not found, fetching from GitHub")
17
+ include(FetchContent)
18
+ FetchContent_Declare(
19
+ pybind11
20
+ GIT_REPOSITORY https://github.com/pybind/pybind11.git
21
+ GIT_TAG v2.11.1
22
+ )
23
+ FetchContent_MakeAvailable(pybind11)
24
+ endif()
25
+
26
+ if (NOT TARGET sail)
27
+ if (NOT DEFINED SAIL_ALREADY_INCLUDED)
28
+ # Try to find SAIL root directory
29
+ if (DEFINED SAIL_ROOT_DIR AND EXISTS "${SAIL_ROOT_DIR}/CMakeLists.txt")
30
+ set(SAIL_SOURCE_DIR "${SAIL_ROOT_DIR}")
31
+ else()
32
+ set(SAIL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
33
+ endif()
34
+
35
+ if (NOT EXISTS "${SAIL_SOURCE_DIR}/CMakeLists.txt")
36
+ message(FATAL_ERROR
37
+ "Cannot find SAIL root directory with CMakeLists.txt.\n"
38
+ "Looked in: ${SAIL_SOURCE_DIR}\n"
39
+ "\n"
40
+ "This package cannot be built from PyPI source distribution.\n"
41
+ "Please either:\n"
42
+ " 1. Build from the SAIL git repository\n"
43
+ " 2. Install pre-built wheels: pip install sailpy\n"
44
+ "\n"
45
+ "To build from source:\n"
46
+ " git clone https://github.com/HappySeaFox/sail\n"
47
+ " cd sail/src/bindings/python\n"
48
+ " pip install -e .\n"
49
+ )
50
+ endif()
51
+
52
+ message(STATUS "Building SAIL from: ${SAIL_SOURCE_DIR}")
53
+
54
+ set(SAIL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
55
+ set(SAIL_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
56
+ set(SAIL_BUILD_APPS OFF CACHE BOOL "" FORCE)
57
+ set(SAIL_BUILD_BINDINGS ON CACHE BOOL "" FORCE) # Need C++ bindings
58
+ set(SAIL_COMBINE_CODECS ON CACHE BOOL "" FORCE) # Combine all codecs into one library
59
+ add_subdirectory(${SAIL_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/sail-build EXCLUDE_FROM_ALL)
60
+ set(SAIL_ALREADY_INCLUDED YES)
61
+ endif()
62
+ endif()
63
+
64
+ # Get SAIL version from parent project
65
+ get_directory_property(SAIL_VERSION DIRECTORY ${SAIL_SOURCE_DIR} DEFINITION PROJECT_VERSION)
66
+ message(STATUS "SAIL version: ${SAIL_VERSION}")
67
+
68
+ # Generate pyproject.toml with version
69
+ configure_file(
70
+ ${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml.in
71
+ ${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml
72
+ @ONLY
73
+ )
74
+
75
+ set(PYTHON_BINDING_SOURCES
76
+ src/codec_bindings.cpp
77
+ src/core_bindings.cpp
78
+ src/enums_bindings.cpp
79
+ src/image_bindings.cpp
80
+ src/log_bindings.cpp
81
+ src/options_bindings.cpp
82
+ src/sail_python.cpp
83
+ )
84
+
85
+ pybind11_add_module(_libsail ${PYTHON_BINDING_SOURCES})
86
+
87
+ target_link_libraries(_libsail PRIVATE
88
+ sail
89
+ sail-c++
90
+ sail-common
91
+ sail-manip
92
+ )
93
+
94
+ if (MSVC)
95
+ target_compile_options(_libsail PRIVATE "/EHsc")
96
+ endif()
97
+
98
+ target_include_directories(_libsail PRIVATE
99
+ ${CMAKE_SOURCE_DIR}/src
100
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../..
101
+ ${CMAKE_CURRENT_BINARY_DIR}/sail-build/include # Generated config.h
102
+ )
103
+
104
+ install(TARGETS _libsail
105
+ LIBRARY DESTINATION ${Python3_SITEARCH}/sailpy
106
+ RUNTIME DESTINATION ${Python3_SITEARCH}/sailpy
107
+ )
108
+
109
+ install(DIRECTORY sailpy/
110
+ DESTINATION ${Python3_SITEARCH}/sailpy
111
+ FILES_MATCHING PATTERN "*.py"
112
+ )
113
+
114
+ if (BUILD_TESTING)
115
+ enable_testing()
116
+ add_test(
117
+ NAME python_tests
118
+ COMMAND ${Python3_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests
119
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
120
+ )
121
+ endif()
sailpy-0.9.10/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2020-2025 Dmitry Baryshev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # This file is used for source distributions (sdist) only.
2
+ # Binary wheel content is controlled by pyproject.toml [tool.setuptools.package-data]
3
+
4
+ # Include documentation
5
+ include README.md
6
+ include LICENSE
7
+
8
+ # Include configuration files needed for sdist build
9
+ include pyproject.toml
10
+ include setup.py
11
+ include CMakeLists.txt
12
+
13
+ # Include all C++ source files for building from source
14
+ recursive-include src *.cpp *.h *.hpp
15
+
16
+ # Exclude build artifacts and cache
17
+ global-exclude *.pyc
18
+ global-exclude *.pyo
19
+ global-exclude __pycache__
20
+ prune build
21
+ prune dist
22
+ prune wheelhouse
23
+ prune venv
24
+ prune .pytest_cache
25
+ prune *.egg-info