Skip to content

Conversation

@austin2118ace
Copy link

I ran into an issue integrating oasis into our processing pipeline as we use numpy > 2. This caused issues when importing oasis as the PyPa oasis wheels were built against numpy < 2

To approach automatic wheel building for our use case, and to make the package compliant with PEP 518 and PEP 621, I moved most of the information out of setup.py into pyproject.yaml. I also pinned numpy > 2 so the wheels will be built against the newest headers and make oasis compatible with newer code. setup.py is still required for building the extension, as the pyproject.toml spec only has experimental support for building extensions, and I didn't want to stray too far from the known working build environment.

An additional note is that cvxpy==1.6 typically gets pulled during the install. This generates some warning messages about depreciated syntax as of version <1.1, but the code still appears to work as intended.

All Github CI builds succeed, and my local runs of the provided test code succeed without issue. I am able to build the package using PyPa build and Astral's uv build both of which invoke setuptools. The resultant wheel then is installable with no errors and oasis can be imported successfully.

Using pip install -e . (which automatically builds extensions) succeeds. Further, manually building with python setup.py build_ext -i and then running pip install . also works.

I figured I would share these changes with you in case you were interested in applying them to the main repository.

Cheers!
Austin
Dewan Lab
Florida State University

@j-friedrich
Copy link
Owner

Thanks @austin2118ace. I figured at one point I should modernize my setup.py based project, looks like you did that work for me :).

Since the previous version on conda-forge only supported Python ≤3.10, I finally released v0.2.1 on PyPI and conda-forge a few days ago. For conda-forge, it built successfully on Linux, macOS, and Windows using Python 3.9–3.13. I’m curious if pinning NumPy to >=2 would interfere with this build.

What OS and installation process did you use that caused issues? Did you clone the repo and compile from source?

With your changes, would the "Compile from source" section in the README now simply look like this?

git clone [email protected]:j-friedrich/OASIS.git
cd OASIS
pip install -e .

@austin2118ace
Copy link
Author

@j-friedrich

I was building using 3.10 I believe, but using numpy > 2 passed all the Github CI build tests using my files.

TBH, it was a while ago and this upgrade was a adhd-fueled on-a-whim project, so I don't remember exactly what our issue was. All I am certain of is that importing oasis when numpy>2 was causing an import error (wasn't just a warning) due to some mismatches in expected variable size I think. I fairly certain we were using the version on conda to avoid the hassle of compiling the extension. Wish I had better info for you unfortunately.

However, Yes! pip install -e . will automatically build the extension and the install the directory as a package. You can also use the following:

  1. Build the extension separately and the install the local package python -m build followed by pip install . (no -e)
  2. Old method: python setup.py build_ext -i followed by pip install .
  3. I really like using uv as a tool for most of my python stuff, if you haven't seen it yet I highly recommend checking it out. It is build-backend agnostic as far as I know, so it dynamically detects your build settings and makes it happen. uv build followed by pip install .
  4. uv pip install . also works as it installs local packages with the -e flag as default, so the behavior is the same as 1)

I'm sure there are plenty of other ways, but your recommendation is likely the simplest.
If you want to run the comparison methods, you simply have to use pip install -e ".[comparison]" to install cvxpy and the other needed packages.

@austin2118ace
Copy link
Author

@j-friedrich Hi! Just checking in to make sure you saw my last comment. Cheers :)

@austin2118ace
Copy link
Author

Hey @j-friedrich, I just wanted to confirm for you that oasis builds fine for me using numpy > 2 and python 3.11 using pip. Hope all is well!

@j-friedrich j-friedrich requested a review from Copilot June 18, 2025 15:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates project configuration from setup.py/setup.cfg to pyproject.toml and pins numpy to versions greater than 2 to ensure compatibility with newer numpy releases.

  • Removed external requirements from test_requirements.txt and setup.cfg.
  • Simplified setup.py by eliminating dependency and metadata handling in favor of centralized configuration in pyproject.toml.
  • Introduced pyproject.toml with updated project metadata and dependency definitions.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
test_requirements.txt Removed test dependency declarations now managed elsewhere.
setup.py Simplified configuration; package name changed from 'oasis' to 'oasis.oasis_methods'.
setup.cfg Removed since metadata is now in pyproject.toml.
pyproject.toml New file centralizing project metadata with pinned dependencies.
Comments suppressed due to low confidence (1)

setup.py:16

  • The package name in setup.py ('oasis.oasis_methods') does not match the project name in pyproject.toml ('oasis-deconv'). Consider aligning the package naming to maintain consistency in distribution and installation.
setup(name='oasis.oasis_methods',

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.

2 participants