Skip to main content

Yet Another Async client API for the Telegram Calls.

Project description

pytgcalls logo

A simple and elegant client that allows you to make group voice calls quickly and easily.
Examples Documentation PyPi Channel Chat

PyTgCalls PyPI Downloads

This project allows making Telegram call using MtProto and WebRTC, this is possible thanks to the power of NTgCalls library and @evgeny-nadymov

Example Usage

from pytgcalls import PyTgCalls
from pytgcalls import idle
...
chat_id = -1001185324811
app = PyTgCalls(client)
app.start()
app.play(
    chat_id,
    'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',
)
idle()

Features

  • Prebuilt wheels for macOS, Linux and Windows.
  • Supporting all type of MTProto libraries: Pyrogram, Telethon and Hydrogram.
  • Work with voice chats in channels and chats.
  • Join as channels or chats.
  • Mute/unmute, pause/resume, stop/play, volume control and more...
  • 🆕 Advanced Memory Management: Automatic memory leak prevention and monitoring
  • 🆕 Cache Optimization: Intelligent cache cleanup and management
  • 🆕 Resource Cleanup: Proper shutdown and resource management

Memory Management Features

PyTgCalls now includes advanced memory management to prevent memory leaks:

# Initialize with memory management
call_py = PyTgCalls(
    app,
    enable_memory_manager=True,  # Enable automatic memory management
    memory_cleanup_interval=300,  # Cleanup every 5 minutes
    cache_duration=3600,  # Cache duration 1 hour
)

# Monitor memory usage
stats = call_py.get_memory_stats()
print(f"Memory Usage: {stats['usage']['rss_mb']:.1f} MB")

# Force cleanup
await call_py.force_cleanup()

# Proper shutdown
await call_py.shutdown()

For detailed memory management documentation, see MEMORY_MANAGEMENT.md.

Requirements

  • Python 3.9 or higher.
  • An MTProto Client
  • A Telegram API key.
  • Optional: psutil for memory monitoring features

How to install?

Here's how to install the PyTgCalls lib, the commands are given below:

# With Git
pip install git+https://github.com/pytgcalls/pytgcalls -U

# With PyPi (Recommended)
pip install anthraleia-pytgcalls -U

# With memory monitoring features
pip install "anthraleia-pytgcalls[memory-monitoring]" -U

Key Contributors

  • @Laky-64 (DevOps Engineer, Software Architect):
    • Played a crucial role in developing PyTgCalls being an ex developer of pyservercall and of tgcallsjs.
    • Automation with GitHub Actions
  • @kuogi (Senior UI/UX designer, Documenter):
    • As a Senior UI/UX Designer, Kuogi has significantly improved the user interface of our documentation, making it more visually appealing and user-friendly.
    • Played a key role in writing and structuring our documentation, ensuring that it is clear, informative, and accessible to all users.
  • @vrumger (Senior Node.js Developer, Software Architect):
    • Has made important fixes and enhancements to the WebRTC component of the library, improving its stability and performance.
    • Main developer of TgCallsJS
  • @alemidev (Senior Python Developer):
    • Has made important fixes and enhancements to the async part of the library

Junior Developers

  • @TuriOG (Junior Python Developer):
    • Currently working on integrating NTgCalls into PyTgCalls, an important step in expanding the functionality and usability of the library.

Special Thanks

  • @evgeny-nadymov: A heartfelt thank you to Evgeny Nadymov for graciously allowing us to use their code from telegram-react. His contribution has been pivotal to the success of this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anthraleia_pytgcalls-1.0.10.tar.gz (54.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anthraleia_pytgcalls-1.0.10-py3-none-any.whl (89.4 kB view details)

Uploaded Python 3

File details

Details for the file anthraleia_pytgcalls-1.0.10.tar.gz.

File metadata

  • Download URL: anthraleia_pytgcalls-1.0.10.tar.gz
  • Upload date:
  • Size: 54.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for anthraleia_pytgcalls-1.0.10.tar.gz
Algorithm Hash digest
SHA256 5b11458e2823401efa411f5a1dce2967a9f2b049649a47ad853ad53bccaeb627
MD5 f31a2c35cc1d1225d9815297d92b8c6a
BLAKE2b-256 1c0834fc6e0ee91a37795f8a3f67f7277264dc590b831dbadad8c7a03f234001

See more details on using hashes here.

File details

Details for the file anthraleia_pytgcalls-1.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for anthraleia_pytgcalls-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f292e4251b30dd186c3667b8d48eb5ee3183952030e7d6a3d75ef60ff3f6ca90
MD5 c2680cd044ced73e6d45a96a9dc604df
BLAKE2b-256 0fb69bc29e8ea0c0663d9ff19ec129db537fe96a3f56c28795a0659930f2d083

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page