Saravanan666/pypi-org huggingface dataset:
Package: chess.com
Python wrapper for Chess.com Public APIPython wrapper for Chess.com API which provides public data from the chess.com website. All endpoints provided by Chess.com's API are available in the respectively named methods.InstallationThe package requires Python 3.7 or higher.Install latest version fromPyPI:pip install chess.comResourcesDocumentation:readthedocs.orgPublished-Data API:chess.comUsageRetrieving DataAll the functions return aChessDotComResponseobject. The data can be accessed in dictionary format or via attributes.The package usesaiohttpfor asynchronous requests andrequestsfor synchronous requests to interact with the API.Synchronousfromchessdotcomimportget_player_profile,ClientClient.request_config["headers"]["User-Agent"]=("My Python Application. ""Contact me at email@example.com")response=get_player_profile("fabianocaruana")player_name=response.json['player']['name']#orplayer_name=response.player.nameAsynchronousimportasynciofromchessdotcom.aioimportget_player_profileusernames=["fabianocaruana","GMHikaruOnTwitch","MagnusCarlsen","GarryKasparov"]cors=[get_player_profile(name)fornameinusernames]asyncdefgather_cors(cors):returnawaitasyncio.gather(*cors)responses=asyncio.run(gather_cors(cors))Managing Rate LimitThe package offers several ways to deal with the rate limit. Every function accepts attsparameter which controls the number of seconds theClientwill wait before making the request. This is useful if running a lot of coroutines at once.cors=[get_player_profile(name,tts=i/10)fori,nameinenumerate(usernames)]The second method is to adjust therate_limit_handlerattribute of theClientobject.Client.rate_limit_handler.tries=2Client.rate_limit_handler.tts=4If the initial request gets rate limited the client will automatically retry the request2 more timeswith an interval of4 seconds.Configuring HeadersHeaders and and other request parameters can be set through theClientobject. Official Chess.com documentation requires adding aUser-Agentheader.fromchessdotcomimportClientClient.request_config["headers"]["User-Agent"]=("My Python Application. ""Contact me at email@example.com")All the methods from the package will now include the header when making a request to the API.ContactEmail me atsarartur.ruk@gmail.comor open a newIssueon Github.
Package: chessdata
ChessDataTools for analyzing chess data.Access chess games with public APIs, convert chess formats like PGNs to data-friendly formats like CSVs, and analyze moves with chess engines.AboutChess is a rich area for data analysis. Records of billions (!) of games are available for free. These can be mined not only for chess insights, but to research other areas of interest including explainable AI, fraud detection, and many others. But chess games are typically not stored in formats suitable for data analysis.This library contains tools to make it easier to do research with chess data. It allows you to convert PGNs - the most common format for chess games, which is human-readable but poorly suited to data analysis - and converts them to data-friendly formats like CSVs. It also contains utilities for using a chess engine to analyze the quality of moves in large numbers of games.Installpip install chessdataHow to usefromchessdata.etfimportpgn2dfpgn=open("data/magnus.pgn")df=pgn2df(pgn)EventSiteDateRoundWhiteBlackResultBlackEloBlackRatingDiffBlackTitleECOTerminationTimeControlUTCDateUTCTimeVariantWhiteEloWhiteRatingDiffWhiteTitle0Rated Blitz gamehttps://lichess.org/lAV0T0zl2021.12.23?DrNyktersteinmay6enexttime1-02974-2GMB20Normal180+02021.12.2323:28:07Standard3212+2GM1Rated Blitz gamehttps://lichess.org/Nfk9W01S2021.12.23?may6enexttimeDrNykterstein0-13209+3GME48Time forfeit180+02021.12.2323:21:54Standard2977-3GM2Rated Blitz gamehttps://lichess.org/mpxofZFJ2021.12.23?DrNyktersteinmay6enexttime1-02979-2GMB20Time forfeit180+02021.12.2323:15:48Standard3207+2GM3Rated Blitz gamehttps://lichess.org/hjSxkukT2021.12.23?may6enexttimeDrNykterstein0-13204+3GME48Normal180+02021.12.2323:10:43Standard2982-3GM4Rated Blitz gamehttps://lichess.org/5cgs1l6r2021.12.23?DrNyktersteinmay6enexttime1-02984-2GMB20Normal180+02021.12.2323:07:55Standard3202+2GMPlease see the notebooks for more examples and use cases.
Package: chessdata-pyclient
chessdata-pyclientPython library for interacting with the CHESS metadata serviceInstallationIn an environment of your choosing, runpython setup.py installSet the environment variableREQUESTS_CA_BUNDLEto a path to a CA bundle to use (for SSL).(optional, but recommended) Runkinit -c ~/krb5_ccache <user>ExamplesSearch the CHESS metadata database for records on tomography scans taken at ID3A:fromchessdataimportqueryrecords=query('{"beamline":"3a" "technique":"tomography"}')Submit a new record to the CHESS metadata database from a file,record.json, under the'test'schema:fromchessdataimportinsertinsert('record.json','test')
Package: chessdotcom-export
chessdotcom_exportExport your chess.com games using the public API.Published-Data API DocsInstallationRequirespython3.6+To install with pip, run:pip install chessdotcom-exportUsageexportchessdotcom_export export --help
Usage: chessdotcom_export export [OPTIONS] USERNAME

  Export your chess games

