swar / nba_api

An API Client package to access the APIs for NBA.com
MIT License
2.34k stars 515 forks source link

Add WNBA static data. #444

Closed cosmicac closed 3 weeks ago

cosmicac commented 1 month ago

[!TIP] Review commit-by-commit!

This PR tackles adding static WNBA data, sparked by the discussion here (https://github.com/swar/nba_api/issues/439).

The general approach taken is to update the /tools/stats/static_players_update/update.py to also fetch and write WNBA players in addition to the existing NBA players. The WNBA teams data was manually populated, since I didn't see a corresponding workflow for teams. There's only 12 teams so this wasn't so bad.

I did have to introduce WnbaSeasonYear and WnbaSeason classes in order to get the CommonAllPlayers endpoint to work correctly when fetching WNBA data. The issue was that WNBA seasons are a single year (e.g "2024" instead of "2023-2024").

Also updated src/nba_api/stats/static/teams.py and src/nba_api/stats/static/players.py to support WNBA static data. I refactored these files slightly so that both the NBA and WNBA interfaces can use the same underlying functions.

Added to existing documentation. Didn't write too many tests other than the one unit test I could see that existed - LMK if I should write more.

There should be no breaking changes.

Please let me know how this looks! Happy to revise as necessary 🙏.

cosmicac commented 1 month ago

@rsforbes - let me know how this looks, happy to adjust as necessary.

rsforbes commented 3 weeks ago

@cosmicac - Will get this look at this weekend.