Skip to content

Conversation

@CoolJosh0221
Copy link
Contributor

@CoolJosh0221 CoolJosh0221 commented Jan 11, 2026

Summary of this PR

This PR migrates the build system from the deprecated numpy.distutils to meson-python, enabling Python 3.12 support and automated wheel distribution. Additionally, this PR adds four new query strategies.

Changes

Build system migration

  • Replaced numpy.distutils with meson-python backend
  • Added meson.build and meson.options for C/C++ extensions
  • Dropped EOL Python versions (<=3.8)

CI/CD

  • Added GitHub Actions workflow for binary wheels (Linux x86_64/aarch64, macOS arm64/x64)
  • Windows: WSL required (documented in README)

New query strategies

Strategy Reference Description
CoreSet Sener & Savarese, ICLR 2018 Greedy k-center diversity sampling
BALD Houlsby et al. 2011 Mutual information via ensemble disagreement
InformationDensity Settles & Craven, EMNLP 2008 Uncertainty weighted by representativeness
EpsilonUncertaintySampling ε-greedy exploration/exploitation

Verification

  • Tested on Linux/macOS; wheels uploaded to TestPyPI
  • 58 new tests (10 + 12 + 20 + 16)
  • Note: PyPI secrets need to be configured for production releases

CoolJosh0221 and others added 30 commits December 21, 2024 09:50
2. Modified README.md (changed the order of installing dependencies && changed the installation method)
Current Status: 2 of the tests fail and 1 throws an error
Resolve the [Deprecate test command](pypa/setuptools#1684) in `setuptools`.
This commit addresses the issue where editable installs fail with
"FileNotFoundError: No such file or directory: ninja" when the package
is imported in another project.

Changes:
- Added build tools (meson, ninja, cython, numpy) to dev dependencies
  to ensure they're available at runtime for editable installs
- Added [tool.meson-python] configuration with editable-verbose=true
  for better debugging of editable install issues
- Updated README.md with clear instructions for editable installs
  using pip or UV package managers

The error occurred because meson-python's editable install creates a
loader that rebuilds on import, requiring build tools to be present.
By including these in the [dev] extra, users who install with
"pip install -e .[dev]" or "uv pip install -e .[dev]" will have
the necessary tools available.

Fixes the error:
  FileNotFoundError: [Errno 2] No such file or directory:
  '/path/to/.cache/uv/builds-v0/.tmp/bin/ninja'
…talls

This commit clarifies the distinction between regular and editable installs,
making it clear that the ninja build tool error only affects editable installs.

Key changes:

1. Documentation improvements:
   - Added "Regular Install" section clarifying that normal installs work
     without build tools at runtime
   - Reorganized "Editable/Development Install" section with two clear options:
     * Option 1: pip install -e ".[dev]" (recommended)
     * Option 2: --no-build-isolation with manual dependency installation
   - Added troubleshooting guidance for the ninja error
   - Explained why editable installs need build tools (automatic rebuild on import)

2. pyproject.toml improvements:
   - Reformatted dev dependencies for better readability
   - Enhanced comments explaining meson-python's editable install behavior
   - Kept build tools (meson, ninja, cython, numpy) in dev dependencies

The root cause: meson-python's editable installs rebuild compiled components
on every import, requiring build tools at runtime. Regular installs compile
once during installation and don't need build tools afterward.

Users should:
- Use regular installs (pip install libact) for normal usage
- Use editable installs with [dev] dependencies for development
- Reinstall as regular if they encounter the ninja error

Resolves the issue where importing libact fails with:
  FileNotFoundError: No such file or directory: '.../ninja'
…-012G3JcivxguzQwfsQKC3PkK

Fix meson build configuration for editable installs
This commit dramatically simplifies the installation process by making
BLAS/LAPACK optional dependencies and providing clear installation paths
for both regular and editable installs.

Key improvements:

1. **Automatic feature detection (libact/query_strategies/meson.build)**:
   - BLAS/LAPACK are now only required if variance_reduction or hintsvm are enabled
   - If BLAS/LAPACK not found, these features are automatically disabled with a warning
   - Users can now install without system BLAS libraries
   - Clear messages indicate which features are being built or skipped

2. **Simplified installation (README.md)**:
   - Regular install now works out-of-the-box without BLAS/LAPACK
   - Editable install instructions updated to use --no-build-isolation method
   - Removed confusing multi-option approach
   - Added clear troubleshooting section

3. **Configuration cleanup (pyproject.toml)**:
   - Removed invalid `editable-verbose` configuration that caused build errors
   - Kept dev dependencies for development workflow
   - Added clear comment about editable install requirements

**Benefits**:
- ✅ Regular install: Works immediately without system dependencies
- ✅ Simple one-command install for most users: `pip install libact`
- ✅ Optional features available when BLAS/LAPACK are present
- ✅ Clear error messages guide users to solutions
- ✅ Reduces confusion and installation friction

**Testing performed**:
- Regular install tested successfully without BLAS/LAPACK
- Editable install tested with --no-build-isolation
- Import functionality verified in both modes
- Automatic feature skipping confirmed when BLAS unavailable

This resolves the ninja build tool error and makes libact much easier
to install for all users.
This commit updates the CI/CD workflows to work with the new meson-python
build system and to test both scenarios: with and without BLAS/LAPACK.

Changes to .github/workflows/tests.yml:

1. **Updated main test job (test-with-blas)**:
   - Replaced old setup.py commands with meson-python workflow
   - Install build tools explicitly (meson-python, meson, ninja, cython, numpy)
   - Use `pip install --no-build-isolation -e .` for editable install
   - Updated coverage command to use `python -m unittest` directly
   - Better step names for clarity

2. **Added new test job (test-without-blas)**:
   - Tests installation WITHOUT BLAS/LAPACK libraries
   - Verifies automatic feature disabling works correctly
   - Ensures basic functionality works without optional dependencies
   - Tests that appropriate warning messages are shown
   - Validates minimal install scenario for users without system libraries

Benefits:
- ✅ Tests full feature set with BLAS/LAPACK across Python 3.9-3.12
- ✅ Tests minimal install without BLAS/LAPACK (Python 3.11)
- ✅ Verifies automatic fallback behavior works as expected
- ✅ Compatible with new meson-python build backend
- ✅ Removed dependency on deprecated setup.py

The linting workflow remains unchanged as it doesn't need to build the package.
This commit ensures optional features (variance_reduction and hintsvm)
are properly tested and makes their build status clearly visible.

Changes:

1. **Enhanced CI testing (.github/workflows/tests.yml)**:
   - Added verification step in test-with-blas job to ensure optional
     features are actually built when BLAS/LAPACK are available
   - Checks build log for "Building VarianceReduction" and "Building HintSVM"
   - Verifies compiled modules are importable
   - Fails build if optional features aren't built despite BLAS being present

   - Enhanced test-without-blas job to verify features are correctly skipped
   - Checks for "Skipping" messages in build output
   - Verifies modules are NOT importable when BLAS is missing
   - Ensures fallback behavior works as expected

2. **Improved build messaging (libact/query_strategies/meson.build)**:
   - Added "Optional features requested" message at build start
   - Shows variance_reduction and hintsvm status (true/false)
   - Added "Build Summary" section at end showing what was actually built
   - Uses ✓ and ✗ symbols for clear visual feedback
   - Makes it easy to see which features were enabled in meson logs

3. **Clarified defaults (meson.options)**:
   - Added comment block explaining defaults behavior
   - Updated descriptions to show "(default: enabled, requires BLAS/LAPACK)"
   - Makes it clear that features auto-disable if dependencies missing

Benefits:
- ✅ CI now validates optional features are tested when available
- ✅ CI ensures fallback works correctly without BLAS/LAPACK
- ✅ Clear build status in logs helps debugging
- ✅ Defaults are explicit and well-documented
- ✅ Prevents silent feature disabling from going unnoticed in CI

The optional features remain enabled by default (as they were) and are
automatically tested in CI to ensure they work correctly.
…-012G3JcivxguzQwfsQKC3PkK

Major improvement: Simplify installation and make BLAS/LAPACK optional
Enable pre-built wheel distribution for Linux (x86_64/ARM64), macOS
(Intel/ARM), and Windows (x64) across Python 3.9-3.12.

Users can now install libact without compilers or BLAS/LAPACK setup.
Wheels bundle OpenBLAS and all compiled extensions (HintSVM, VarianceReduction).

Uses manylinux_2_28 for Linux, matching NumPy 2.x+ compatibility.
CoolJosh0221 and others added 21 commits January 1, 2026 23:55
Add __version__ to libact package, add validation errors for invalid method/model parameters, and clean up deprecated pylintrc options.
Add dependency caching (pip, Homebrew, ccache) and switch to native ARM64 runners instead of slow QEMU emulation. Skip wheel tests on PRs to provide faster feedback while maintaining full test coverage on releases.
- Make wheel tests conditional to handle builds without BLAS/LAPACK
- Switch tests.yml from ATLAS to OpenBLAS for better compatibility
- Update GitHub Actions to v4/v5 in tests.yml
- Add pkg-config to test dependencies for proper library detection

The tests now pass whether C-extensions are built or not, while still
verifying they work when available.
- Force link Homebrew packages after install to fix cached package issue
- Add push trigger for build_wheels workflow on relevant file changes
- Ensures lapacke.h is found when building with cached dependencies
Homebrew refuses to link openblas and lapack on macOS because they shadow
system-provided libraries. Set CPPFLAGS and LDFLAGS to point directly to
the unlinked packages in /opt/homebrew and /usr/local, fixing the
'lapacke.h not found' error during builds.
Accelerate framework lacks lapacke.h which is required by variance_reduction.c
for the LAPACK_dgesvd function. Removing it from the search list ensures
meson uses OpenBLAS instead on macOS platforms.
- Use OpenBLAS (includes BLAS/LAPACK/LAPACKE) + libomp for OpenMP
- Add Cellar wildcard paths as fallback for cached packages
- Set CPPFLAGS/LDFLAGS to ensure compiler finds libraries
- Remove unnecessary packages from cache
Re-add Accelerate to meson search list - it provides native BLAS/LAPACK
without OpenMP dependencies. Install Homebrew lapack package only for
lapacke.h headers. This avoids OpenMP issues with OpenBLAS on macOS
while keeping the code unchanged.
- Add github.run_attempt > 1 to test_wheels condition to allow manual re-runs
- Configure linting to only fail on errors (--errors-only flag)
- Remove non-functional pip and Homebrew caches
- Keep ccache for C++ compilation (most effective for cibuildwheel)
- Update GitHub Actions to v4/v5
@CoolJosh0221 CoolJosh0221 marked this pull request as ready for review January 11, 2026 08:37
Implement three new query strategies for active learning:

- CoreSet: Greedy k-center selection (Sener & Savarese, ICLR 2018)
  Selects unlabeled points farthest from labeled set for geometric coverage.

- BALD: Bayesian Active Learning by Disagreement (Houlsby et al. 2011)
  Maximizes mutual information using ensemble disagreement.

- InformationDensity: Uncertainty weighted by representativeness
  (Settles & Craven, EMNLP 2008)
  Combines uncertainty with density to avoid querying outliers.

These strategies provide complementary signals for ALBL:
- CoreSet → diversity/coverage
- BALD → epistemic uncertainty
- InformationDensity → representative uncertainty

Includes 42 unit tests (10 + 12 + 20) and documentation updates.
Implement epsilon-greedy uncertainty sampling that balances exploration
and exploitation with a fixed ratio:

- With probability ε: random sampling (exploration)
- With probability 1-ε: uncertainty sampling (exploitation)

Supports lc/sm/entropy uncertainty methods. Useful as a standalone
strategy or baseline when a fixed exploration rate is desired.

Includes 16 unit tests. Also adds missing test files to meson.build
for bald, coreset, and information_density strategies.
@CoolJosh0221 CoolJosh0221 changed the title Migrate Build System to meson-python and Enable Python 3.12 Support + enable easy installation for major platforms: Linux, MacOS, while Windows requires WSL meson-python migration + Python 3.12 support + 4 new query strategies Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants