Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add numpy and scipy as optional dependencies #60

Closed
kdheepak opened this issue Feb 24, 2019 · 1 comment · Fixed by #78
Closed

Add numpy and scipy as optional dependencies #60

kdheepak opened this issue Feb 24, 2019 · 1 comment · Fixed by #78

Comments

@kdheepak
Copy link
Member

It'd be nice if the respective functions returned numpy arrays instead of lists, with an option to toggle back behaviour. We can even make it optional dependencies, the way Pandas is at the moment. A part of me wants to just commit to using NumPy and SciPy always, but I'm worried about installation issues and breaking existing code. @PMeira do you have any thoughts on this?

@PMeira
Copy link
Member

PMeira commented Feb 24, 2019

@kdheepak Although you probably could install DSS Python without NumPy as a dependency for ODD.py, it does depend on NumPy (we'd need to change _cffi_api_util.py a bit to keep it optional). If you haven't got any complaints so far, almost 6 months since the migration, I think it's fine to depend on it explicitly.

Unless people depended on the specific type of the results being lists, most operations that apply to lists would be fine with NumPy arrays. In the future ODD.py could reshape the matrix results instead of using vectors, and that's the only way I can imagine it would break backwards compatibility.

In the past, most issues with NumPy were due to its dependency on the platform BLAS libs. Nowadays NumPy distributes binary wheels for all major platforms. Also, if we were to switch to Cython instead of CFFI at some point, it'd need NumPy too.

with an option to toggle back behaviour.

We could do that. With the exception of a couple of functions that do some explicit array manipulations, just patching the CffiApiUtil class would be enough to achieve it, even after the instance is already created (much like use_com_compat patches the Base class in DSS Python).

As soon as I finish the plot integration, we will also depend (optionally) on matplotlib for the plot commands -- I'll finish this as soon as there's nothing more urgent to fix.

Related:

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 a pull request may close this issue.

2 participants