redc 0.1.0__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.
- redc-0.1.0/.clang-format +193 -0
- redc-0.1.0/.github/workflows/build_wheels.yml +39 -0
- redc-0.1.0/.gitignore +171 -0
- redc-0.1.0/CMake/PreventInSourceBuild.cmake +14 -0
- redc-0.1.0/CMakeLists.txt +50 -0
- redc-0.1.0/LICENSE +21 -0
- redc-0.1.0/PKG-INFO +64 -0
- redc-0.1.0/README.md +52 -0
- redc-0.1.0/assets/images/redc-logo.png +0 -0
- redc-0.1.0/pyproject.toml +31 -0
- redc-0.1.0/redc/__init__.py +21 -0
- redc-0.1.0/redc/callback.py +19 -0
- redc-0.1.0/redc/callbacks.py +40 -0
- redc-0.1.0/redc/client.py +730 -0
- redc-0.1.0/redc/codes.py +151 -0
- redc-0.1.0/redc/exceptions/__init__.py +2 -0
- redc-0.1.0/redc/ext/redc.cpp +327 -0
- redc-0.1.0/redc/ext/redc.h +83 -0
- redc-0.1.0/redc/ext/utils/concurrentqueue.h +3747 -0
- redc-0.1.0/redc/ext/utils/curl_utils.h +84 -0
- redc-0.1.0/redc/response.py +73 -0
- redc-0.1.0/redc/utils/__init__.py +5 -0
- redc-0.1.0/redc/utils/headers.py +60 -0
- redc-0.1.0/redc/utils/http.py +12 -0
- redc-0.1.0/redc/utils/json_encoder.py +17 -0
- redc-0.1.0/wheelhouse/redc-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +0 -0
- redc-0.1.0/wheelhouse/redc-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +0 -0
- redc-0.1.0/wheelhouse/redc-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +0 -0
- redc-0.1.0/wheelhouse/redc-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +0 -0
redc-0.1.0/.clang-format
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
---
|
2
|
+
Language: Cpp
|
3
|
+
# BasedOnStyle: Google
|
4
|
+
AccessModifierOffset: -1
|
5
|
+
AlignAfterOpenBracket: Align
|
6
|
+
AlignArrayOfStructures: None
|
7
|
+
AlignConsecutiveAssignments:
|
8
|
+
Enabled: false
|
9
|
+
AcrossEmptyLines: false
|
10
|
+
AcrossComments: false
|
11
|
+
AlignCompound: false
|
12
|
+
PadOperators: true
|
13
|
+
AlignConsecutiveBitFields:
|
14
|
+
Enabled: false
|
15
|
+
AcrossEmptyLines: false
|
16
|
+
AcrossComments: false
|
17
|
+
AlignCompound: false
|
18
|
+
PadOperators: false
|
19
|
+
AlignConsecutiveDeclarations:
|
20
|
+
Enabled: false
|
21
|
+
AcrossEmptyLines: false
|
22
|
+
AcrossComments: false
|
23
|
+
AlignCompound: false
|
24
|
+
PadOperators: false
|
25
|
+
AlignConsecutiveMacros:
|
26
|
+
Enabled: false
|
27
|
+
AcrossEmptyLines: false
|
28
|
+
AcrossComments: false
|
29
|
+
AlignCompound: false
|
30
|
+
PadOperators: false
|
31
|
+
AlignEscapedNewlines: Left
|
32
|
+
AlignOperands: Align
|
33
|
+
AlignTrailingComments:
|
34
|
+
Kind: Always
|
35
|
+
OverEmptyLines: 0
|
36
|
+
AllowAllArgumentsOnNextLine: true
|
37
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
38
|
+
AllowShortBlocksOnASingleLine: Never
|
39
|
+
AllowShortCaseLabelsOnASingleLine: false
|
40
|
+
AllowShortEnumsOnASingleLine: true
|
41
|
+
AllowShortFunctionsOnASingleLine: None # All
|
42
|
+
AllowShortIfStatementsOnASingleLine: Never # WithoutElse
|
43
|
+
AllowShortLambdasOnASingleLine: Inline # All
|
44
|
+
AllowShortLoopsOnASingleLine: false # true
|
45
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
46
|
+
AlwaysBreakAfterReturnType: None
|
47
|
+
AlwaysBreakBeforeMultilineStrings: true
|
48
|
+
AlwaysBreakTemplateDeclarations: Yes
|
49
|
+
# AttributeMacros:
|
50
|
+
# - __capability
|
51
|
+
BinPackArguments: true
|
52
|
+
BinPackParameters: true
|
53
|
+
BitFieldColonSpacing: Both
|
54
|
+
BraceWrapping:
|
55
|
+
AfterCaseLabel: false
|
56
|
+
AfterClass: false
|
57
|
+
AfterControlStatement: Never
|
58
|
+
AfterEnum: false
|
59
|
+
AfterExternBlock: false
|
60
|
+
AfterFunction: false
|
61
|
+
AfterNamespace: false
|
62
|
+
AfterObjCDeclaration: false
|
63
|
+
AfterStruct: false
|
64
|
+
AfterUnion: false
|
65
|
+
BeforeCatch: false
|
66
|
+
BeforeElse: false
|
67
|
+
BeforeLambdaBody: false
|
68
|
+
BeforeWhile: false
|
69
|
+
IndentBraces: false
|
70
|
+
SplitEmptyFunction: true
|
71
|
+
SplitEmptyRecord: true
|
72
|
+
SplitEmptyNamespace: true
|
73
|
+
BreakAfterAttributes: Never
|
74
|
+
# BreakAfterJavaFieldAnnotations: false
|
75
|
+
BreakArrays: true
|
76
|
+
BreakBeforeBinaryOperators: None
|
77
|
+
BreakBeforeBraces: Attach
|
78
|
+
BreakBeforeConceptDeclarations: Always
|
79
|
+
BreakBeforeInlineASMColon: OnlyMultiline
|
80
|
+
BreakBeforeTernaryOperators: true
|
81
|
+
BreakConstructorInitializers: BeforeComma # BeforeColon
|
82
|
+
BreakInheritanceList: BeforeComma # BeforeColon
|
83
|
+
BreakStringLiterals: true
|
84
|
+
ColumnLimit: 120 # 80
|
85
|
+
CommentPragmas: "^ IWYU pragma:"
|
86
|
+
CompactNamespaces: false
|
87
|
+
ConstructorInitializerIndentWidth: 4
|
88
|
+
ContinuationIndentWidth: 4
|
89
|
+
Cpp11BracedListStyle: true
|
90
|
+
DerivePointerAlignment: true
|
91
|
+
DisableFormat: false
|
92
|
+
EmptyLineAfterAccessModifier: Never
|
93
|
+
EmptyLineBeforeAccessModifier: LogicalBlock
|
94
|
+
ExperimentalAutoDetectBinPacking: false
|
95
|
+
FixNamespaceComments: true
|
96
|
+
ForEachMacros:
|
97
|
+
- Q_FOREACH_THIS_LIST_MUST_BE_NON_EMPTY
|
98
|
+
IncludeBlocks: Preserve
|
99
|
+
IncludeCategories:
|
100
|
+
- Regex: ".*"
|
101
|
+
Priority: 0
|
102
|
+
IndentAccessModifiers: false
|
103
|
+
IndentCaseBlocks: false
|
104
|
+
IndentCaseLabels: true
|
105
|
+
IndentExternBlock: AfterExternBlock
|
106
|
+
IndentGotoLabels: true
|
107
|
+
IndentPPDirectives: None
|
108
|
+
IndentRequiresClause: true
|
109
|
+
IndentWidth: 2
|
110
|
+
IndentWrappedFunctionNames: false
|
111
|
+
InsertBraces: false
|
112
|
+
InsertNewlineAtEOF: false
|
113
|
+
# InsertTrailingCommas: None
|
114
|
+
IntegerLiteralSeparator:
|
115
|
+
Binary: 0
|
116
|
+
Decimal: 0
|
117
|
+
Hex: 0
|
118
|
+
# JavaScriptQuotes: Leave
|
119
|
+
# JavaScriptWrapImports: true
|
120
|
+
KeepEmptyLinesAtTheStartOfBlocks: false
|
121
|
+
LambdaBodyIndentation: Signature
|
122
|
+
LineEnding: DeriveLF
|
123
|
+
MacroBlockBegin: ""
|
124
|
+
MacroBlockEnd: ""
|
125
|
+
MaxEmptyLinesToKeep: 1
|
126
|
+
NamespaceIndentation: None
|
127
|
+
# ObjCBinPackProtocolList: Never
|
128
|
+
# ObjCBlockIndentWidth: 2
|
129
|
+
# ObjCBreakBeforeNestedBlockParam: true
|
130
|
+
# ObjCSpaceAfterProperty: false
|
131
|
+
# ObjCSpaceBeforeProtocolList: true
|
132
|
+
PackConstructorInitializers: NextLine
|
133
|
+
PenaltyBreakAssignment: 2
|
134
|
+
PenaltyBreakBeforeFirstCallParameter: 1
|
135
|
+
PenaltyBreakComment: 300
|
136
|
+
PenaltyBreakFirstLessLess: 120
|
137
|
+
PenaltyBreakOpenParenthesis: 0
|
138
|
+
PenaltyBreakString: 1000
|
139
|
+
PenaltyBreakTemplateDeclaration: 10
|
140
|
+
PenaltyExcessCharacter: 1000000
|
141
|
+
PenaltyIndentedWhitespace: 0
|
142
|
+
PenaltyReturnTypeOnItsOwnLine: 200
|
143
|
+
PointerAlignment: Right # Left
|
144
|
+
PPIndentWidth: -1
|
145
|
+
QualifierAlignment: Leave
|
146
|
+
ReferenceAlignment: Pointer
|
147
|
+
ReflowComments: false # true
|
148
|
+
RemoveBracesLLVM: false
|
149
|
+
RemoveSemicolon: false
|
150
|
+
RequiresClausePosition: OwnLine
|
151
|
+
RequiresExpressionIndentation: OuterScope
|
152
|
+
SeparateDefinitionBlocks: Leave
|
153
|
+
ShortNamespaceLines: 0 # 1
|
154
|
+
SortIncludes: CaseInsensitive # CaseSensitive
|
155
|
+
# SortJavaStaticImport: Before
|
156
|
+
SortUsingDeclarations: Lexicographic # LexicographicNumeric
|
157
|
+
SpaceAfterCStyleCast: false
|
158
|
+
SpaceAfterLogicalNot: false
|
159
|
+
SpaceAfterTemplateKeyword: true
|
160
|
+
SpaceAroundPointerQualifiers: Default
|
161
|
+
SpaceBeforeAssignmentOperators: true
|
162
|
+
SpaceBeforeCaseColon: false
|
163
|
+
SpaceBeforeCpp11BracedList: false
|
164
|
+
SpaceBeforeCtorInitializerColon: true
|
165
|
+
SpaceBeforeInheritanceColon: true
|
166
|
+
SpaceBeforeParens: ControlStatements
|
167
|
+
SpaceBeforeParensOptions:
|
168
|
+
AfterControlStatements: true
|
169
|
+
AfterForeachMacros: true
|
170
|
+
AfterFunctionDefinitionName: false
|
171
|
+
AfterFunctionDeclarationName: false
|
172
|
+
AfterIfMacros: true
|
173
|
+
AfterOverloadedOperator: false
|
174
|
+
AfterRequiresInClause: false
|
175
|
+
AfterRequiresInExpression: false
|
176
|
+
BeforeNonEmptyParentheses: false
|
177
|
+
SpaceBeforeRangeBasedForLoopColon: true
|
178
|
+
SpaceBeforeSquareBrackets: false
|
179
|
+
SpaceInEmptyBlock: false
|
180
|
+
SpaceInEmptyParentheses: false
|
181
|
+
SpacesBeforeTrailingComments: 2
|
182
|
+
SpacesInAngles: Never
|
183
|
+
SpacesInConditionalStatement: false
|
184
|
+
SpacesInContainerLiterals: true
|
185
|
+
SpacesInCStyleCastParentheses: false
|
186
|
+
SpacesInLineCommentPrefix:
|
187
|
+
Minimum: 1
|
188
|
+
Maximum: 1 # -1
|
189
|
+
SpacesInParentheses: false
|
190
|
+
SpacesInSquareBrackets: false
|
191
|
+
Standard: Auto
|
192
|
+
TabWidth: 100 # 8
|
193
|
+
UseTab: Never
|
@@ -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
|
+
- "redc/__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 cibuildwheel .
|
34
|
+
python -m build --sdist
|
35
|
+
mv ./wheelhouse/*.whl dist/
|
36
|
+
ls dist/
|
37
|
+
|
38
|
+
- name: Publish to PyPI
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
redc-0.1.0/.gitignore
ADDED
@@ -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,50 @@
|
|
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(redc 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(CURL 7.68 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(redc_ext STABLE_ABI LTO redc/ext/redc.cpp)
|
47
|
+
|
48
|
+
target_link_libraries(redc_ext PRIVATE CURL::libcurl)
|
49
|
+
|
50
|
+
install(TARGETS redc_ext LIBRARY DESTINATION redc/)
|
redc-0.1.0/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 RedC, 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.
|
redc-0.1.0/PKG-INFO
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: redc
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: RedC is a high-performance, asynchronous HTTP client library for Python, built on top of the powerful curl library
|
5
|
+
Keywords: asyncio,http,client,http-client,curl,libcurl
|
6
|
+
Author-Email: AYMEN Mohammed <let.me.code.safe@gmail.com>
|
7
|
+
License: MIT
|
8
|
+
Project-URL: Source, https://github.com/AYMENJD/redc
|
9
|
+
Project-URL: Tracker, https://github.com/AYMENJD/redc/issues
|
10
|
+
Requires-Python: >=3.9
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
|
13
|
+
<div align="center">
|
14
|
+
<img src="https://raw.githubusercontent.com/AYMENJD/redc/refs/heads/main/assets/images/redc-logo.png">
|
15
|
+
</div>
|
16
|
+
|
17
|
+
[](https://pypi.org/project/RedC) [](https://curl.se/ch/8.11.1.html) [](https://pepy.tech/project/redc)
|
18
|
+
|
19
|
+
**RedC** is a **high-performance**, asynchronous **HTTP** client library for **Python**, built on top of the powerful **curl** library. It provides a simple and intuitive interface for making HTTP requests and handling responses
|
20
|
+
|
21
|
+
## Features
|
22
|
+
|
23
|
+
- **Asynchronous by Design**: Built with `asyncio` for non-blocking HTTP requests
|
24
|
+
- **curl Backend**: Leverages the speed and reliability of libcurl for HTTP operations
|
25
|
+
- **Streaming Support**: Stream large responses with ease using callback functions
|
26
|
+
- **Proxy Support**: Easily configure proxies for your requests
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
You can install RedC via pip:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
pip install redc
|
34
|
+
```
|
35
|
+
|
36
|
+
## Quick Start
|
37
|
+
|
38
|
+
```python
|
39
|
+
import asyncio
|
40
|
+
from redc import Client
|
41
|
+
|
42
|
+
async def main():
|
43
|
+
async with Client(base_url="https://jsonplaceholder.typicode.com") as client:
|
44
|
+
# Make a GET request
|
45
|
+
response = await client.get("/posts/1")
|
46
|
+
response.raise_for_status()
|
47
|
+
print(response.status_code) # 200
|
48
|
+
print(response.json()) # {'userId': 1, 'id': 1, 'title': '...', 'body': '...'}
|
49
|
+
|
50
|
+
# Make a POST request with JSON data
|
51
|
+
response = await client.post(
|
52
|
+
"/posts",
|
53
|
+
json={"title": "foo", "body": "bar", "userId": 1},
|
54
|
+
)
|
55
|
+
response.raise_for_status()
|
56
|
+
print(response.status_code) # 201
|
57
|
+
print(response.json()) # {'id': 101, ...}
|
58
|
+
|
59
|
+
asyncio.run(main())
|
60
|
+
```
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
MIT [LICENSE](https://github.com/AYMENJD/redc/blob/main/LICENSE)
|
redc-0.1.0/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
<div align="center">
|
2
|
+
<img src="https://raw.githubusercontent.com/AYMENJD/redc/refs/heads/main/assets/images/redc-logo.png">
|
3
|
+
</div>
|
4
|
+
|
5
|
+
[](https://pypi.org/project/RedC) [](https://curl.se/ch/8.11.1.html) [](https://pepy.tech/project/redc)
|
6
|
+
|
7
|
+
**RedC** is a **high-performance**, asynchronous **HTTP** client library for **Python**, built on top of the powerful **curl** library. It provides a simple and intuitive interface for making HTTP requests and handling responses
|
8
|
+
|
9
|
+
## Features
|
10
|
+
|
11
|
+
- **Asynchronous by Design**: Built with `asyncio` for non-blocking HTTP requests
|
12
|
+
- **curl Backend**: Leverages the speed and reliability of libcurl for HTTP operations
|
13
|
+
- **Streaming Support**: Stream large responses with ease using callback functions
|
14
|
+
- **Proxy Support**: Easily configure proxies for your requests
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
You can install RedC via pip:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
pip install redc
|
22
|
+
```
|
23
|
+
|
24
|
+
## Quick Start
|
25
|
+
|
26
|
+
```python
|
27
|
+
import asyncio
|
28
|
+
from redc import Client
|
29
|
+
|
30
|
+
async def main():
|
31
|
+
async with Client(base_url="https://jsonplaceholder.typicode.com") as client:
|
32
|
+
# Make a GET request
|
33
|
+
response = await client.get("/posts/1")
|
34
|
+
response.raise_for_status()
|
35
|
+
print(response.status_code) # 200
|
36
|
+
print(response.json()) # {'userId': 1, 'id': 1, 'title': '...', 'body': '...'}
|
37
|
+
|
38
|
+
# Make a POST request with JSON data
|
39
|
+
response = await client.post(
|
40
|
+
"/posts",
|
41
|
+
json={"title": "foo", "body": "bar", "userId": 1},
|
42
|
+
)
|
43
|
+
response.raise_for_status()
|
44
|
+
print(response.status_code) # 201
|
45
|
+
print(response.json()) # {'id': 101, ...}
|
46
|
+
|
47
|
+
asyncio.run(main())
|
48
|
+
```
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
MIT [LICENSE](https://github.com/AYMENJD/redc/blob/main/LICENSE)
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["scikit-build-core >=0.10", "nanobind >=1.3.2"]
|
3
|
+
build-backend = "scikit_build_core.build"
|
4
|
+
|
5
|
+
[project]
|
6
|
+
name = "redc"
|
7
|
+
version = "0.1.0"
|
8
|
+
description = "RedC is a high-performance, asynchronous HTTP client library for Python, built on top of the powerful curl library"
|
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 = ["asyncio", "http", "client", "http-client", "curl", "libcurl"]
|
14
|
+
|
15
|
+
[project.urls]
|
16
|
+
Source = "https://github.com/AYMENJD/redc"
|
17
|
+
Tracker = "https://github.com/AYMENJD/redc/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
|
+
skip = "*musllinux*"
|
27
|
+
archs = ["x86_64"]
|
28
|
+
|
29
|
+
[tool.cibuildwheel.linux]
|
30
|
+
before-all = "yum install wget gcc openssl-devel make libpsl-devel -y && wget https://curl.se/download/curl-8.11.1.tar.gz && tar -xzvf curl-8.11.1.tar.gz && rm curl-8.11.1.tar.gz && cd curl-8.11.1 && ./configure --with-openssl --with-ca-fallback --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt && make -j && make install && ldconfig && curl --version && cd .. && rm -rf curl-8.11.1"
|
31
|
+
manylinux-x86_64-image = "manylinux2014"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from .callbacks import StreamCallback
|
2
|
+
from .client import Client
|
3
|
+
from .codes import HTTPStatus
|
4
|
+
from .exceptions import HTTPError
|
5
|
+
from .response import Response
|
6
|
+
from . import utils
|
7
|
+
|
8
|
+
__all__ = [
|
9
|
+
"Client",
|
10
|
+
"Response",
|
11
|
+
"HTTPError",
|
12
|
+
"HTTPStatus",
|
13
|
+
"StreamCallback",
|
14
|
+
"utils",
|
15
|
+
]
|
16
|
+
|
17
|
+
__version__ = "0.1.0"
|
18
|
+
__copyright__ = "Copyright (c) 2025 RedC, AYMENJD"
|
19
|
+
__license__ = "MIT License"
|
20
|
+
|
21
|
+
VERSION = __version__
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import inspect
|
2
|
+
from typing import Callable
|
3
|
+
|
4
|
+
|
5
|
+
class Callback:
|
6
|
+
def __init__(self, callback: Callable[[bytes, int], None]):
|
7
|
+
self.callback = callback
|
8
|
+
self._validate_callback()
|
9
|
+
|
10
|
+
def _validate_callback(self):
|
11
|
+
signature = inspect.signature(self.callback)
|
12
|
+
|
13
|
+
parameters = signature.parameters
|
14
|
+
num_parameters = len(parameters)
|
15
|
+
|
16
|
+
if num_parameters != 2:
|
17
|
+
raise TypeError(
|
18
|
+
f"Callback function must accept two arguments only callback(data: bytes, total_size: int), but it accepts {num_parameters}."
|
19
|
+
)
|