Skip to main content

Python library for the OrgaTalk LAN Party Database

Project description

Python library for the OrgaTalk LAN Party Database

This library provides

  • party and party series models,
  • functionality to deserialize parties and party series from TOML, and
  • functionality to serialize parties (but not party series) to TOML

to work with data for and from the public LAN party database by OrgaTalk.

Data and code repositories for the project are available at: https://github.com/lanpartydb

Status

Test

Installation

With pip:

$ pip install lanpartydb

Or with uv:

$ uv init
$ uv add lanpartydb

Usage

To serialize a party with only the required attributes to TOML:

from datetime import date

from lanpartydb.models import Party
from lanpartydb.writing import serialize_party

party = Party(
    slug='megalan-2023',
    title='MegaLAN 2023',
    start_on=date(2023, 11, 17),
    end_on=date(2023, 11, 19),
)

toml = serialize_party(party)

print(toml)

And to serialize a party with all available attributes to a TOML file:

from datetime import date
from decimal import Decimal
from pathlib import Path

from lanpartydb.models import Links, Location, Party, Resource
from lanpartydb.writing import serialize_party

party = Party(
    slug='superlan-2024',
    title='SuperLAN 2024',
    series_slug='superlan',
    organizer_entity='SuperLAN Association',
    start_on=date(2024, 5, 24),
    end_on=date(2024, 5, 26),
    seats=420,
    attendees=397,
    online=False,
    location=Location(
        name='City Hall',
        country_code='us',
        city='Los Angeles',
        postal_code='90099',
        street='123 North Hill Street',
        latitude=Decimal('34.06101057935884'),
        longitude=Decimal('-118.23974355902666'),
    ),
    links=Links(
        website=Resource(
            url='https://www.superlan.example/',
            offline=False,
        ),
    ),
)

toml = serialize_party(party)

path = Path('./superlan-2024.toml')
path.write_text(toml)

Take a look at the code (in src/) and the tests (in tests/) to learn more about the library's interface.

License

MIT

Author

Jochen Kupperschmidt

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

lanpartydb-0.10.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

lanpartydb-0.10.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file lanpartydb-0.10.0.tar.gz.

File metadata

  • Download URL: lanpartydb-0.10.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for lanpartydb-0.10.0.tar.gz
Algorithm Hash digest
SHA256 1f74277c361c6ed2ac26b65d9b367ff4dac7b7b22563b927f68bf134a651b24c
MD5 0d5c4060219361c18b6d3cd29cc531d1
BLAKE2b-256 fae8d50f6d3e79278fe7d2261c35e68efa32a358a06722b2a7204d34bea58d22

See more details on using hashes here.

File details

Details for the file lanpartydb-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lanpartydb-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6cb93882090c05fdfbda3f1e22414d5e343342e997f989665f1d98defc94e74
MD5 4bb467d4f797be0e653c2120486178ba
BLAKE2b-256 d6fae4970b46dc5cd94a08fb961e3d59204344e12328e4af18bec9d89dc28543

See more details on using hashes here.

Supported by

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