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 and 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.serialization import serialize_party_to_toml

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

toml = serialize_party_to_toml(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 Location, Party, PartyLinks, Resource
from lanpartydb.serialization import serialize_party_to_toml

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=PartyLinks(
        website=Resource(
            url='https://www.superlan.example/',
            offline=False,
        ),
    ),
)

toml = serialize_party_to_toml(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.11.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

lanpartydb-0.11.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lanpartydb-0.11.1.tar.gz
Algorithm Hash digest
SHA256 922b95b53721b8f4f8643cf9a47afac2777ba6974f48eb3f5bec682bc5a7c7c3
MD5 572fd44077bf3c7a507da709b5652043
BLAKE2b-256 04ef9bb9cadbd48064f1d17ba8180e82c87c8a066fb8b22fbb3cce532bf80883

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lanpartydb-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34d9a3537c2c878a8f20d09e68fb45040f8f58dc2157c9edf9683d4a0b053b62
MD5 85fe79eae1dc3ce19027e1688158fe3d
BLAKE2b-256 86d28377522ab3b5b133e61f2fe10f3b6a1c1cdb5e57578369ac3529d0bc80f8

See more details on using hashes here.

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