Skip to main content

A modern Python library for interacting with swimrankings.net

Project description

SwimRankings Python Library

A modern Python library for interacting with swimrankings.net, providing easy access to athlete data, search functionality, and more.

Features

  • 🏊‍♀️ Athlete Search: Search for athletes by name, gender, and other criteria
  • 📈 Detailed Data: Fetch personal bests, profile information, and more
  • 📊 Type Hints: Full type annotation support for better IDE experience
  • 🔍 Flexible Filtering: Filter athletes by gender, country, club, etc.
  • 🚀 Async Support: Coming soon!

Documentation

📖 Full Documentation - Complete documentation with examples and guides

The documentation is built with Nextra and includes:

  • Installation guide
  • Quick start tutorial
  • Usage examples
  • Error handling guide
  • Contributing guidelines

Running Documentation Locally

# Setup documentation (requires Node.js 16+)
python docs_setup.py setup

# Start documentation server
python docs_setup.py dev

# Open http://localhost:3000 in your browser

Installation

pip install swimrankings

Quick Start

from swimrankings import Athletes

# Search for athletes by name
athletes = Athletes(name="Druwel")
for athlete in athletes:
    print(f"{athlete.full_name} ({athlete.birth_year}) - {athlete.country}")

# Get detailed information including personal bests
athlete = athletes[0]
details = athlete.get_details()

print(f"Personal bests: {len(details.personal_bests)}")
for pb in details.personal_bests:
    print(f"  {pb.event} ({pb.course}): {pb.time}")

# Search for male athletes only
male_athletes = Athletes(name="Druwel", gender="male")

# Search for female athletes only  
female_athletes = Athletes(name="Druwel", gender="female")

Athletes Class

The main class for searching athletes on swimrankings.net.

Constructor

Athletes(name: str, gender: str = "all", club_id: int = -1)

Parameters:

  • name (str): Last name to search for
  • gender (str, optional): Gender filter - "all", "male", or "female". Default: "all"
  • club_id (int, optional): Club ID filter. Default: -1 (all clubs)

Methods

  • __iter__(): Iterate over found athletes
  • __len__(): Get number of athletes found
  • __getitem__(index): Get athlete by index

Athlete Class

Represents a single athlete with their information.

Properties

  • athlete_id (int): Unique athlete identifier
  • full_name (str): Full name (Last, First)
  • first_name (str): First name
  • last_name (str): Last name
  • birth_year (int): Birth year
  • gender (str): Gender ("male" or "female")
  • country (str): Country code
  • club (str): Club name
  • profile_url (str): URL to athlete's profile page

Development

# Clone the repository
git clone https://github.com/MauroDruwel/Swimrankings.git
cd Swimrankings

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black swimrankings/

# Type checking
mypy swimrankings/

CI/CD

This project includes comprehensive CI/CD workflows:

  • 🧪 Automated Testing: Tests run on every commit across Python 3.8-3.12
  • 📚 Documentation Deployment: Auto-deploys to GitHub Pages
  • 📦 PyPI Publishing: Auto-publishes to PyPI on releases
  • 📊 Coverage Tracking: Coverage reports uploaded to Codecov

See CI_CD_SETUP.md for detailed setup instructions.

Helper Scripts

  • python scripts/test_ci.py - Run all CI checks locally
  • python scripts/prepare_release.py - Prepare a new release

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

swimrankings-0.1.0.tar.gz (114.6 kB view details)

Uploaded Source

Built Distribution

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

swimrankings-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file swimrankings-0.1.0.tar.gz.

File metadata

  • Download URL: swimrankings-0.1.0.tar.gz
  • Upload date:
  • Size: 114.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for swimrankings-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e8f27d010f18996c7414935db2e9f7746a811084f92f8cfe06f7beb48ff97b6
MD5 6ac5e33d8c8d128c9df727bbeab89d89
BLAKE2b-256 9bad3b406b892d8559e3635aa969374d11041cac6fa787455232f5e1cb3a2cc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for swimrankings-0.1.0.tar.gz:

Publisher: publish.yml on MauroDruwel/Swimrankings

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

File details

Details for the file swimrankings-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: swimrankings-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for swimrankings-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c03e7654aaddc9e2741a9390f0e2113cdf09461f0850310213450b12ded489d
MD5 343429ce5faabfb51f62b86445f57204
BLAKE2b-256 2d28371af160fa7942cb7a102e26463db1d7f61697f306cb13d286c0e89a279d

See more details on using hashes here.

Provenance

The following attestation bundles were made for swimrankings-0.1.0-py3-none-any.whl:

Publisher: publish.yml on MauroDruwel/Swimrankings

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