user10886: I am searching for a program/library in Python which will let two users or a user and an AI play chess with each other.
PS: I have found python-chess. Can this be used for the above along with a chess engine?

user1508: You mentioned an AI. It might not be very strong, but sunfish is an example of a Python-based chess program, should you decide to go down that route.
Do also bear in mind that XBoard protocol is a valid option, using Polyglot by Fabien Letouzey to convert from UCI to XBoard. It is much harder to convert from XBoard to UCI, through something like WB2UCI by Odd Gunnar Malin, as XBoard is much more lax about things like thinking output.
I would recommend creating an account on the Computer Chess Club if you are going to create a GUI.

user825: Yes. You can use the package to play against yourself and an engine. While I don't think there is one function that can do everything for you, but I can give you hints:
To setup up a game against an AI:

Read UCI documentation (you can find on Google)
Read the UCI functions for python-chess here
Spawn an engine thread by engine = chess.uci.popen_engine("/usr/games/stockfish")
Start a new game by engine.uci()
Send a move by engine.position
Start analysis by engine.go
Get engine results by command.result()

You will need to read the documentation carefully.
To setup a game against yourself (copied from the package documentation)
>>> import chess

>>> board = chess.Board()

>>> board.push_san("e4")
Move.from_uci('e2e4')
>>> board.push_san("e5")
Move.from_uci('e7e5')
>>> board.push_san("Qh5")
Move.from_uci('d1h5')
>>> board.push_san("Nc6")
Move.from_uci('b8c6')
>>> board.push_san("Bc4")
Move.from_uci('f1c4')
>>> board.push_san("Nf6")
Move.from_uci('g8f6')
>>> board.push_san("Qxf7")
Move.from_uci('h5f7')


10886: <p>I am searching for a program/library in Python which will let two users or a user and an AI play chess with each other.</p>

<p>PS: I have found <a href="https://pypi.python.org/pypi/python-chess" rel="nofollow">python-chess</a>. Can this be used for the above along with a chess engine?</p>
 1508: <p>You mentioned an AI. It might not be very strong, but <a href="https://github.com/thomasahle/sunfish" rel="nofollow">sunfish</a> is an example of a Python-based chess program, should you decide to go down that route.</p>

<p>Do also bear in mind that XBoard protocol is a valid option, using Polyglot by Fabien Letouzey to convert from UCI to XBoard. It is much harder to convert from XBoard to UCI, through something like WB2UCI by Odd Gunnar Malin, as XBoard is much more lax about things like thinking output.</p>

<p>I would recommend creating an account on the <a href="http://talkchess.com" rel="nofollow">Computer Chess Club</a> if you are going to create a GUI.</p>
 825: <p>Yes. You can use the package to play against yourself and an engine. While I don't think there is one function that can do everything for you, but I can give you hints:</p>

<p>To setup up a game against an AI:</p>

<ul>
<li>Read UCI documentation (you can find on Google)</li>
<li>Read the UCI functions for python-chess <a href="https://python-chess.readthedocs.io/en/v0.14.1/uci.html" rel="nofollow">here</a></li>
<li>Spawn an engine thread by <code>engine = chess.uci.popen_engine("/usr/games/stockfish")</code></li>
<li>Start a new game by <code>engine.uci()</code></li>
<li>Send a move by <code>engine.position</code></li>
<li>Start analysis by <code>engine.go</code></li>
<li>Get engine results by <code>command.result()</code></li>
</ul>

<p>You will need to read the documentation carefully.</p>

<p>To setup a game against yourself (copied from the package documentation)</p>

<pre><code>&gt;&gt;&gt; import chess

&gt;&gt;&gt; board = chess.Board()

&gt;&gt;&gt; board.push_san("e4")
Move.from_uci('e2e4')
&gt;&gt;&gt; board.push_san("e5")
Move.from_uci('e7e5')
&gt;&gt;&gt; board.push_san("Qh5")
Move.from_uci('d1h5')
&gt;&gt;&gt; board.push_san("Nc6")
Move.from_uci('b8c6')
&gt;&gt;&gt; board.push_san("Bc4")
Move.from_uci('f1c4')
&gt;&gt;&gt; board.push_san("Nf6")
Move.from_uci('g8f6')
&gt;&gt;&gt; board.push_san("Qxf7")
Move.from_uci('h5f7')
</code></pre>
