From cde314fc21adbd4b8169bd48eadc206fcca4fb87 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 4 Mar 2018 11:22:52 +0100 Subject: [PATCH] Rename package to telethon_aio and prepare for PyPi --- README.rst | 14 ++++++++++---- setup.py | 17 +++++++++-------- {telethon => telethon_aio}/__init__.py | 0 {telethon => telethon_aio}/crypto/__init__.py | 0 {telethon => telethon_aio}/crypto/aes.py | 0 {telethon => telethon_aio}/crypto/aes_ctr.py | 0 {telethon => telethon_aio}/crypto/auth_key.py | 0 .../crypto/cdn_decrypter.py | 0 .../crypto/factorization.py | 0 {telethon => telethon_aio}/crypto/rsa.py | 0 {telethon => telethon_aio}/errors/__init__.py | 0 {telethon => telethon_aio}/errors/common.py | 0 .../errors/rpc_base_errors.py | 0 {telethon => telethon_aio}/events/__init__.py | 0 .../extensions/__init__.py | 0 .../extensions/binary_reader.py | 0 {telethon => telethon_aio}/extensions/html.py | 0 .../extensions/markdown.py | 0 .../extensions/tcp_client.py | 0 {telethon => telethon_aio}/helpers.py | 0 {telethon => telethon_aio}/network/__init__.py | 0 .../network/authenticator.py | 0 .../network/connection.py | 0 .../network/mtproto_plain_sender.py | 0 .../network/mtproto_sender.py | 0 {telethon => telethon_aio}/sessions/__init__.py | 0 {telethon => telethon_aio}/sessions/abstract.py | 0 {telethon => telethon_aio}/sessions/memory.py | 0 .../sessions/sqlalchemy.py | 0 {telethon => telethon_aio}/sessions/sqlite.py | 0 .../telegram_bare_client.py | 0 {telethon => telethon_aio}/telegram_client.py | 0 {telethon => telethon_aio}/tl/__init__.py | 0 .../tl/custom/__init__.py | 0 {telethon => telethon_aio}/tl/custom/dialog.py | 0 {telethon => telethon_aio}/tl/custom/draft.py | 0 .../tl/custom/input_sized_file.py | 0 {telethon => telethon_aio}/tl/gzip_packed.py | 0 .../tl/message_container.py | 0 {telethon => telethon_aio}/tl/tl_message.py | 0 {telethon => telethon_aio}/tl/tlobject.py | 0 {telethon => telethon_aio}/update_state.py | 0 {telethon => telethon_aio}/utils.py | 0 {telethon => telethon_aio}/version.py | 0 telethon_generator/error_generator.py | 2 +- 45 files changed, 20 insertions(+), 13 deletions(-) rename {telethon => telethon_aio}/__init__.py (100%) rename {telethon => telethon_aio}/crypto/__init__.py (100%) rename {telethon => telethon_aio}/crypto/aes.py (100%) rename {telethon => telethon_aio}/crypto/aes_ctr.py (100%) rename {telethon => telethon_aio}/crypto/auth_key.py (100%) rename {telethon => telethon_aio}/crypto/cdn_decrypter.py (100%) rename {telethon => telethon_aio}/crypto/factorization.py (100%) rename {telethon => telethon_aio}/crypto/rsa.py (100%) rename {telethon => telethon_aio}/errors/__init__.py (100%) rename {telethon => telethon_aio}/errors/common.py (100%) rename {telethon => telethon_aio}/errors/rpc_base_errors.py (100%) rename {telethon => telethon_aio}/events/__init__.py (100%) rename {telethon => telethon_aio}/extensions/__init__.py (100%) rename {telethon => telethon_aio}/extensions/binary_reader.py (100%) rename {telethon => telethon_aio}/extensions/html.py (100%) rename {telethon => telethon_aio}/extensions/markdown.py (100%) rename {telethon => telethon_aio}/extensions/tcp_client.py (100%) rename {telethon => telethon_aio}/helpers.py (100%) rename {telethon => telethon_aio}/network/__init__.py (100%) rename {telethon => telethon_aio}/network/authenticator.py (100%) rename {telethon => telethon_aio}/network/connection.py (100%) rename {telethon => telethon_aio}/network/mtproto_plain_sender.py (100%) rename {telethon => telethon_aio}/network/mtproto_sender.py (100%) rename {telethon => telethon_aio}/sessions/__init__.py (100%) rename {telethon => telethon_aio}/sessions/abstract.py (100%) rename {telethon => telethon_aio}/sessions/memory.py (100%) rename {telethon => telethon_aio}/sessions/sqlalchemy.py (100%) rename {telethon => telethon_aio}/sessions/sqlite.py (100%) rename {telethon => telethon_aio}/telegram_bare_client.py (100%) rename {telethon => telethon_aio}/telegram_client.py (100%) rename {telethon => telethon_aio}/tl/__init__.py (100%) rename {telethon => telethon_aio}/tl/custom/__init__.py (100%) rename {telethon => telethon_aio}/tl/custom/dialog.py (100%) rename {telethon => telethon_aio}/tl/custom/draft.py (100%) rename {telethon => telethon_aio}/tl/custom/input_sized_file.py (100%) rename {telethon => telethon_aio}/tl/gzip_packed.py (100%) rename {telethon => telethon_aio}/tl/message_container.py (100%) rename {telethon => telethon_aio}/tl/tl_message.py (100%) rename {telethon => telethon_aio}/tl/tlobject.py (100%) rename {telethon => telethon_aio}/update_state.py (100%) rename {telethon => telethon_aio}/utils.py (100%) rename {telethon => telethon_aio}/version.py (100%) diff --git a/README.rst b/README.rst index 73aafccb..caedb010 100755 --- a/README.rst +++ b/README.rst @@ -2,7 +2,8 @@ Telethon ======== .. epigraph:: - ⭐️ Thanks **everyone** who has starred the project, it means a lot! + This is the ``asyncio`` version of the library. If you don't know how + to work with it, `see here https://pypi.python.org/pypi/Telethon`__. **Telethon** is Telegram client implementation in **Python 3** which uses the latest available API of Telegram. @@ -22,7 +23,12 @@ Installing .. code:: sh - pip3 install telethon + pip3 install telethon-aio + +.. warning:: + + Be careful **not** to install ``telethon-asyncio`` or other + variants, someone else name-squatted those and are unofficial! Creating a client @@ -31,7 +37,7 @@ Creating a client .. code:: python import asyncio - from telethon import TelegramClient + from telethon_aio import TelegramClient # These example values won't work. You must get your own api_id and # api_hash from https://my.telegram.org, under API Development. @@ -53,7 +59,7 @@ if you're new with ``asyncio``. .. code:: python - print(client.get_me().stringify()) + print((await client.get_me()).stringify()) await client.send_message('username', 'Hello! Talking to you from Telethon') await client.send_file('username', '/home/myself/Pictures/holidays.jpg') diff --git a/setup.py b/setup.py index 0e052d31..003d7c6d 100755 --- a/setup.py +++ b/setup.py @@ -37,11 +37,11 @@ class TempWorkDir: os.chdir(self.original) -ERROR_LIST = 'telethon/errors/rpc_error_list.py' +ERROR_LIST = 'telethon_aio/errors/rpc_error_list.py' ERRORS_JSON = 'telethon_generator/errors.json' ERRORS_DESC = 'telethon_generator/error_descriptions' SCHEME_TL = 'telethon_generator/scheme.tl' -GENERATOR_DIR = 'telethon/tl' +GENERATOR_DIR = 'telethon_aio/tl' IMPORT_DEPTH = 2 @@ -88,12 +88,12 @@ def main(): from subprocess import run from shutil import rmtree - for x in ('build', 'dist', 'Telethon.egg-info'): + for x in ('build', 'dist', 'Telethon_aio.egg-info'): rmtree(x, ignore_errors=True) run('python3 setup.py sdist', shell=True) run('python3 setup.py bdist_wheel', shell=True) run('twine upload dist/*', shell=True) - for x in ('build', 'dist', 'Telethon.egg-info'): + for x in ('build', 'dist', 'Telethon_aio.egg-info'): rmtree(x, ignore_errors=True) elif len(argv) >= 2 and argv[1] == 'fetch_errors': @@ -109,16 +109,17 @@ def main(): with open('README.rst', encoding='utf-8') as f: long_description = f.read() - with open('telethon/version.py', encoding='utf-8') as f: + with open('telethon_aio/version.py', encoding='utf-8') as f: version = re.search(r"^__version__\s*=\s*'(.*)'.*$", f.read(), flags=re.MULTILINE).group(1) setup( - name='Telethon', + name='Telethon-aio', version=version, - description="Full-featured Telegram client library for Python 3", + description="Full-featured Telegram client library for Python 3, " + "modified to work under Python's asyncio module.", long_description=long_description, - url='https://github.com/LonamiWebs/Telethon', + url='https://github.com/LonamiWebs/Telethon/tree/asyncio', download_url='https://github.com/LonamiWebs/Telethon/releases', author='Lonami Exo', diff --git a/telethon/__init__.py b/telethon_aio/__init__.py similarity index 100% rename from telethon/__init__.py rename to telethon_aio/__init__.py diff --git a/telethon/crypto/__init__.py b/telethon_aio/crypto/__init__.py similarity index 100% rename from telethon/crypto/__init__.py rename to telethon_aio/crypto/__init__.py diff --git a/telethon/crypto/aes.py b/telethon_aio/crypto/aes.py similarity index 100% rename from telethon/crypto/aes.py rename to telethon_aio/crypto/aes.py diff --git a/telethon/crypto/aes_ctr.py b/telethon_aio/crypto/aes_ctr.py similarity index 100% rename from telethon/crypto/aes_ctr.py rename to telethon_aio/crypto/aes_ctr.py diff --git a/telethon/crypto/auth_key.py b/telethon_aio/crypto/auth_key.py similarity index 100% rename from telethon/crypto/auth_key.py rename to telethon_aio/crypto/auth_key.py diff --git a/telethon/crypto/cdn_decrypter.py b/telethon_aio/crypto/cdn_decrypter.py similarity index 100% rename from telethon/crypto/cdn_decrypter.py rename to telethon_aio/crypto/cdn_decrypter.py diff --git a/telethon/crypto/factorization.py b/telethon_aio/crypto/factorization.py similarity index 100% rename from telethon/crypto/factorization.py rename to telethon_aio/crypto/factorization.py diff --git a/telethon/crypto/rsa.py b/telethon_aio/crypto/rsa.py similarity index 100% rename from telethon/crypto/rsa.py rename to telethon_aio/crypto/rsa.py diff --git a/telethon/errors/__init__.py b/telethon_aio/errors/__init__.py similarity index 100% rename from telethon/errors/__init__.py rename to telethon_aio/errors/__init__.py diff --git a/telethon/errors/common.py b/telethon_aio/errors/common.py similarity index 100% rename from telethon/errors/common.py rename to telethon_aio/errors/common.py diff --git a/telethon/errors/rpc_base_errors.py b/telethon_aio/errors/rpc_base_errors.py similarity index 100% rename from telethon/errors/rpc_base_errors.py rename to telethon_aio/errors/rpc_base_errors.py diff --git a/telethon/events/__init__.py b/telethon_aio/events/__init__.py similarity index 100% rename from telethon/events/__init__.py rename to telethon_aio/events/__init__.py diff --git a/telethon/extensions/__init__.py b/telethon_aio/extensions/__init__.py similarity index 100% rename from telethon/extensions/__init__.py rename to telethon_aio/extensions/__init__.py diff --git a/telethon/extensions/binary_reader.py b/telethon_aio/extensions/binary_reader.py similarity index 100% rename from telethon/extensions/binary_reader.py rename to telethon_aio/extensions/binary_reader.py diff --git a/telethon/extensions/html.py b/telethon_aio/extensions/html.py similarity index 100% rename from telethon/extensions/html.py rename to telethon_aio/extensions/html.py diff --git a/telethon/extensions/markdown.py b/telethon_aio/extensions/markdown.py similarity index 100% rename from telethon/extensions/markdown.py rename to telethon_aio/extensions/markdown.py diff --git a/telethon/extensions/tcp_client.py b/telethon_aio/extensions/tcp_client.py similarity index 100% rename from telethon/extensions/tcp_client.py rename to telethon_aio/extensions/tcp_client.py diff --git a/telethon/helpers.py b/telethon_aio/helpers.py similarity index 100% rename from telethon/helpers.py rename to telethon_aio/helpers.py diff --git a/telethon/network/__init__.py b/telethon_aio/network/__init__.py similarity index 100% rename from telethon/network/__init__.py rename to telethon_aio/network/__init__.py diff --git a/telethon/network/authenticator.py b/telethon_aio/network/authenticator.py similarity index 100% rename from telethon/network/authenticator.py rename to telethon_aio/network/authenticator.py diff --git a/telethon/network/connection.py b/telethon_aio/network/connection.py similarity index 100% rename from telethon/network/connection.py rename to telethon_aio/network/connection.py diff --git a/telethon/network/mtproto_plain_sender.py b/telethon_aio/network/mtproto_plain_sender.py similarity index 100% rename from telethon/network/mtproto_plain_sender.py rename to telethon_aio/network/mtproto_plain_sender.py diff --git a/telethon/network/mtproto_sender.py b/telethon_aio/network/mtproto_sender.py similarity index 100% rename from telethon/network/mtproto_sender.py rename to telethon_aio/network/mtproto_sender.py diff --git a/telethon/sessions/__init__.py b/telethon_aio/sessions/__init__.py similarity index 100% rename from telethon/sessions/__init__.py rename to telethon_aio/sessions/__init__.py diff --git a/telethon/sessions/abstract.py b/telethon_aio/sessions/abstract.py similarity index 100% rename from telethon/sessions/abstract.py rename to telethon_aio/sessions/abstract.py diff --git a/telethon/sessions/memory.py b/telethon_aio/sessions/memory.py similarity index 100% rename from telethon/sessions/memory.py rename to telethon_aio/sessions/memory.py diff --git a/telethon/sessions/sqlalchemy.py b/telethon_aio/sessions/sqlalchemy.py similarity index 100% rename from telethon/sessions/sqlalchemy.py rename to telethon_aio/sessions/sqlalchemy.py diff --git a/telethon/sessions/sqlite.py b/telethon_aio/sessions/sqlite.py similarity index 100% rename from telethon/sessions/sqlite.py rename to telethon_aio/sessions/sqlite.py diff --git a/telethon/telegram_bare_client.py b/telethon_aio/telegram_bare_client.py similarity index 100% rename from telethon/telegram_bare_client.py rename to telethon_aio/telegram_bare_client.py diff --git a/telethon/telegram_client.py b/telethon_aio/telegram_client.py similarity index 100% rename from telethon/telegram_client.py rename to telethon_aio/telegram_client.py diff --git a/telethon/tl/__init__.py b/telethon_aio/tl/__init__.py similarity index 100% rename from telethon/tl/__init__.py rename to telethon_aio/tl/__init__.py diff --git a/telethon/tl/custom/__init__.py b/telethon_aio/tl/custom/__init__.py similarity index 100% rename from telethon/tl/custom/__init__.py rename to telethon_aio/tl/custom/__init__.py diff --git a/telethon/tl/custom/dialog.py b/telethon_aio/tl/custom/dialog.py similarity index 100% rename from telethon/tl/custom/dialog.py rename to telethon_aio/tl/custom/dialog.py diff --git a/telethon/tl/custom/draft.py b/telethon_aio/tl/custom/draft.py similarity index 100% rename from telethon/tl/custom/draft.py rename to telethon_aio/tl/custom/draft.py diff --git a/telethon/tl/custom/input_sized_file.py b/telethon_aio/tl/custom/input_sized_file.py similarity index 100% rename from telethon/tl/custom/input_sized_file.py rename to telethon_aio/tl/custom/input_sized_file.py diff --git a/telethon/tl/gzip_packed.py b/telethon_aio/tl/gzip_packed.py similarity index 100% rename from telethon/tl/gzip_packed.py rename to telethon_aio/tl/gzip_packed.py diff --git a/telethon/tl/message_container.py b/telethon_aio/tl/message_container.py similarity index 100% rename from telethon/tl/message_container.py rename to telethon_aio/tl/message_container.py diff --git a/telethon/tl/tl_message.py b/telethon_aio/tl/tl_message.py similarity index 100% rename from telethon/tl/tl_message.py rename to telethon_aio/tl/tl_message.py diff --git a/telethon/tl/tlobject.py b/telethon_aio/tl/tlobject.py similarity index 100% rename from telethon/tl/tlobject.py rename to telethon_aio/tl/tlobject.py diff --git a/telethon/update_state.py b/telethon_aio/update_state.py similarity index 100% rename from telethon/update_state.py rename to telethon_aio/update_state.py diff --git a/telethon/utils.py b/telethon_aio/utils.py similarity index 100% rename from telethon/utils.py rename to telethon_aio/utils.py diff --git a/telethon/version.py b/telethon_aio/version.py similarity index 100% rename from telethon/version.py rename to telethon_aio/version.py diff --git a/telethon_generator/error_generator.py b/telethon_generator/error_generator.py index 73fb5c5a..4a72a35c 100644 --- a/telethon_generator/error_generator.py +++ b/telethon_generator/error_generator.py @@ -170,7 +170,7 @@ def generate_code(output, json_file, errors_desc): if __name__ == '__main__': if input('generate (y/n)?: ').lower() == 'y': - generate_code('../telethon/errors/rpc_error_list.py', + generate_code('../telethon_aio/errors/rpc_error_list.py', 'errors.json', 'error_descriptions') elif input('fetch (y/n)?: ').lower() == 'y': fetch_errors('errors.json')