hapc 0.1.2__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.
Files changed (41) hide show
  1. {hapc-0.1.2/python/hapc.egg-info → hapc-0.1.5}/PKG-INFO +3 -4
  2. {hapc-0.1.2 → hapc-0.1.5}/pyproject.toml +3 -3
  3. {hapc-0.1.2 → hapc-0.1.5}/python/hapc/__init__.py +1 -1
  4. {hapc-0.1.2 → hapc-0.1.5}/python/hapc/core.py +8 -32
  5. {hapc-0.1.2 → hapc-0.1.5/python/hapc.egg-info}/PKG-INFO +3 -4
  6. {hapc-0.1.2 → hapc-0.1.5}/setup.py +36 -21
  7. {hapc-0.1.2 → hapc-0.1.5}/CMakeLists.txt +0 -0
  8. {hapc-0.1.2 → hapc-0.1.5}/LICENSE +0 -0
  9. {hapc-0.1.2 → hapc-0.1.5}/MANIFEST.in +0 -0
  10. {hapc-0.1.2 → hapc-0.1.5}/README.md +0 -0
  11. {hapc-0.1.2 → hapc-0.1.5}/python/demo_single.py +0 -0
  12. {hapc-0.1.2 → hapc-0.1.5}/python/hapc/cv.py +0 -0
  13. {hapc-0.1.2 → hapc-0.1.5}/python/hapc/single.py +0 -0
  14. {hapc-0.1.2 → hapc-0.1.5}/python/hapc.egg-info/SOURCES.txt +0 -0
  15. {hapc-0.1.2 → hapc-0.1.5}/python/hapc.egg-info/dependency_links.txt +0 -0
  16. {hapc-0.1.2 → hapc-0.1.5}/python/hapc.egg-info/requires.txt +0 -0
  17. {hapc-0.1.2 → hapc-0.1.5}/python/hapc.egg-info/top_level.txt +0 -0
  18. {hapc-0.1.2 → hapc-0.1.5}/python/test_install.py +0 -0
  19. {hapc-0.1.2 → hapc-0.1.5}/setup.cfg +0 -0
  20. {hapc-0.1.2 → hapc-0.1.5}/src/bindings.cpp +0 -0
  21. {hapc-0.1.2 → hapc-0.1.5}/src/cross_kernel.cpp +0 -0
  22. {hapc-0.1.2 → hapc-0.1.5}/src/cv_classi.cpp +0 -0
  23. {hapc-0.1.2 → hapc-0.1.5}/src/cv_fast_pchal.cpp +0 -0
  24. {hapc-0.1.2 → hapc-0.1.5}/src/cv_fast_pchal_python.cpp +0 -0
  25. {hapc-0.1.2 → hapc-0.1.5}/src/fast_pchal.cpp +0 -0
  26. {hapc-0.1.2 → hapc-0.1.5}/src/hapc_core.hpp +0 -0
  27. {hapc-0.1.2 → hapc-0.1.5}/src/logistic_call.cpp +0 -0
  28. {hapc-0.1.2 → hapc-0.1.5}/src/mkernel.cpp +0 -0
  29. {hapc-0.1.2 → hapc-0.1.5}/src/pcghal_call.cpp +0 -0
  30. {hapc-0.1.2 → hapc-0.1.5}/src/pcghal_classi_call.cpp +0 -0
  31. {hapc-0.1.2 → hapc-0.1.5}/src/pcghal_cv.cpp +0 -0
  32. {hapc-0.1.2 → hapc-0.1.5}/src/pcghal_cv_cpp.cpp +0 -0
  33. {hapc-0.1.2 → hapc-0.1.5}/src/pchal_design.cpp +0 -0
  34. {hapc-0.1.2 → hapc-0.1.5}/src/r_bindings.cpp +0 -0
  35. {hapc-0.1.2 → hapc-0.1.5}/src/ridge_wrappers.cpp +0 -0
  36. {hapc-0.1.2 → hapc-0.1.5}/src/single_pcghal.cpp +0 -0
  37. {hapc-0.1.2 → hapc-0.1.5}/src/single_pcghal_cpp.cpp +0 -0
  38. {hapc-0.1.2 → hapc-0.1.5}/src/single_pchar.cpp +0 -0
  39. {hapc-0.1.2 → hapc-0.1.5}/tests/test_api.py +0 -0
  40. {hapc-0.1.2 → hapc-0.1.5}/tests/test_core.py +0 -0
  41. {hapc-0.1.2 → hapc-0.1.5}/tests/test_r_vs_python_alpha.py +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hapc