Options:
  --help  Show this message and exit.The only required argument is your username, the API serves public data and has no serial rate limit.inspectUsage: chessdotcom_export inspect [OPTIONS] FROM_FILE

  Parse an exported JSON file and interact with it

Options:
  --help  Show this message and exit.ExampleThe games are described inPGN(which can be parsed using thechesspackage), with the final board state inFEN, also parseable usingchess.Board$ chessdotcom_export export seanbreckenridge >data.json
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/archives
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/01
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/02
$ chessdotcom_export inspect data.json

In [1]: import io, chess.pgn

In [2]: game = chess.pgn.read_game(io.StringIO(games[0].pgn))

In [3]: for move in game.mainline_moves():
   ...:     print(move)
   ...:
e2e4
e7e6
b1c3
d8f6
d2d3
f8c5
d3d4
c5d4
f2f3Library UsageYou can also run the commands from python:In [1]: import chessdotcom_export

In [2]: games = list(map(lambda j: chessdotcom_export.Game.from_api_response(j), chessdotcom_export.get_player_games("seanbreckenridge")))
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/archives
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/01
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/02

In [3]: games[0].fen
Out[3]: 'r3k2r/5ppp/1Qp5/p3p2q/K3P3/4BP1N/1PP3PP/R4B1R b kq -'

In [4]: export = chessdotcom_export.from_export("data.json")

