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 forgender(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 identifierfull_name(str): Full name (Last, First)first_name(str): First namelast_name(str): Last namebirth_year(int): Birth yeargender(str): Gender ("male" or "female")country(str): Country codeclub(str): Club nameprofile_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 locallypython 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e8f27d010f18996c7414935db2e9f7746a811084f92f8cfe06f7beb48ff97b6
|
|
| MD5 |
6ac5e33d8c8d128c9df727bbeab89d89
|
|
| BLAKE2b-256 |
9bad3b406b892d8559e3635aa969374d11041cac6fa787455232f5e1cb3a2cc8
|
Provenance
The following attestation bundles were made for swimrankings-0.1.0.tar.gz:
Publisher:
publish.yml on MauroDruwel/Swimrankings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swimrankings-0.1.0.tar.gz -
Subject digest:
9e8f27d010f18996c7414935db2e9f7746a811084f92f8cfe06f7beb48ff97b6 - Sigstore transparency entry: 272700760
- Sigstore integration time:
-
Permalink:
MauroDruwel/Swimrankings@9d3fd11eaa357d34b436c6ff7fd3b3d93d710b7b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MauroDruwel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d3fd11eaa357d34b436c6ff7fd3b3d93d710b7b -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c03e7654aaddc9e2741a9390f0e2113cdf09461f0850310213450b12ded489d
|
|
| MD5 |
343429ce5faabfb51f62b86445f57204
|
|
| BLAKE2b-256 |
2d28371af160fa7942cb7a102e26463db1d7f61697f306cb13d286c0e89a279d
|
Provenance
The following attestation bundles were made for swimrankings-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on MauroDruwel/Swimrankings
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swimrankings-0.1.0-py3-none-any.whl -
Subject digest:
8c03e7654aaddc9e2741a9390f0e2113cdf09461f0850310213450b12ded489d - Sigstore transparency entry: 272700761
- Sigstore integration time:
-
Permalink:
MauroDruwel/Swimrankings@9d3fd11eaa357d34b436c6ff7fd3b3d93d710b7b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MauroDruwel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d3fd11eaa357d34b436c6ff7fd3b3d93d710b7b -
Trigger Event:
release
-
Statement type: