{"id":20461992,"url":"https://github.com/denvercoder1/play-lichess","last_synced_at":"2025-04-13T06:20:40.566Z","repository":{"id":43675615,"uuid":"364314622","full_name":"DenverCoder1/play-lichess","owner":"DenverCoder1","description":"Module for creating match links on Lichess that players can join","archived":false,"fork":false,"pushed_at":"2023-02-28T19:53:38.000Z","size":51,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T02:45:47.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DenverCoder1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-04T16:12:11.000Z","updated_at":"2023-04-08T16:17:56.000Z","dependencies_parsed_at":"2024-01-14T19:14:30.473Z","dependency_job_id":"98009a5c-8f32-42f1-a532-caf59d57aae1","html_url":"https://github.com/DenverCoder1/play-lichess","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.08823529411764708,"last_synced_commit":"aebdb418455e2ec71ef2e52a23751e116179de48"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Fplay-lichess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Fplay-lichess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Fplay-lichess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Fplay-lichess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DenverCoder1","download_url":"https://codeload.github.com/DenverCoder1/play-lichess/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248671297,"owners_count":21143062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T12:29:25.459Z","updated_at":"2025-04-13T06:20:40.543Z","avatar_url":"https://github.com/DenverCoder1.png","language":"Python","readme":"# play-lichess\n\n[![build](https://img.shields.io/github/actions/workflow/status/DenverCoder1/play-lichess/python-app.yml?branch=main)](https://github.com/DenverCoder1/play-lichess/actions/workflows/python-app.yml)\n[![version](https://img.shields.io/pypi/v/play-lichess)](https://pypi.org/project/play-lichess/)\n[![license](https://img.shields.io/pypi/l/play-lichess)](https://github.com/DenverCoder1/play-lichess/blob/main/LICENSE)\n[![Discord](https://img.shields.io/discord/819650821314052106?color=7289DA\u0026logo=discord\u0026logoColor=white \"Dev Pro Tips Discussion \u0026 Support Server\")](https://discord.gg/fPrdqh3Zfu)\n\nPython module for creating match links on Lichess that two players can join\n\n\u003e Note: Until version 0.1.3, the requests were done synchronously using `requests`. Starting with version 1.0.0, all requests are done asynchronously using `aiohttp`.\n\n## 📥 Installation\n\n`pip install play-lichess`\n\n## 🧑‍💻 Usage\n\n### Start a real-time match\n\n```py\nfrom play_lichess import RealTimeMatch\n\nasync def create_match():\n    match = await RealTimeMatch.create()\n\n    print(match.challenge_id)       # e.g. 'f1S4BBYW'\n    print(match.challenge_url)      # e.g. 'https://lichess.org/f1S4BBYW'\n    print(match.status)             # 'created'\n    print(match.variant)            # Variant.STANDARD\n    print(match.rated)              # False\n    print(match.speed)              # TimeMode.BLITZ\n    print(match.time_control.show)  # '5+0'\n    print(match.color)              # Color.RANDOM\n    print(match.url_white)          # e.g. 'https://lichess.org/f1S4BBYW?color=white'\n    print(match.url_black)          # e.g. 'https://lichess.org/f1S4BBYW?color=black'\n    print(match.name)               # None\n\nasyncio.run(create_match())  # import asyncio to call async functions outside event loop\n```\n\n### Start a correspondence match\n\n```py\nfrom play_lichess import CorrespondenceMatch\n\nasync def correspondence_match():\n    match = await CorrespondenceMatch.create()\n\n    print(match.challenge_id)               # e.g. 'KGO4ICDn'\n    print(match.challenge_url)              # e.g. 'https://lichess.org/KGO4ICDn'\n    print(match.status)                     # 'created'\n    print(match.variant)                    # Variant.STANDARD\n    print(match.rated)                      # False\n    print(match.speed)                      # TimeMode.CORRESPONDENCE\n    print(match.time_control.type)          # TimeControlType.CORRESPONDENCE\n    print(match.time_control.days_per_turn) # 1\n    print(match.color)                      # Color.RANDOM\n    print(match.url_white)                  # e.g. 'https://lichess.org/KGO4ICDn?color=white'\n    print(match.url_black)                  # e.g. 'https://lichess.org/KGO4ICDn?color=black'\n    print(match.name)                       # None\n```\n\n### Start an unlimited time match\n\n```py\nfrom play_lichess import UnlimitedMatch\n\nasync def unlimited_correspondence_match():\n    match = await UnlimitedMatch.create()\n\n    print(match.challenge_id)       # e.g. 'JLA868mV'\n    print(match.challenge_url)      # e.g. 'https://lichess.org/JLA868mV'\n    print(match.status)             # 'created'\n    print(match.variant)            # Variant.STANDARD\n    print(match.rated)              # False\n    print(match.speed)              # TimeMode.CORRESPONDENCE\n    print(match.time_control.type)  # TimeControlType.UNLIMITED\n    print(match.color)              # Color.RANDOM\n    print(match.url_white)          # e.g. 'https://lichess.org/JLA868mV?color=white'\n    print(match.url_black)          # e.g. 'https://lichess.org/JLA868mV?color=black'\n    print(match.name)               # None\n```\n\n### Specify game options\n\n```py\nfrom play_lichess import RealTimeMatch, Variant\n\nasync def create_match_options():\n    match: RealTimeMatch = await RealTimeMatch.create(\n        rated=False,\n        clock_limit=180,\n        clock_increment=0,\n        variant=Variant.ANTICHESS,\n        name=\"Test match\",\n    )\n\n    print(match.challenge_id)       # e.g. 'cuZGwbcO'\n    print(match.challenge_url)      # e.g. 'https://lichess.org/cuZGwbcO'\n    print(match.status)             # 'created'\n    print(match.variant)            # Variant.ANTICHESS\n    print(match.rated)              # False\n    print(match.speed)              # TimeMode.BLITZ\n    print(match.time_control.show)  # '3+0'\n    print(match.color)              # Color.RANDOM\n    print(match.url_white)          # e.g. 'https://lichess.org/cuZGwbcO?color=white'\n    print(match.url_black)          # e.g. 'https://lichess.org/cuZGwbcO?color=black'\n    print(match.name)               # 'Test match'\n```\n\n### Alternate syntax\n\n```py\nfrom play_lichess import Match\n\nasync def create_any_match():\n    # real-time\n    match1 = await Match.create(clock_limit=180, clock_increment=0)\n    # unlimited time\n    match2 = await Match.create(clock_limit=None, clock_increment=None)\n    # correspondence\n    match3 = await Match.create(days=1, clock_limit=None, clock_increment=None)\n```\n\n## 🔧 Options\n\n### Real-time\n\n| Argument          | Type      | Default        | Description                                         |\n| ----------------- | --------- | -------------- | --------------------------------------------------- |\n| `rated`           | `bool`    | `False`        | Whether the match is rated or not.                  |\n| `clock_limit`     | `int`     | `300`          | The time limit in seconds.                          |\n| `clock_increment` | `int`     | `0`            | The time increment in seconds.                      |\n| `variant`         | `Variant` | `STANDARD`     | The variant of the match (STANDARD, CHESS960, etc.) |\n| `fen`             | `str`     | Start position | The FEN string of the starting position.            |\n| `name`            | `str`     | `None`         | The name of the match displayed when joining.       |\n\n### Correspondence\n\n| Argument  | Type      | Default        | Description                                         |\n| --------- | --------- | -------------- | --------------------------------------------------- |\n| `rated`   | `bool`    | `False`        | Whether the match is rated or not.                  |\n| `days`    | `int`     | `1`            | The number of days for each player.                 |\n| `variant` | `Variant` | `STANDARD`     | The variant of the match (STANDARD, CHESS960, etc.) |\n| `fen`     | `str`     | Start position | The FEN string of the starting position.            |\n| `name`    | `str`     | `None`         | The name of the match displayed when joining.       |\n\n### Unlimited\n\n| Argument  | Type      | Default        | Description                                         |\n| --------- | --------- | -------------- | --------------------------------------------------- |\n| `variant` | `Variant` | `STANDARD`     | The variant of the match (STANDARD, CHESS960, etc.) |\n| `fen`     | `str`     | Start position | The FEN string of the starting position.            |\n| `name`    | `str`     | `None`         | The name of the match displayed when joining.       |\n\n### Variants\n\nVariants are defined in the `Variant` enum and include:\n\n- `Variant.STANDARD` (default)\n- `Variant.CRAZYHOUSE`\n- `Variant.CHESS960`\n- `Variant.KING_OF_THE_HILL`\n- `Variant.THREE_CHECK`\n- `Variant.ANTICHESS`\n- `Variant.ATOMIC`\n- `Variant.HORDE`\n- `Variant.RACING_KINGS`\n\n## 🧰 Development\n\n### To run tests (pytest/tox)\n\n```bash\n# Install tox\npip install -U tox\n\n# Run tests\ntox\n```\n\n### To lint (pyright)\n\n```bash\n# Install pyright\npip install -U pyright\n\n# Run pyright\npyright\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenvercoder1%2Fplay-lichess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenvercoder1%2Fplay-lichess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenvercoder1%2Fplay-lichess/lists"}