private-attribute-cpp 2.2.1__tar.gz → 2.2.2__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 (35) hide show
  1. private_attribute_cpp-2.2.2/CMakeLists.txt +89 -0
  2. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/PKG-INFO +2 -1
  3. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/README.md +1 -0
  4. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/pyproject.toml +1 -1
  5. private_attribute_cpp-2.2.1/CMakeLists.txt +0 -34
  6. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.github/dependabot.yml +0 -0
  7. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.github/workflows/build-android.yml +0 -0
  8. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.github/workflows/lint.yml +0 -0
  9. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.github/workflows/python-publish.yml +0 -0
  10. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.github/workflows/test.yml +0 -0
  11. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.github/workflows/update-bot.yml +0 -0
  12. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.gitignore +0 -0
  13. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.pre-commit-config.yaml +0 -0
  14. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/.update-bot/update_picosha2.py +0 -0
  15. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/LICENSE +0 -0
  16. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/ci/android/build_python.sh +0 -0
  17. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/ci/android/common.sh +0 -0
  18. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/ci/android/pydroid3.sh +0 -0
  19. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/ci/android/run.sh +0 -0
  20. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/ci/android/termux.sh +0 -0
  21. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/picosha2.h +0 -0
  22. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/private_attribute.cpp +0 -0
  23. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/private_attribute.pyi +0 -0
  24. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_attr_classify_owner.py +0 -0
  25. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_class_private_attrs.py +0 -0
  26. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_gc_collect.py +0 -0
  27. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_init_subclass.py +0 -0
  28. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_private_abc.py +0 -0
  29. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_private_attrs.py +0 -0
  30. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_private_func.py +0 -0
  31. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_private_inheritance.py +0 -0
  32. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_private_method.py +0 -0
  33. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_private_wrap.py +0 -0
  34. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_slots_cycle.py +0 -0
  35. {private_attribute_cpp-2.2.1 → private_attribute_cpp-2.2.2}/tests/test_use_parents.py +0 -0
