Pip install pybaseball differs from code on master branch
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
I ran `pip install pybaseball` and was attempting to use the `season_game_logs` function in the `retrosheets.py` file and realized it wasn't working. I dove into the code and fixed some stuff with the intention of submitting a pull request. Here is the function `season_game_logs` that was pip installed:
```python
def season_game_logs(season):
"""
Pull Retrosheet game logs for a given season
"""
GH_TOKEN=os.getenv('GH_TOKEN', '')
# validate input
g = Github(GH_TOKEN)
repo = g.get_repo('chadwickbureau/retrosheet')
gamelogs = [f.path[f.path.rfind('/')+1:] for f in repo.get_contents('gamelog')]
file_name = f'GL{season}.TXT'
if file_name not in gamelogs:
raise ValueError(f'Season game logs not available for {season}')
s = get_text_file(gamelog_url.format(season))
data = pd.read_csv(StringIO(s), header=None, sep=',', quotechar='"')
data.columns = gamelog_columns
return data
```
After "fixing" the code and following the contribution markdown, I realized that the problem had already been fixed on the master branch. So I deleted the pip installed pybaseball code and ran `pip install git+ssh://git@github.com/jldbc/pybaseball.git`. The code for `season_game_logs` is:
```python
def season_game_logs(season):
"""
Pull Retrosheet game logs for a given season
"""
GH_TOKEN=os.getenv('GH_TOKEN', '')
# validate input
g = Github(GH_TOKEN)
repo = g.get_repo('chadwickbureau/retrosheet')
season_folder = [f.path[f.path.rfind('/')+1:] for f in repo.get_contents(f'seasons/{season}')]
gamelog_file_name = f'GL{season}.TXT'
if gamelog_file_name not in season_folder:
raise ValueError(f'Season game logs not available for {season}')
s = get_text_file(season_gamelog_url.format(season, season))
data = pd.read_csv(StringIO(s), header=None, sep=',', quotechar='"')
data.columns = gamelog_columns
return data
```
The above seems to be the correct code but this code doesn't get installed when you run `pip install pybaseball`. I assume this has something to do with the `setup.py` file, but I'm not exactly sure what needs to change in it.
Contributor guide
Assessment
This issue has not been assessed yet.