In [5]: export[0].fen
Out[5]: 'r3k2r/5ppp/1Qp5/p3p2q/K3P3/4BP1N/1PP3PP/R4B1R b kq -'Testsgitclone'https://github.com/seanbreckenridge/chessdotcom_export'cd./chessdotcom_export
pipinstall'.[testing]'mypy./chessdotcom_export
Package: chessengine
Chess EngineA chess engine written in Python with no dependencies. All contributions welcome.NoteThis project is in active development and you may encounter bugs, especially in the game loop.Contribution GuideThe contribution guide can be found on thedocumentation pageFeaturesInternal bitboard representationAlpha-beta pruned searchMove generation APIOpening bookTODOsMove ordering for faster forward searchNon-trivial board state evaluation using better heuristicsUsageInstall usingpip-# macOS / Linux (could work on Windows)python3-mpipinstall-Uchessengine# Windows (the primary way)py-3-mpipinstall-UchessengineStart a game with the computer -chessengineplayorpython-mchessengineplayIf you want to play against another player -chessengineplay-porpython-mchessengineplay-pDeveloper NotesThis project uses theblacklinter for determining code style.# Install black via pip.python-mpipinstallblack==22.10.0# Formatblack.If you've forked this repository, considerenabling GitHub Actionsto leverage the automatic pull request creation provided for resolving code formatting errors!
Package: chessEngines
chessEnginesThis project is a wrapper for chess engines supporting the UCI protocol.
It allows you to create a connection to a compiled chess engine and communicate
with it. By default, the following engines are distributed with this project:StockfishLeela Chess ZeroThese distributions can be found under /Engines. The distributions are original and no
changes have been made.UsageIn the following we will connect to the default distribution of Stockfish
and find the best move in a set position:fromchess_enginesimportengines# called each time stockfish finds a potential 'best move'defon_move_found(move):print(move)# load Stockfishsf=engines.Stockfish()# set starting positionsf.play_moves_san('1. e4 e5 2. Nf3 Nc6 3. Bc4')# find the best move within 2 secondsbest_move=sf.best_move_san(max_secs=2,callback=on_move_found)print(f'Best move:{best_move}')
Package: chess-export
chess_exportExport your (or someone else's) chess.com/lichess.org games using their APIsChess.com requires no authentication, see theirpublic API docsLichess requires you to create a token, you can do so by goinghere(this requires no extra scopes)InstallationRequirespython3.8+To install with pip, run:pip install chess-exportUsageEach subcommand (chessdotcom/lichess) has anexportandinspectcommand --exportprints data about your games as JSON,inspectreads that dumped info so you can use it in the REPL.Theinspectcommand just accepts the file as the first argument, likechess_export lichess inspect data.jsonorchess_export chessdotcom inspect data.jsonchessdotcom exportThe only required argument is your username, the API serves public data and has no serial rate limit$ chess_export chessdotcom export seanbreckenridge >data.json
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/archives
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/01
...If you're getting 403 errors, you may have to supply a user agent with your email, seethis forum threadTO do that, you can pass the--user-agent-emailflag or set theCHESSDOTCOM_USER_AGENT_EMAILenvironment variable.lichess exportRequires your username and atoken(this requires no extra scopes). The token can be provided with the--tokenflag or by setting theLICHESS_TOKENenvironment variable.$ chess_export lichess export seanbreckenridge > data.json
Requesting https://lichess.org/api/games/user/seanbreckenridge?pgnInJson=trueExampleThe games are described inPGN(which can be parsed using thechesspackage)$ chess_export chessdotcom export seanbreckenridge >data.json
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/archives
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/01
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/02
$ chess_export chessdotcom inspect data.json

In [1]: import io, chess.pgn

In [2]: game = chess.pgn.read_game(io.StringIO(games[0].pgn))

In [3]: for move in game.mainline_moves():
   ...:     print(move)
   ...:
e2e4
e7e6
b1c3
d8f6
d2d3
f8c5
d3d4
c5d4
f2f3The information returned bychess.com/lichessare slightly different, see thelichess/model.pyandchessdotcom/model.pyfiles for referenceTestsgitclone'https://github.com/seanbreckenridge/chess_export'cd./chess_export
pipinstall'.[testing]'mypy./chess_export
Package: chessfessor
py-chessfessorChessfessor is the short for "Chess Professor". This command line tool will allow you to download all your chess game data fromLichessandChess.com. You can then put this data in any BI tool you like to analyse your games or generate dashboards like winrates per opening.Installpython -m pip install chessfessorUsagepython -m chessfessor KasparovAdvanced usage# Display help pagepython-mchessfessor-h# Get Lichess.org games for player Kasparovpython-mchessfessorKasparov--websitelichess# Get Chess.com games for player Kasparovpython-mchessfessorKasparov--websitechessdotcom#Get Lichess.org games for player Kasparov, including casual gamespython-mchessfessorKasparov--websitelichess--include-casualDisclaimerI have no rights onLichessorChess.com. All rights belong to their respective owners.But this tool comes from free, enjoy it! 🎉
Package: chess-gym
ChessGymGym Chess is an environment for reinforcement learning with the OpenAI gym module.InstallationInstallOpenAI Gymand its dependencies.pip install gymDownload and installchess_gym:git clone https://github.com/Ryan-Rudes/chess-gym.gitcd chess-gympython setup.py installOr, you can usepip(you may view the packagehere):pip install chess-gymEnvironmentsExampleYou can use the standardChess-v0environment as so:importgymimportchess_gymenv=gym.make("Chess-v0")env.reset()terminal=Falsewhilenotterminal:action=env.action_space.sample()observation,reward,terminal,info=env.step(action)env.render()env.close()There is also an environment for the Chess960 variant; its identifier isChess960-v0Further InfoThis environment will return 0 reward until the game has reached a terminal state. In the case of a draw, it will still return 0 reward. Otherwise, the reward will be either 1 or -1, depending upon the winning player.observation,reward,terminal,info=env.step(action)Here,infowill be a dictionary containing the following information pertaining to the board configuration and game state:turn: The side to move (chess.WHITEorchess.BLACK).castling_rights: Bitmask of the rooks with castling rights.fullmove_number: Counts move pairs. Starts at 1 and is incremented after every move of the black side.halfmove_clock: The number of half-moves since the last capture or pawn move.promoted: A bitmask of pieces that have been promoted.ep_square: The potential en passant square on the third or sixth rank orNone.
Package: chess-heatmap
Implement a project based on Chess using dask and coiledDevelop a control heatmap which will show which side controls which squares how many times per ply/move.Input will be PGNs (Portable Game Notation) and produce heat maps per game per ply. Publish the (num_white_control, num_black_control) tuple for each square for each ply.
Apply parallelism to multiple games in a single PGN and to multiple PGNs
Package: chessli
A free and open-source chess improvement app that combines the power of Lichess and Anki.ChessliProjectActivity & Issue TrackingPyPIBuild & HealthDocsNews & UpdatesDemosCLI Demo (watch whole video onYoutube)Anki Cards Demo (watch whole video onYoutube)DocumentationCheck out thedocumentation:TutorialSetup chessliHow to set chessli upGames & MistakesHow to learn from your gamesOpeningsHow to build an opening repertoireTacticsHow to get better at tacticsAnki CardsHow to use chessli's anki cardsFeaturesAutomatically fetch your gamesand played tactics puzzles fromlichessvia theberserkpython client for the Lichess API.!Find your mistakesby parsing your games and analysing them withpython-chess.Build a simple opening repertoire and list your known openingsSpaced repetition & Retrieval Practice: Automatically (viaapy) or manually (via csv export) add your game mistakes, your openings and your tackled lichess puzzles intoAnkiStats and visualizations: Seamlessly showlichess leaderboardsor plot yourrating history.Getting StartedInstallationInstallpip. Seeherefor help.Install chessli withpip:pip install chessliThat's it!Basic UsageTo get help aboutchesslis commands, open your console and type:chessli --helpThe same works for subcommands, e.g., :chessli games --helpYou can find an overview of all availabe cli-commandsherein
the docs.TutorialNow as you are familiar with the basics, you might want to walk through the tutorial to get the most
out ofchessli!
Start withsetting up chessli.AcknowledgmentsAcknowledgementsLichessA free, no-ads, open source chess server that let's everyone play chess! Think about whether tobecome a patron! :)AnkiA free and open-source flashcard program using spaced-repetition, a technique from cognitive science for fast and long-lasting memorization.  I couldn't imagine learning without it anymore.Anki Card TemplatesThe interactive chess functionality on Chessli's anki cards is based fromthese fantastic cards.python-chessMost of the heavy lifting, e.g. parsing games, finding mistakes, extracting openings, etc. is done withpython-chess.berserkThe communication betweenlichessandchessliis performed viaberserktyperThechesslicliis built with the greattyperrichThe rich colors and fancy tables are made possible byrichapyImporting cards directly into anki without csv-export can be done viaapy
Package: chessmaker
ChessMakerAn easily extendible chess implementation designed
to support any custom rule or feature.Play:https://chessmaker.azurewebsites.netDocumentation:https://wolfdwyc.github.io/ChessMakerSource Code:https://github.com/WolfDWyc/ChessMakerWhat is ChessMaker?ChessMaker is a Python (3.11+) chess implementation that can be extended to support any custom rule or feature.
It allows you to build almost any variant you can think of easily and quickly.It was inspired byr/AnarchyChess- and the packaged optional rules are almost all inspired by that subreddit.ChessMaker isn't tied to any GUI, but comes with a thin,pywebio, multiplayer web interface.
The web interface supports choosing from the packaged rules, singleplayer (vs Yourself), and multiplayer
(vs a friend or random opponent). It also supports saving and loading games - which can be shared with others
and be used as puzzles.The packaged rules are:Chess960KnooksForced En PassantKnight BoostingSiberian SwipeIl VaticanoBeta DecayLa BastardaOmnipotent F6 PawnKing Cant Move to C2Vertical CastlingDouble Check to WinCapture All Pieces to WinDuck ChessContributions of new variants or anything else you'd like to see in the project are welcome!What ChessMaker isn'tA complete chess server - It currently doesn't support users, matchmaking, ratings, cheating detection,
and is very thin. The frontend is very simple and currently not the focus of the project.A chess engine - The design choices are not optimized for speed, and it doesn't provide any analysis or AI.A compliant or standard chess implementation - It doesn't support UCI or existing chess GUIs,
because it allows rules that wouldn't be possible with those.-Note: While ChessMaker isn't a chess server, one could be built on top of it, and development of alternative clients to it is welcomed and encouraged.
If this project gets enough interest, a more complete server might be added.
Package: chess-ng
Chess EngineThis is a small chess engine written in Python. It currently supports basic moves and captures for all chess pieces (this does not include en-passant and castling). The supported game endings are checkmate and stalemate.Chess AIThe game currently uses a simpleminimaxalgorithm with alpha-beta pruning to decide on its best move. This works fairly well, and at recursion depth 4, the engine starts to make pretty sensible moves, such as getting hold of the center, developing major pieces, forking pieces, controlling open and semi-open files with rooks, controlling more space by playing pawn a4 -> a5, etc...The AI is quite positionally minded, without any hard-coded square weights or similar methods. This is achieved by using a simple evaluation function in the minimax algorithm that rates the amount of legal moves the allied side can make, versus the moves of the enemy side:len(team.compute_all_moves(board))-len(enemy.compute_all_moves(board))This naturally encourages a lot of activity in the center and positional play, as well as rating pieces correctly depending on the game state (e.g. a blocked rook is worthless because it can make no moves, but a rook on a semi-open file controls a lot of space and is worth a lot), without the shortcomings of a hand-crafted or hard-coded approach.Example gameAn example game of the chess AI playing against itself can be foundhere.Getting startedInstall the package using pip, then run it using:python -m pip install chess_ng
python -m chess_ngNext up: Machine learning ?With weighted square parameters being given to improve the positional play of the AI, it seems to be a logical next step to improve the AI using machine learning by combining random parameter adjustments with a genetic algorithm.Graphical chess boardTo render a graphical chess board using thechess_ng.renderer.ImageRenderer, the class expects images of size 60x60 in the following tree structure at the root of the repository:\---media/images
    +---black
    |       bishop.png
    |       king.png
    |       knight.png
    |       pawn.png
    |       queen.png
    |       rook.png
    |
    \---white
            bishop.png
            king.png
            knight.png
            pawn.png
            queen.png
            rook.pngImages with a creative commons license can be downloaded from e.g.here.ContributionsAll contributions are welcome! All details can be found in thecontribution guidelines.PythonWritten in Python 3.8.3.LicenseThis repository is open-source software available under theMIT license.ContactPlease raise an issue for code changes. To reach out, please send an email torichard@baltrusch.net.
Package: chessplot
ChessplotIntroductionchessplotis a library for producing visualisations of chess games
by parsing and plotting.pgnfiles (Portable Game Notation).It can produce either an animated.gifof a game,
a.pdfwith a single page per move, or.pngfiles of individual moves.InstallationUsing PyPi:The easiest way to installchessplotis using Pypi.To do this, first ensure that you havepipinstalled then run:pip install chessplotUsage:The core ofchessplotis theChessPlotclass. AChessPlotcan be created using a valid path to a.pgnfile of a chess game. The game can then be visualised by calling theto_gif,to_pdf, orto_pngmethods
of theChessPlotclass.For example:from chessplot import ChessPlot
  
plot = ChessPlot(pgn="mypgnfile.pgn")

plot.to_gif(save_path="mynewgif.gif")This code will read and parse the given.pgnfilemypgnfile.pgn,
create a visualisation of the game, and then save the output as a.gifto the filemynewgif.gif.If asave_pathis not provided, a path will be generated using the path of the inputted.pgnfile.For example, creating an instance ofChessPlotwith the filemypgnfile.pgnand calling theto_gifmethod
would cause a file to be saved to the pathmypgnfile.gif.Customising plotsPlots can be customised in a number of ways using the following settings:plot_size: This determines the width of the generated plot in millimetersboard_only: Toggles the plot header to allow for plots of just the boarddisplay_notation: Toggles move notation on plotsflip_perspective: Toggles the perspective of the board from white to blackIn addition, when generating.gifor.pdffiles, the start and end
frames can be specified using thestart_frameandend_frameparameters.For example:from chessplot import ChessPlot

plot = ChessPlot(pgn="myfile.pgn")

plot.to_gif(
    plot_size=1000,
    board_only=True,
    display_notation=True,
    flip_perspective=True,
    start_frame=10,
    end_frame=15
)
Package: chessproblem.ui
This package contains the chess-problem-editor application andsome utilities around editing chess problems.  The intention of
this application is to have a visual editor application for chess
problems written using the LaTeX-style named
chess-problem-diagrams (diagram.sty).There is also an application to maintain a simple author-database
(the authors of the chess problems), so one may select authors
from this database when entering new problems.
Package: chess-program-generator
Chess Program GeneratorA program to generate a chess program. Since chess is such a complex game with
many branching paths, it is impossible to write a program for it by hand.This tool provides a CLI to generate a simple terminal chess program.Installationpip install chess-program-generatorUsageTo generate the runnable chess program:chess-program-generator [depth] > chess.pyTo run the produced chess programpython chess.pyPre-generated programA pre-compiled program, generated to a depth of 4 ply, can be downloaded from
the releases page on GitHub.