Skip to content

Think about adding pyproject.toml to make pelita_template an installable module #71

@Debilski

Description

@Debilski

Pelita already works with modules on the command line (for some pip-installed pelita player abcde, we can run a game with pelita abcde abcde on the command line).

For best-practices this might need some restructuring of the files (I think we would want to have all groupN related files in a subdirectory).

Also, we probably want to have a namespace convention so that we do not end up having group0 directly in site-packages.

A neat addition would be a __main__.py file, which could be used to easily start up network games using python -m

from pelita.scripts.pelita_player import with_zmq_router
import click

from pelita_player_groupN import groupN

@click.command()
@click.option('--address')
def main(address):
    with_zmq_router(groupN, address, advertise=True)

main()

which could be shrunk down to

from pelita.utils import publish_team
from pelita_player_groupN import groupN

publish_team(groupN)

The usage could then be python -m pelita_player_groupN --address 0.0.0.0:12345 to publish and advertise over mDNS a network player. (To be fair, the current way of doing this is not much more complicated either and does not need a __main__.py at all.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions