skfolio / skfolio

Python library for portfolio optimization built on top of scikit-learn
https://skfolio.org
BSD 3-Clause "New" or "Revised" License
1.01k stars 76 forks source link

[BUG] Python Version Request: Reduce python >= 3.9 #6

Closed mdancho84 closed 6 months ago

mdancho84 commented 6 months ago

Thanks for the great-looking package!

I have hopefully a small request. Currently you have:

https://github.com/skfolio/skfolio/blob/a1e79d3cf732467dcd078cd414b466b889a2b1c5/pyproject.toml#L16

Is it possible to change this to 3.9 to reduce the restrictiveness?

Sklearn doesn't actually specify a python version in their project.toml. And I don't see a need to restrict from the current dependencies:

dependencies = [
    "numpy>=1.23.4",
    "scipy>=1.8.0",
    "pandas>=1.4.1",
    "cvxpy>=1.4.1",
    "scikit-learn>=1.3.2",
    "joblib>=1.3.2",
    "plotly>=5.15.0"
]
HugoDelatte commented 6 months ago

Thank you!

We've chosen 3.10 as the minimal requirement, aiming to stay two majors below the latest release and take advantage of the new features introduced in 3.10.

Among these features, we currently use:

Therefore, the current code wouldn't work with 3.9. The solution would be to refactor the code, which is not technically difficult but would also require us to maintain two code bases (one for 3.9 and one for >=3.10).

This additional development time won't be allocated to other features, so we'll need to monitor this request to see how many users it impacts and make a decision based on this.

Regarding scikit-learn, they specifiy the Python version in their setup.py (which is 3.9 for scikit-learn 1.3).

To better understand the impact of these restrictions, could you provide more details on why you need to stay on 3.9?

mdancho84 commented 6 months ago

Understood. I didn't expect that you were using features specific to py 3.10. And that's why I asked.

What I did was upgraded to Python 3.11 in a code base to permit use of skfolio.

You can find the article here: https://www.quantscience.io/newsletter/b/risk-parity-portfolio-python-skfolio

HugoDelatte commented 6 months ago

Thank you for the details. Also, thank you for the tutorial and communication you provided around the package. They are very much appreciated!