2019-05-10 14:14:10 +00:00
|
|
|
Install Guide
|
|
|
|
=============
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2019-04-12 13:52:06 +00:00
|
|
|
Being a Python library, **Pyrogram** requires Python to be installed in your system.
|
2019-05-10 14:14:10 +00:00
|
|
|
We recommend using the latest versions of both Python 3 and pip.
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2019-04-12 13:52:06 +00:00
|
|
|
- Get **Python 3** from https://www.python.org/downloads/ (or with your package manager)
|
|
|
|
- Get **pip** by following the instructions at https://pip.pypa.io/en/latest/installing/.
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-10-14 09:47:30 +00:00
|
|
|
.. important::
|
|
|
|
|
|
|
|
Pyrogram supports **Python 3** only, starting from version 3.4. **PyPy** is supported too.
|
2018-06-05 14:36:37 +00:00
|
|
|
|
|
|
|
Install Pyrogram
|
|
|
|
----------------
|
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
- The easiest way to install and upgrade Pyrogram to its latest stable version is by using **pip**:
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
.. code-block:: text
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-12-31 12:22:14 +00:00
|
|
|
$ pip3 install -U pyrogram
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
- or, with TgCrypto_ as extra requirement (recommended):
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
.. code-block:: text
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-12-31 12:22:14 +00:00
|
|
|
$ pip3 install -U pyrogram[fast]
|
2018-06-05 14:36:37 +00:00
|
|
|
|
|
|
|
Bleeding Edge
|
|
|
|
-------------
|
|
|
|
|
2019-05-16 19:28:34 +00:00
|
|
|
Pyrogram is always evolving, although new releases on PyPI are published only when enough changes are added, but this
|
|
|
|
doesn't mean you can't try new features right now!
|
2019-04-12 13:52:06 +00:00
|
|
|
|
2019-05-16 19:28:34 +00:00
|
|
|
In case you'd like to try out the latest Pyrogram features, the `GitHub repo`_ is always kept updated with new changes;
|
|
|
|
you can install the development version straight from the ``develop`` branch using this command (note "develop.zip" in
|
|
|
|
the link):
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
.. code-block:: text
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-12-31 12:22:14 +00:00
|
|
|
$ pip3 install -U https://github.com/pyrogram/pyrogram/archive/develop.zip
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
Asynchronous
|
|
|
|
------------
|
|
|
|
|
2019-04-12 13:52:06 +00:00
|
|
|
Pyrogram heavily depends on IO-bound network code (it's a cloud-based messaging framework after all), and here's
|
2019-05-16 19:28:34 +00:00
|
|
|
where asyncio shines the most by providing extra performance and efficiency while running on a single OS-level thread
|
|
|
|
only.
|
2018-10-16 23:07:33 +00:00
|
|
|
|
2019-04-12 13:52:06 +00:00
|
|
|
**A fully asynchronous variant of Pyrogram is therefore available** (Python 3.5.3+ required).
|
2018-12-31 12:22:14 +00:00
|
|
|
Use this command to install (note "asyncio.zip" in the link):
|
2018-10-16 23:07:33 +00:00
|
|
|
|
|
|
|
.. code-block:: text
|
|
|
|
|
2018-12-31 12:22:14 +00:00
|
|
|
$ pip3 install -U https://github.com/pyrogram/pyrogram/archive/asyncio.zip
|
2018-10-16 23:07:33 +00:00
|
|
|
|
|
|
|
|
2019-05-17 23:45:01 +00:00
|
|
|
Pyrogram's API remains the same and features are kept up to date from the non-async, default develop branch, but you
|
2018-11-03 13:24:02 +00:00
|
|
|
are obviously required Python asyncio knowledge in order to take full advantage of it.
|
2018-10-16 23:07:33 +00:00
|
|
|
|
|
|
|
|
2018-11-03 13:24:02 +00:00
|
|
|
.. tip::
|
2018-10-16 23:07:33 +00:00
|
|
|
|
|
|
|
The idea to turn Pyrogram fully asynchronous is still under consideration, but is wise to expect that in future this
|
|
|
|
would be the one and only way to work with Pyrogram.
|
|
|
|
|
2018-11-03 13:24:02 +00:00
|
|
|
You can start using Pyrogram Async variant right now as an excuse to learn more about asynchronous programming and
|
|
|
|
do experiments with it!
|
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
.. raw:: html
|
|
|
|
|
|
|
|
<script async
|
|
|
|
src="https://telegram.org/js/telegram-widget.js?4"
|
|
|
|
data-telegram-post="Pyrogram/4"
|
|
|
|
data-width="100%">
|
|
|
|
</script>
|
|
|
|
|
|
|
|
.. centered:: Subscribe to `@Pyrogram <https://t.me/Pyrogram>`_ for news and announcements
|
|
|
|
|
2018-06-05 14:36:37 +00:00
|
|
|
Verifying
|
|
|
|
---------
|
|
|
|
|
|
|
|
To verify that Pyrogram is correctly installed, open a Python shell and import it.
|
|
|
|
If no error shows up you are good to go.
|
|
|
|
|
2018-10-16 23:07:33 +00:00
|
|
|
.. code-block:: python
|
2018-06-05 14:36:37 +00:00
|
|
|
|
|
|
|
>>> import pyrogram
|
|
|
|
>>> pyrogram.__version__
|
2019-05-17 23:45:01 +00:00
|
|
|
'0.13.0'
|
2018-06-05 14:36:37 +00:00
|
|
|
|
2019-05-13 16:04:44 +00:00
|
|
|
.. _TgCrypto: ../topics/tgcrypto
|
2019-04-12 13:52:06 +00:00
|
|
|
.. _`Github repo`: http://github.com/pyrogram/pyrogram
|