Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Debilski opened this issue Sep 8, 2023 · 0 comments

Comments

@Debilski
Copy link
Member

Debilski commented Sep 8, 2023

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant