Skip to main content

An easy-to-use wrapper for nba_api to easily find data for a player, game, team, or season

Project description

NBAStatPy

PyPI version Python 3.10+ CI

Overview

A simple, easy-to-use wrapper for the nba_api package to access NBA data for players, games, teams, and seasons.

Quick Start

from nbastatpy.player import Player

# Create a player object
player = Player("Giannis", season="2023", playoffs=True)

# Get data
awards = player.get_awards()
stats = player.get_career_stats()

Main Classes

  • Player - Access player stats, career data, and awards
  • Game - Get boxscores, play-by-play, and game details
  • League - Query league-wide stats, lineups, and tracking data
  • Team - Retrieve team rosters, stats, and splits

Standalone Usage

from nbastatpy.standardize import standardize_dataframe

df = standardize_dataframe(df, data_type='player')

MCP Server

NBAStatPy includes a Model Context Protocol (MCP) server that allows AI assistants like Claude to access NBA statistics data.

Quick Start (No Installation Required)

Using uvx, you can run the MCP server directly without installing:

uvx nbastatpy

Adding to Claude Code

Option 1: CLI Command (Recommended)

claude mcp add nbastatpy -- uvx nbastatpy

Option 2: Manual Configuration

Add to your ~/.claude.json (user-level) or .mcp.json (project-level):

{
  "mcpServers": {
    "nbastatpy": {
      "type": "stdio",
      "command": "uvx",
      "args": ["nbastatpy"]
    }
  }
}

Option 3: With pip install

{
  "mcpServers": {
    "nbastatpy": {
      "command": "python",
      "args": ["-m", "nbastatpy.mcp.server"]
    }
  }
}

Available Tools

The MCP server provides tools for accessing NBA data:

Tool Description
get_player_salary Get player salary data by name
get_player_game_logs Get recent game logs for a player
get_player_career_stats Get season-by-season career statistics
get_player_play_type_stats Get play type (synergy) stats for a player
get_player_tracking_stats Get tracking stats (drives, touches, etc.)
get_league_leaders Get league leaders for any stat category
get_team_recent_games Get recent games for a team
get_team_play_type_stats Get play type stats for a team
get_team_tracking_stats Get tracking stats for a team
get_recent_games_summary Get summary of recent NBA games
get_recent_games_player_stats Get player stats from recent games

Installation

Pip

pip install nbastatpy

UV

uv add nbastatpy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbastatpy-0.4.0.tar.gz (205.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbastatpy-0.4.0-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file nbastatpy-0.4.0.tar.gz.

File metadata

  • Download URL: nbastatpy-0.4.0.tar.gz
  • Upload date:
  • Size: 205.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbastatpy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ab3789815f114d86764df1c319286a73d0a3706a8619f327c7e18ee9c314de29
MD5 ab97f911ed5e382b1538b3f41b3ae215
BLAKE2b-256 ecf0965de6258ae7b1dd23c5562a77572a486279fd6acae7d3bb736d0f949e37

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbastatpy-0.4.0.tar.gz:

Publisher: publish.yml on aberghammer-analytics/NBAStatPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbastatpy-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: nbastatpy-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbastatpy-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d70b0b3c00a11de6926f9df1b439af46a779d339a880f5cdb4c73ba633ae95dd
MD5 1d8f1e2223aac04beb0a206590b786c5
BLAKE2b-256 0578b3c7f900396fca5e192a4c7bbf55a0305cbdb21a1fad1f37f4cbe8082f1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbastatpy-0.4.0-py3-none-any.whl:

Publisher: publish.yml on aberghammer-analytics/NBAStatPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page