tdjson 0.1.0.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tdjson might be problematic. Click here for more details.

@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # deps
4
+ dnf install wget gcc-c++ make git perl-IPC-Cmd perl-Pod-Html gperf -y
5
+ /opt/python/cp313-cp313/bin/python -m pip install cmake
6
+
7
+ # openssl from source
8
+ git clone --depth 1 https://github.com/openssl/openssl
9
+ cd openssl
10
+ ./Configure
11
+ make -j100
12
+ make install
13
+ ldconfig /usr/local/lib64/
14
+ cd .. && rm -rf openssl
15
+
16
+ # zlib from source
17
+ git clone --depth 1 https://github.com/madler/zlib
18
+ cd zlib
19
+ ./configure --static
20
+ make install
21
+ cd .. && rm -rf zlib
22
+
23
+ #Build TDLib
24
+ git clone --depth 1 https://github.com/tdlib/td.git
25
+ cd td
26
+ rm -rf build
27
+ mkdir build
28
+ cd build
29
+ cmake -DOPENSSL_USE_STATIC_LIBS=TRUE -DZLIB_USE_STATIC_LIBS=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
30
+ cmake --build . --target install -j$(($(nproc) - 1))
31
+ cd .. && rm -rf td
@@ -0,0 +1,39 @@
1
+ name: Build and Publish Wheels
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - "main"
7
+
8
+ paths:
9
+ - "tdjson/__init__.py"
10
+
11
+ jobs:
12
+ build-and-publish:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: read
16
+ id-token: write
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v3
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v4
24
+ with:
25
+ python-version: '3.13.1'
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade scikit-build-core nanobind build ninja cibuildwheel auditwheel
30
+
31
+ - name: Build wheels
32
+ run: |
33
+ python -m build --sdist
34
+ python -m cibuildwheel .
35
+ mv ./wheelhouse/*.whl dist/
36
+ ls dist/
37
+
38
+ - name: Publish to PyPI
39
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,171 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # PyPI configuration file
171
+ .pypirc
@@ -0,0 +1,14 @@
1
+ function(prevent_in_source_build)
2
+ get_filename_component(REAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH)
3
+ get_filename_component(REAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH)
4
+
5
+ if (REAL_BINARY_DIR STREQUAL REAL_SOURCE_DIR)
6
+ message(" Out-of-source build must be used. Remove the files already")
7
+ message(" created by CMake and rerun CMake from a new directory:")
8
+ message(" rm -rf CMakeFiles CMakeCache.txt")
9
+ message(" mkdir build")
10
+ message(" cd build")
11
+ message(" cmake ..")
12
+ message(FATAL_ERROR "In-source build failed.")
13
+ endif()
14
+ endfunction()
@@ -0,0 +1,51 @@
1
+ cmake_minimum_required(VERSION 3.15)
2
+
3
+ if(POLICY CMP0065)
4
+ # do not export symbols from executables
5
+ # affects compiler checks in project(), so must be set before it
6
+ cmake_policy(SET CMP0065 NEW)
7
+ endif()
8
+
9
+ project(tdjson VERSION 0.1.0 LANGUAGES CXX C)
10
+
11
+ if(NOT DEFINED CMAKE_MODULE_PATH)
12
+ set(CMAKE_MODULE_PATH "")
13
+ endif()
14
+
15
+ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" "${CMAKE_MODULE_PATH}")
16
+
17
+ if(POLICY CMP0054)
18
+ # do not expand quoted arguments
19
+ cmake_policy(SET CMP0054 NEW)
20
+ endif()
21
+
22
+ if(POLICY CMP0074)
23
+ # use environment variables to find libraries
24
+ cmake_policy(SET CMP0074 NEW)
25
+ endif()
26
+
27
+ include(PreventInSourceBuild)
28
+ prevent_in_source_build()
29
+
30
+ find_package(Td REQUIRED)
31
+
32
+ if (CMAKE_VERSION VERSION_LESS 3.18)
33
+ set(DEV_MODULE Development)
34
+ else()
35
+ set(DEV_MODULE Development.Module)
36
+ endif()
37
+
38
+ find_package(Python COMPONENTS Interpreter ${DEV_MODULE} REQUIRED OPTIONAL_COMPONENTS Development.SABIModule)
39
+ find_package(nanobind CONFIG REQUIRED)
40
+
41
+ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
42
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
43
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
44
+ endif()
45
+
46
+ nanobind_add_module(tdjson_ext STABLE_ABI FREE_THREADED NOMINSIZE LTO tdjson/ext/tdjson.cpp)
47
+
48
+ target_link_libraries(tdjson_ext PRIVATE Td::TdJson)
49
+
50
+ # install(TARGETS tdjson_ext LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/tdjson)
51
+ install(TARGETS tdjson_ext LIBRARY DESTINATION tdjson)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AYMEN
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.1
2
+ Name: tdjson
3
+ Version: 0.1.0.dev1
4
+ Author-Email: AYMEN Mohammed <let.me.code.safe@gmail.com>
5
+ License: MIT
6
+ Project-URL: Source, https://github.com/AYMENJD/tdjson
7
+ Project-URL: Tracker, https://github.com/AYMENJD/tdjson/issues
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+
11
+ # tdjson
@@ -0,0 +1 @@
1
+ # tdjson
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["scikit-build-core >=0.10", "nanobind >=2.2.0"]
3
+ build-backend = "scikit_build_core.build"
4
+
5
+ [project]
6
+ name = "tdjson"
7
+ version = "0.1.0.dev1"
8
+ description = ""
9
+ readme = "README.md"
10
+ authors = [{ name = "AYMEN Mohammed", email = "let.me.code.safe@gmail.com" }]
11
+ license = { text = "MIT" }
12
+ requires-python = ">=3.9"
13
+ keywords = []
14
+
15
+ [project.urls]
16
+ Source = "https://github.com/AYMENJD/tdjson"
17
+ Tracker = "https://github.com/AYMENJD/tdjson/issues"
18
+
19
+ [tool.scikit-build]
20
+ build-dir = "build/{wheel_tag}"
21
+ wheel.py-api = "cp312"
22
+
23
+ [tool.cibuildwheel]
24
+ build-verbosity = 1
25
+ build = "cp39* cp310* cp311* cp312* cp313*"
26
+ enable = ["cpython-freethreading"]
27
+ skip = "*musllinux*"
28
+ archs = ["x86_64"]
29
+
30
+ [tool.cibuildwheel.linux]
31
+ before-all = ".github/workflows/before-all.sh"
32
+ manylinux-x86_64-image = "manylinux_2_28"
@@ -0,0 +1,5 @@
1
+ from .tdjson import TdJson, td_create_client_id, td_send, td_receive, td_execute
2
+
3
+ __version__ = "0.1.0.dev0"
4
+ __copyright__ = "Copyright (c) 2025 AYMENJD"
5
+ __license__ = "MIT License"
@@ -0,0 +1,11 @@
1
+ #include <td/telegram/td_json_client.h>
2
+ #include <nanobind/nanobind.h>
3
+
4
+ NB_MODULE(tdjson_ext, m)
5
+ {
6
+ m.def("td_create_client_id", &td_create_client_id, "Returns an opaque identifier of a new TDLib instance")
7
+ .def("td_send", &td_send, "Sends request to the TDLib client. May be called from any thread")
8
+ .def("td_receive", &td_receive, "Receives incoming updates and request responses. Must not be called simultaneously from two different threads")
9
+ .def("td_execute", &td_execute, "Synchronously executes a TDLib request");
10
+ // TODO: td_set_log_message_callback?
11
+ }
@@ -0,0 +1,6 @@
1
+ from .tdjson_ext import td_create_client_id, td_send, td_receive, td_execute
2
+
3
+
4
+ class TdJson:
5
+ def __init__(self):
6
+ pass