Fast-F1 icon indicating copy to clipboard operation
Fast-F1 copied to clipboard

Add get_events_remaining function

Open oscr opened this issue 3 years ago • 3 comments

Suggesting a useful helper function get_events_remaining which returns the remaining events for the season. I was doing some experimentation and thought this could be a useful for me and maybe for others.

oscr avatar Aug 10 '22 23:08 oscr

I'm force pushing updates to ensure you have a single commit as is required by other open source projects I'm involved in. If you prefer to have multiple commits and squash yourself when you merge please let me know :smile:

oscr avatar Aug 11 '22 14:08 oscr

I'm fine with you force pushing, although I don't consider it necessary. The projects I have contributed so far did not require it. I see that all PRs to Kubernetes seem to be force pushed for each update. What's the rationale behind it? I failed to find it in their contribution guidelines when taking a quick look.

theOehrly avatar Aug 11 '22 16:08 theOehrly

I've noticed that commits are often cherry-picked to multiple release branches. I suspect this just keeps it simpler for them when doing so.

oscr avatar Aug 11 '22 16:08 oscr

Ok, sorry for the slight delay. There are two minor things remaining, documentation related.

  1. the versionadded number in the docstring should be bumped to 2.3
  2. within fastf1/init.py the function needs to be explicitly added to the docstring at the beginning so that it is picked up by sphinx when generating the docs.

I can also push these changes myself, if you like. Then you don't need to figure the docs stuff out in case you are not familiar with it.

theOehrly avatar Aug 15 '22 21:08 theOehrly

@theOehrly No problem! I can do it. However using the feedback you provided in the code review I realize that this function maybe isn't needed. All I needed was result = fastf1.get_event_schedule(2022) and then filtering using the method you showed me: result.loc[result["EventFormat"] == "sprint"] or result.loc[result["EventDate"] >= now]. I really like this.

I would therefore like to suggest closing this pr to avoid cluttering the api, and instead I can open a pr to expand the documentation adding an example that does this kind of filtering. What do you think?

oscr avatar Aug 16 '22 08:08 oscr

@oscr I had thought about this when you initially opened the PR. You are right, this function is not strictly necessary, as it is fairly simple to get the desired result without it. FastF1 does provide very similar wrapper functions in other places, too, though. Also, there seem to be plenty of users who have little programming experience. IMO, it is ok to add wrapper functions like this as shortcuts if they solve a reasonably common problem (which is a very subjective decision, I know). Also, this functionality is very self-contained and does not require much if any maintenance. Therefore, I'd say it is a justifiable addition.

theOehrly avatar Aug 17 '22 08:08 theOehrly

Looks good now. Thank you for contributing to FastF1!

theOehrly avatar Aug 17 '22 20:08 theOehrly

Thank you @theOehrly for your help and support.

oscr avatar Aug 17 '22 20:08 oscr