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
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',
zip_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
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
lanpartydb-0.9.1.tar.gz
(9.4 kB
view details)
Built Distribution
File details
Details for the file lanpartydb-0.9.1.tar.gz
.
File metadata
- Download URL: lanpartydb-0.9.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2827a84f71c8810e3a00e24ca2baf9695f3c5e24e9ad6882c645a1bdc7336b05 |
|
MD5 | d6544105be5a2fe7bd5d16cf7ac94b45 |
|
BLAKE2b-256 | 8de463d308c95bd9019237efc1c93f42b7a447684f67fa8596e7b7042913a390 |
File details
Details for the file lanpartydb-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: lanpartydb-0.9.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21eca08885e023888f12ba0c28604cf810a6957e9854215c87e47cf560074a0b |
|
MD5 | fea95cc2e447e0fb3b250051e11ddce9 |
|
BLAKE2b-256 | a1e6f5d49307044f8f78794a8fed7853825d8c735bd0c42b8a70d5fdfd87b16f |