3
- Version: 0.1.2
4
- Summary: Hierarchical Additive Polynomial Complexity regression
3
+ Version: 0.1.5
4
+ Summary: Highly Adaptive Principal Components
5
5
  Home-page: https://github.com/meixide/hapc
6
6
  Author: Carlos García Meixide
7
7
  Author-email: Carlos García Meixide <cgmeixide@gmail.com>
8
- License: YEAR: 2025
9
- COPYRIGHT HOLDER: Carlos García Meixide
8
+ License: MIT
10
9
  Project-URL: Homepage, https://github.com/meixide/hapc
11
10
  Project-URL: Documentation, https://github.com/meixide/hapc#readme
12
11
  Project-URL: Repository, https://github.com/meixide/hapc.git
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hapc"
7
- version = "0.1.2"
8
- description = "Hierarchical Additive Polynomial Complexity regression"
7
+ version = "0.1.5"
8
+ description = "Highly Adaptive Principal Components"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
11
  authors = [
12
12
  {name = "Carlos García Meixide", email = "cgmeixide@gmail.com"}
13
13
  ]
14
- license = {file = "LICENSE"}
14
+ license = {text = "MIT"}
15
15
  classifiers = [
16
16
  "Programming Language :: Python :: 3",
17
17
  "Programming Language :: Python :: 3.8",
@@ -1,6 +1,6 @@
1
1
  """HAPC: Highly Adaptive Principal Components."""
2
2
 
3
- __version__ = "0.1.2"
3
+ __version__ = "0.1.5"
4
4
 
5
5
  from .core import (
6
6
  pchal_design,
@@ -6,42 +6,18 @@ import sys
6
6
  from pathlib import Path
7
7
 
8
8
  # Try to import hapc_core module
9
- hapc_core = None
10
-
11
- # Try direct import
12
9
  try:
13
- import hapc_core
10
+ # This is the standard way for an installed package
11
+ from . import hapc_core
14
12
  except ImportError:
15
- pass
16
-
17
- # Try relative import
18
- if hapc_core is None:
13
+ # Fallback for development mode
19
14
  try:
20
- from .. import hapc_core
15
+ import hapc_core
21
16
  except ImportError:
22
- pass
23
-
24
- # Try to find it in known locations
25
- if hapc_core is None:
26
- search_paths = [
27
- Path(__file__).parent, # Same directory as this file
28
- Path(__file__).parent.parent.parent / "build", # Build directory
29
- ]
30
-
31
- for path in search_paths:
32
- if path.exists():
33
- sys.path.insert(0, str(path))
34
- try:
35
- import hapc_core
36
- break
37
- except ImportError:
38
- continue
39
-
40
- if hapc_core is None:
41
- raise ImportError(
42
- "hapc_core module not found. The C++ extension may not be built.\n"
43
- "Try: pip install -e . --force-reinstall --no-cache-dir"
44
- )
17
+ raise ImportError(
18
+ "hapc_core module not found. The C++ extension may not be built.\n"
19
+ "Try: pip install -e . --force-reinstall --no-cache-dir"
20
+ )
45
21
 
46
22
  class DesignOutput(NamedTuple):
47
23
  """Output from pchal_design."""
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hapc
3
- Version: 0.1.2
4
- Summary: Hierarchical Additive Polynomial Complexity regression
3
+ Version: 0.1.5
4
+ Summary: Highly Adaptive Principal Components
5
5
  Home-page: https://github.com/meixide/hapc
6
6
  Author: Carlos García Meixide
7
7
  Author-email: Carlos García Meixide <cgmeixide@gmail.com>
8
- License: YEAR: 2025
9
- COPYRIGHT HOLDER: Carlos García Meixide
8
+ License: MIT
10
9
  Project-URL: Homepage, https://github.com/meixide/hapc
11
10
  Project-URL: Documentation, https://github.com/meixide/hapc#readme
12
11
  Project-URL: Repository, https://github.com/meixide/hapc.git
@@ -44,29 +44,43 @@ class CMakeBuild(build_ext):
44
44
  import time
45
45
 
46
46
  # Search recursively for the built library
47
+ # Try multiple patterns to ensure we find it on all platforms
48
+ search_patterns = [
49
+ os.path.join(str(build_temp), "**", "hapc_core.*"),
50
+ os.path.join(str(build_temp), "**", "*", "hapc_core.*"),
51
+ os.path.join(str(build_temp), "**", "*", "*", "hapc_core.*"),
52
+ ]
53
+
47
54
  found = False
48
- for lib in glob.glob(os.path.join(str(build_temp), "**", "hapc_core.*"), recursive=True):
49
- if lib.endswith(('.pyd', '.so', '.dylib')):
50
- try:
51
- dest = lib_dir / Path(lib).name
52
- # Retry on Windows if file is locked
53
- max_retries = 3
54
- for attempt in range(max_retries):
55
- try:
56
- shutil.copy2(lib, dest)
57
- print(f"Copied {lib} to {dest}")
58
- found = True
55
+ for pattern in search_patterns:
56
+ for lib in glob.glob(pattern, recursive=True):
57
+ if lib.endswith(('.pyd', '.so', '.dylib')):
58
+ try:
59
+ dest = lib_dir / Path(lib).name
60
+ # Retry on Windows if file is locked
61
+ max_retries = 3
62
+ for attempt in range(max_retries):
63
+ try:
64
+ shutil.copy2(lib, dest)
65
+ print(f"[OK] Copied {lib} to {dest}")
66
+ found = True
67
+ break
68
+ except (OSError, PermissionError) as e:
69
+ if attempt < max_retries - 1:
70
+ time.sleep(0.5)
71
+ else:
72
+ raise
73
+ if found:
59
74
  break
60
- except (OSError, PermissionError) as e:
61
- if attempt < max_retries - 1:
62
- time.sleep(0.5)
63
- else:
64
- raise
65
- except Exception as e:
66
- print(f"Warning: Failed to copy {lib}: {e}")
75
+ except Exception as e:
76
+ print(f"Warning: Failed to copy {lib}: {e}")
77
+ if found:
78
+ break
67
79
 
68
80
  if not found:
69
- print("Warning: No compiled library found in build directory")
81
+ print(f"ERROR: No compiled library found in build directory {build_temp}")
82
+ print(f" Searched for: hapc_core.pyd (Windows), hapc_core.so (Linux), hapc_core.dylib (macOS)")
83
+ raise RuntimeError("Failed to locate compiled hapc_core extension")
70
84
 
71
85
  # Don't call parent run() to avoid setuptools trying to clean Windows locked files
72
86
  # Just mark as complete
@@ -92,7 +106,7 @@ if readme_file.exists():
92
106
  setup(
93
107
  name="hapc",
94
108
  version=version,
95
- description="Hierarchical Additive Polynomial Complexity regression",
109
+ description="Highly Adaptive Principal Components",
96
110
  long_description=readme_content,
97
111
  long_description_content_type="text/markdown",
98
112
  author="Carlos García Meixide",
@@ -101,7 +115,8 @@ setup(
101
115
  license="MIT",
102
116
  packages=find_packages(where="python"),
103
117
  package_dir={"": "python"},
104
- ext_modules=[Extension("hapc._core", [])],
118
+ # Correctly name the extension to be part of the 'hapc' package
119
+ ext_modules=[Extension("hapc.hapc_core", [])],
105
120
  cmdclass={"build_ext": CMakeBuild},
106
121
  python_requires=">=3.8",
107
122
  include_package_data=True,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes