TDAmeritrade / stumpy

STUMPY is a powerful and scalable Python library for modern time series analysis

Home Page:https://stumpy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bump Minimum Python Version to 3.8

seanlaw opened this issue · comments

Currently, the minimum supported version of Python is 3.7. However, it has already passed its end-of-life and we should bump the minimum Python version (along with all of its dependencies) to Python 3.8.

According to min.py script, the minimum set of dependencies for Python 3.8 is:

python: 3.8
numba: 0.55.2
numpy: 1.18
scipy: 1.5

TODO:

  • Determine minimum versions and dependencies with ./min.py
  • Update setup.py
  • Update requirements.txt
  • Update environment.yml
  • Update .github/worflows/github-actions.yml

@NimaSarajpoor I'm going to submit a PR and have you review it. Is that okay?

That would be great! Thanks! I will learn new things :)

I will learn new things :)

The first thing you can do is study the min.py script and let me know if you have any questions or comments. It's still a work in progress so your feedback is welcome.

[Update]
I'm doing a quick refactoring to make it more readable

@NimaSarajpoor I've refactored min.py and it is ready for you to look at. Now, I'll work on a PR for bumping the minimum version.

I've refactored min.py and it is ready for you to look at.

I have been reading the code in min.py. That is one cool script / idea! [In fact, I should say that is awesome!]

[two minor comments]
(1) I noticed you access the column of a pandas dataframe using dot. However, I once read that it is better to use brackets (see this stackoverflow post).

(2) Regarding the function check_python_compatibility(row, min_python):
I usually find it hard to know, in advance, what columns should be in row. So, I was wondering whether it should be really a function or an expression could be used instead of calling the function.

(1) I noticed you access the column of a pandas dataframe using dot. However, I once read that it is better to use brackets (see this stackoverflow post).

So, this advice is now outdated (note that the post was from 2016). The modern convention for Pandas is to use "method chaining" and, along with it, accessing columns via the "dot attribute". The only times where ["column name"] is appropriate is when the column name itself contains spaces and the "dot attribute" fails.

(2) Regarding the function check_python_compatibility(row, min_python):
I usually find it hard to know, in advance, what columns should be in row. So, I was wondering whether it should be really a function or an expression could be used instead of calling the function.

That's a fair point (re: hard to know in advance). Can you propose what that "expression" would look like? I was trying to be pragmatic and to come up with a "good enough" solution first since it will likely not be touched in the future and it didn't need to be performant. However, I acknowledge that I may have made it more difficult to change in the future. I am open to suggestions/feedback!

So, this advice is now outdated (note that the post was from 2016). The modern convention for Pandas is to use "method chaining" a

Ahh...good to know!

Can you propose what that "expression" would look like? I was trying to be pragmatic and to come up with a "good enough" solution first since it will likely not be touched in the future and it didn't need to be performant.

I am just trying a couple of things on my end. I will provide an update soon.

@seanlaw

Instead of check_python_compatibility, can we do something like:

.pipe(
          lambda df: df.assign(
              COMPATIBLE=np.logical_and(
                  df.MIN_PYTHON_SPEC.apply(lambda x: min_python in x),
                  df.MAX_PYTHON_SPEC.apply(lambda x: min_python in x)
              )
          )
)

Or, is it too nested?

Or, is it too nested?

It feels like an unnecessary import of numpy and I actually find this less readable

It feels like an unnecessary import of numpy and I actually find this less readable

Thanks for the input :) I think my other ideas make things more complicated 😄

I have no comment
[I will keep it at the back of my head and I will prbably think about it from time to time in the future. But, for now, I have nothing to share]