@@ -0,0 +1,89 @@
1
+ cmake_minimum_required(VERSION 3.15...3.31)
2
+
3
+ project(private_attribute_cpp LANGUAGES CXX)
4
+
5
+ # Locate the running interpreter and its development headers/module support.
6
+ find_package(
7
+ Python
8
+ COMPONENTS Interpreter Development.Module
9
+ REQUIRED)
10
+
11
+ # Build the `private_attribute` extension module with a proper SOABI suffix
12
+ # (private_attribute.cpython-3XX[-t]-<plat>.so), importable from site-packages.
13
+ # Detect whether the running Python was built with --enable-shared.
14
+ execute_process(
15
+ COMMAND "${Python_EXECUTABLE}" -c
16
+ "import sysconfig; print(sysconfig.get_config_var('Py_ENABLE_SHARED') or 0)"
17
+ OUTPUT_VARIABLE PYTHON_ENABLE_SHARED
18
+ OUTPUT_STRIP_TRAILING_WHITESPACE
19
+ RESULT_VARIABLE PYTHON_CONFIG_RESULT
20
+ )
21
+
22
+ if(NOT PYTHON_CONFIG_RESULT EQUAL 0)
23
+ message(FATAL_ERROR "Failed to query Python build configuration")
24
+ endif()
25
+
26
+ if(WIN32)
27
+ # Windows: keep Python::Module to obtain the required import library.
28
+ Python_add_library(
29
+ private_attribute MODULE WITH_SOABI
30
+ private_attribute.cpp
31
+ )
32
+ elseif(PYTHON_ENABLE_SHARED STREQUAL "1")
33
+ # Keep the standard CMake Python extension-module behavior.
34
+ Python_add_library(
35
+ private_attribute MODULE WITH_SOABI
36
+ private_attribute.cpp
37
+ )
38
+ else()
39
+ # Match the usual Unix setuptools.Extension behavior:
40
+ # do not link the static libpython into the extension module.
41
+ add_library(
42
+ private_attribute MODULE
43
+ private_attribute.cpp
44
+ )
45
+
46
+ if(APPLE)
47
+ target_link_options(
48
+ private_attribute PRIVATE
49
+ "-undefined" "dynamic_lookup"
50
+ )
51
+ endif()
52
+
53
+ target_include_directories(
54
+ private_attribute PRIVATE
55
+ ${Python_INCLUDE_DIRS}
56
+ )
57
+
58
+ set_target_properties(
59
+ private_attribute PROPERTIES
60
+ PREFIX ""
61
+ SUFFIX ".${Python_SOABI}${CMAKE_SHARED_MODULE_SUFFIX}"
62
+ )
63
+
64
+ message(STATUS
65
+ "Python was built without --enable-shared; "
66
+ "building the extension without linking libpython"
67
+ )
68
+ endif()
69
+
70
+ # picosha2.h is a header-only dependency living next to the .cpp.
71
+ target_include_directories(private_attribute PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
72
+
73
+ # C++17, matching the original setup.py flags.
74
+ if(MSVC)
75
+ target_compile_options(private_attribute PRIVATE /std:c++17 /GR-)
76
+ else()
77
+ target_compile_options(private_attribute PRIVATE -std=c++17 -fno-exceptions -fno-rtti)
78
+ # Strip debug info unless the caller explicitly opts in to keeping it.
79
+ # (This is the conditional that a static pyproject.toml cannot express,
80
+ # hence it lives here in CMake instead of setup.py.)
81
+ if(NOT "$ENV{PRIVATE_ATTR_KEEP_DEBUG}" STREQUAL "1")
82
+ target_compile_options(private_attribute PRIVATE -g0)
83
+ endif()
84
+ endif()
85
+
86
+ # Install both the compiled module and its PEP 561 type stub at the
87
+ # site-packages root, side by side.
88
+ install(TARGETS private_attribute LIBRARY DESTINATION .)
89
+ install(FILES private_attribute.pyi DESTINATION .)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: private_attribute_cpp
3
- Version: 2.2.1
3
+ Version: 2.2.2
4
4
  Summary: A Python package that provides a way to define private attributes in C++ implementation.
5
5
  Author-Email: HuangHaoHua <13140752715@example.com>
6
6
  License-Expression: MIT
@@ -248,6 +248,7 @@ TypeError: Can't instantiate abstract class MyClass without an implementation fo
248
248
  - CPython may change "tp_getattro", "tp_setattro" and so on when you change the attribute "\_\_getattribute\_\_", "\_\_setattr\_\_" and so on. If you are fear about it, you can use `ensure_type` to reset those tp slots. For the other metaclasses, you can use `ensure_metaclass` to reset those tp slots. Also, don't set those methods on these classes in your code.
249
249
  - `private_attribute.register_metaclass` must be called with the metaclass which supports weakref.
250
250
  - Don't set `__static_attributes__` in private attribute class, or it will be removed.
251
+ - After 2.2.1, when `prepare` was called, it will lock the creation of new private attribute type. There will be only one private attribute type in building (type.\_\_new\_\_) at the same time. Call `postprocess` to unlock it. If build failed, the lock will be released automatically.
251
252
 
252
253
  ## License
253
254
 
@@ -238,6 +238,7 @@ TypeError: Can't instantiate abstract class MyClass without an implementation fo
238
238
  - CPython may change "tp_getattro", "tp_setattro" and so on when you change the attribute "\_\_getattribute\_\_", "\_\_setattr\_\_" and so on. If you are fear about it, you can use `ensure_type` to reset those tp slots. For the other metaclasses, you can use `ensure_metaclass` to reset those tp slots. Also, don't set those methods on these classes in your code.
239
239
  - `private_attribute.register_metaclass` must be called with the metaclass which supports weakref.
240
240
  - Don't set `__static_attributes__` in private attribute class, or it will be removed.
241
+ - After 2.2.1, when `prepare` was called, it will lock the creation of new private attribute type. There will be only one private attribute type in building (type.\_\_new\_\_) at the same time. Call `postprocess` to unlock it. If build failed, the lock will be released automatically.
241
242
 
242
243
  ## License
243
244
 
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "private_attribute_cpp"
7
- version = "2.2.1"
7
+ version = "2.2.2"
8
8
  description = "A Python package that provides a way to define private attributes in C++ implementation."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,34 +0,0 @@
1
- cmake_minimum_required(VERSION 3.15...3.31)
2
-
3
- project(private_attribute_cpp LANGUAGES CXX)
4
-
5
- # Locate the running interpreter and its development headers/module support.
6
- find_package(
7
- Python
8
- COMPONENTS Interpreter Development.Module
9
- REQUIRED)
10
-
11
- # Build the `private_attribute` extension module with a proper SOABI suffix
12
- # (private_attribute.cpython-3XX[-t]-<plat>.so), importable from site-packages.
13
- Python_add_library(private_attribute MODULE WITH_SOABI private_attribute.cpp)
14
-
15
- # picosha2.h is a header-only dependency living next to the .cpp.
16
- target_include_directories(private_attribute PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
17
-
18
- # C++17, matching the original setup.py flags.
19
- if(MSVC)
20
- target_compile_options(private_attribute PRIVATE /std:c++17 /GR-)
21
- else()
22
- target_compile_options(private_attribute PRIVATE -std=c++17 -fno-exceptions -fno-rtti)
23
- # Strip debug info unless the caller explicitly opts in to keeping it.
24
- # (This is the conditional that a static pyproject.toml cannot express,
25
- # hence it lives here in CMake instead of setup.py.)
26
- if(NOT "$ENV{PRIVATE_ATTR_KEEP_DEBUG}" STREQUAL "1")
27
- target_compile_options(private_attribute PRIVATE -g0)
28
- endif()
29
- endif()
30
-
31
- # Install both the compiled module and its PEP 561 type stub at the
32
- # site-packages root, side by side.
33
- install(TARGETS private_attribute LIBRARY DESTINATION .)
34
- install(FILES private_attribute.pyi DESTINATION .)