liburlparser 1.4.6__tar.gz → 1.5.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.
- {liburlparser-1.4.6 → liburlparser-1.5.0}/.github/workflows/cmake.yml +2 -3
- {liburlparser-1.4.6 → liburlparser-1.5.0}/.github/workflows/wheels.yml +6 -6
- liburlparser-1.5.0/.ruff_cache/.gitignore +2 -0
- liburlparser-1.5.0/.ruff_cache/0.7.0/1045475550077068025 +0 -0
- liburlparser-1.5.0/.ruff_cache/0.7.0/4604544773037589564 +0 -0
- liburlparser-1.5.0/CMakeLists.txt +230 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/PKG-INFO +6 -3
- {liburlparser-1.4.6 → liburlparser-1.5.0}/README.md +4 -1
- {liburlparser-1.4.6/cmake/modules → liburlparser-1.5.0/cmake}/PyProject.cmake +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/examples/main.cpp +1 -1
- {liburlparser-1.4.6 → liburlparser-1.5.0}/pyproject.toml +2 -2
- liburlparser-1.5.0/src/binding/about.cpp +19 -0
- {liburlparser-1.4.6/src/binding → liburlparser-1.5.0/src/binding/bind_core}/main.cpp +2 -6
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/liburlparser/__init__.py +2 -1
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/liburlparser/core.py +1 -1
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/python/test_extra.py +1 -1
- liburlparser-1.4.6/.ruff_cache/.gitignore +0 -1
- liburlparser-1.4.6/.ruff_cache/0.2.1/17168405204037786600 +0 -0
- liburlparser-1.4.6/.ruff_cache/0.2.1/17509219516083451397 +0 -0
- liburlparser-1.4.6/CMakeLists.txt +0 -175
- {liburlparser-1.4.6 → liburlparser-1.5.0}/.clang-format +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/.gitignore +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/.gitmodules +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/.ruff_cache/CACHEDIR.TAG +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/LICENSE +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/conda.recipe/meta.yaml +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/docs/Doxyfile.in +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/docs/images/logo/liburlparser-logo-1.svg +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/docs/images/logo/liburlparser-logo-2.svg +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/examples/common.h +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/include/urlparser.h +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/liburlparser/__main__.py +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/psl.cpp +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/psl.h +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/url.cpp +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/url.h +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/urlparser_host.cpp +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/src/urlparser_url.cpp +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/cpp/common.h +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/cpp/test_host.cpp +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/cpp/test_url.cpp +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/data/host_data.csv +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/data/url_data.csv +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/python/test_host.py +0 -0
- {liburlparser-1.4.6 → liburlparser-1.5.0}/tests/python/test_url.py +0 -0
|
@@ -25,8 +25,12 @@ jobs:
|
|
|
25
25
|
with:
|
|
26
26
|
submodules: false
|
|
27
27
|
|
|
28
|
+
- uses: actions/setup-python@v4
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.x"
|
|
31
|
+
|
|
28
32
|
- name: Ruff Check
|
|
29
|
-
|
|
33
|
+
run: pipx run ruff check .
|
|
30
34
|
|
|
31
35
|
- name: Build SDist
|
|
32
36
|
run: pipx run build --sdist
|
|
@@ -43,7 +47,7 @@ jobs:
|
|
|
43
47
|
name: Wheels on ${{ matrix.os }}
|
|
44
48
|
runs-on: ${{ matrix.os }}
|
|
45
49
|
strategy:
|
|
46
|
-
fail-fast:
|
|
50
|
+
fail-fast: true
|
|
47
51
|
matrix:
|
|
48
52
|
os: [ubuntu-latest, windows-latest]
|
|
49
53
|
|
|
@@ -77,10 +81,6 @@ jobs:
|
|
|
77
81
|
if: startsWith(github.ref, 'refs/tags/')
|
|
78
82
|
|
|
79
83
|
steps:
|
|
80
|
-
- uses: actions/setup-python@v4
|
|
81
|
-
with:
|
|
82
|
-
python-version: "3.x"
|
|
83
|
-
|
|
84
84
|
- uses: actions/download-artifact@v3
|
|
85
85
|
with:
|
|
86
86
|
name: artifact
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.19)
|
|
2
|
+
|
|
3
|
+
option(BUILD_PYTHON "export python module" off)
|
|
4
|
+
|
|
5
|
+
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ version selection")
|
|
6
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
7
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
|
11
|
+
include(PyProject)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if(NOT CMAKE_BUILD_TYPE)
|
|
15
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
|
|
21
|
+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "" FORCE)
|
|
22
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE)
|
|
23
|
+
|
|
24
|
+
project(${PyProject_NAME} LANGUAGES CXX VERSION ${PyProject_VERSION})
|
|
25
|
+
message(STATUS "Project: ${PROJECT_NAME}@v${PROJECT_VERSION}")
|
|
26
|
+
|
|
27
|
+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
|
28
|
+
|
|
29
|
+
if(DEFINED SKBUILD)
|
|
30
|
+
set(PYTHON_PROJECT_NAME "${SKBUILD_PROJECT_NAME}")
|
|
31
|
+
elseif(BUILD_PYTHON)
|
|
32
|
+
set(PYTHON_PROJECT_NAME "${CMAKE_BINARY_DIR}")
|
|
33
|
+
|
|
34
|
+
if(NOT PYTHON_REQUIREMENT_INSTALLED)
|
|
35
|
+
execute_process(
|
|
36
|
+
COMMAND "${Python3_EXECUTABLE}" -m pip install
|
|
37
|
+
nanobind ninja pytest-xdist pip-tools # build requirements
|
|
38
|
+
OUTPUT_QUIET COMMAND_ERROR_IS_FATAL ANY
|
|
39
|
+
)
|
|
40
|
+
execute_process(
|
|
41
|
+
COMMAND "${Python3_EXECUTABLE}" -m piptools compile --output-file ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt pyproject.toml
|
|
42
|
+
--no-emit-options --quiet --no-strip-extras --extra test
|
|
43
|
+
OUTPUT_QUIET COMMAND_ERROR_IS_FATAL ANY
|
|
44
|
+
)
|
|
45
|
+
execute_process(
|
|
46
|
+
COMMAND "${Python3_EXECUTABLE}" -m pip install -r ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt
|
|
47
|
+
OUTPUT_QUIET COMMAND_ERROR_IS_FATAL ANY
|
|
48
|
+
)
|
|
49
|
+
set(PYTHON_REQUIREMENT_INSTALLED TRUE CACHE INTERNAL "Python requirements installed")
|
|
50
|
+
endif()
|
|
51
|
+
|
|
52
|
+
execute_process(
|
|
53
|
+
COMMAND "${Python3_EXECUTABLE}" -m nanobind --cmake_dir
|
|
54
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR)
|
|
55
|
+
|
|
56
|
+
message(STATUS "Found NanoBind at ${NB_DIR}")
|
|
57
|
+
list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
|
|
58
|
+
endif()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# Download the public suffix list file from the internet
|
|
63
|
+
set(PUBLIC_SUFFIX_LIST_URL "https://publicsuffix.org/list/public_suffix_list.dat")
|
|
64
|
+
set(PUBLIC_SUFFIX_LIST_DAT "public_suffix_list.dat")
|
|
65
|
+
if(NOT DEFINED SKBUILD)
|
|
66
|
+
set(PUBLIC_SUFFIX_LIST_DAT "${CMAKE_CURRENT_BINARY_DIR}/${PUBLIC_SUFFIX_LIST_DAT}")
|
|
67
|
+
endif()
|
|
68
|
+
|
|
69
|
+
# Download the public suffix list file from the internet if not already exists
|
|
70
|
+
if(EXISTS "${PUBLIC_SUFFIX_LIST_DAT}")
|
|
71
|
+
message(STATUS "[DATA] ${PUBLIC_SUFFIX_LIST_DAT} is found.")
|
|
72
|
+
else()
|
|
73
|
+
message(WARNING "[DATA] ${PUBLIC_SUFFIX_LIST_DAT} is not found. Trying to download it.")
|
|
74
|
+
file(DOWNLOAD "${PUBLIC_SUFFIX_LIST_URL}" ${PUBLIC_SUFFIX_LIST_DAT})
|
|
75
|
+
if(EXISTS "${PUBLIC_SUFFIX_LIST_DAT}")
|
|
76
|
+
message(STATUS "[DATA] ${PUBLIC_SUFFIX_LIST_DAT} is downloaded.")
|
|
77
|
+
else()
|
|
78
|
+
message(FATAL_ERROR "[DATA] Failed to download ${PUBLIC_SUFFIX_LIST_DAT}.")
|
|
79
|
+
endif()
|
|
80
|
+
endif()
|
|
81
|
+
|
|
82
|
+
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if(DEFINED PYTHON_PROJECT_NAME)
|
|
86
|
+
# Try to import all Python components potentially needed by nanobind
|
|
87
|
+
#set(Python3_FIND_STRATEGY LOCATION)
|
|
88
|
+
find_package(Python 3.8
|
|
89
|
+
REQUIRED COMPONENTS Interpreter Development.Module
|
|
90
|
+
OPTIONAL_COMPONENTS Development.SABIModule)
|
|
91
|
+
# Import nanobind through CMake's find_package mechanism
|
|
92
|
+
find_package(nanobind CONFIG REQUIRED)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
set(NB_MODULE _about)
|
|
96
|
+
nanobind_add_module(${NB_MODULE} STABLE_ABI NB_STATIC ${PROJECT_SOURCE_DIR}/src/binding/about.cpp)
|
|
97
|
+
target_compile_definitions(${NB_MODULE} PRIVATE
|
|
98
|
+
VERSION_INFO=${PROJECT_VERSION}
|
|
99
|
+
NB_MODULE_NAME=${NB_MODULE})
|
|
100
|
+
|
|
101
|
+
file(GLOB PYTHON_BIND_MODULES_PATH ${PROJECT_SOURCE_DIR}/src/binding/bind_*)
|
|
102
|
+
set(PYTHON_BIND_MODULES "${NB_MODULE}")
|
|
103
|
+
foreach(NB_MODULE_PATH IN LISTS PYTHON_BIND_MODULES_PATH)
|
|
104
|
+
get_filename_component(NB_MODULE ${NB_MODULE_PATH} NAME)
|
|
105
|
+
string(REGEX REPLACE "bind(.*)" "\\1" NB_MODULE ${NB_MODULE})
|
|
106
|
+
list(APPEND PYTHON_BIND_MODULES ${NB_MODULE})
|
|
107
|
+
file(GLOB NB_MODULE_SOURCES ${NB_MODULE_PATH}/*.cpp)
|
|
108
|
+
|
|
109
|
+
message(STATUS "Found module: ${NB_MODULE}")
|
|
110
|
+
|
|
111
|
+
# Add more commands here to process each directory as needed
|
|
112
|
+
|
|
113
|
+
# We are now ready to compile the actual extension module
|
|
114
|
+
nanobind_add_module(
|
|
115
|
+
# Name of the extension
|
|
116
|
+
${NB_MODULE}
|
|
117
|
+
|
|
118
|
+
# Target the stable ABI for Python 3.12+, which reduces
|
|
119
|
+
# the number of binary wheels that must be built. This
|
|
120
|
+
# does nothing on older Python versions
|
|
121
|
+
STABLE_ABI
|
|
122
|
+
|
|
123
|
+
# Build libnanobind statically and merge it into the
|
|
124
|
+
# extension (which itself remains a shared library)
|
|
125
|
+
#
|
|
126
|
+
# If your project builds multiple extensions, you can
|
|
127
|
+
# replace this flag by NB_SHARED to conserve space by
|
|
128
|
+
# reusing a shared libnanobind across libraries
|
|
129
|
+
NB_STATIC
|
|
130
|
+
|
|
131
|
+
# Source code goes here
|
|
132
|
+
${NB_MODULE_SOURCES} ${SOURCES}
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
target_include_directories(${NB_MODULE} PRIVATE include src)
|
|
136
|
+
target_compile_definitions(${NB_MODULE} PRIVATE NB_MODULE_NAME=${NB_MODULE})
|
|
137
|
+
target_compile_definitions(${NB_MODULE} PRIVATE
|
|
138
|
+
DONT_INIT_PSL
|
|
139
|
+
PUBLIC_SUFFIX_LIST_URL="${PUBLIC_SUFFIX_LIST_URL}"
|
|
140
|
+
PUBLIC_SUFFIX_LIST_DAT="${PUBLIC_SUFFIX_LIST_DAT}"
|
|
141
|
+
)
|
|
142
|
+
endforeach()
|
|
143
|
+
|
|
144
|
+
if(DEFINED SKBUILD)
|
|
145
|
+
install(TARGETS ${PYTHON_BIND_MODULES}
|
|
146
|
+
CONFIGURATIONS Release
|
|
147
|
+
LIBRARY DESTINATION
|
|
148
|
+
${PYTHON_PROJECT_NAME})
|
|
149
|
+
install (FILES ${PUBLIC_SUFFIX_LIST_DAT}
|
|
150
|
+
DESTINATION ${SKBUILD_PROJECT_NAME})
|
|
151
|
+
else()
|
|
152
|
+
file(COPY ${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME} DESTINATION ${PYTHON_PROJECT_NAME})
|
|
153
|
+
file(COPY ${PUBLIC_SUFFIX_LIST_DAT} DESTINATION ${PYTHON_PROJECT_NAME}/${PROJECT_NAME} )
|
|
154
|
+
|
|
155
|
+
foreach(_core IN LISTS PYTHON_BIND_MODULES)
|
|
156
|
+
set_target_properties(${_core} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PROJECT_NAME}/${PROJECT_NAME})
|
|
157
|
+
endforeach()
|
|
158
|
+
endif()
|
|
159
|
+
endif()
|
|
160
|
+
|
|
161
|
+
if(DEFINED SKBUILD)
|
|
162
|
+
RETURN()
|
|
163
|
+
endif()
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
add_library(urlparser SHARED ${SOURCES})
|
|
168
|
+
add_library(url::base ALIAS urlparser)
|
|
169
|
+
target_compile_definitions(urlparser PRIVATE
|
|
170
|
+
PUBLIC_SUFFIX_LIST_DAT="${PUBLIC_SUFFIX_LIST_DAT}"
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
target_include_directories(urlparser
|
|
174
|
+
PUBLIC
|
|
175
|
+
${PROJECT_SOURCE_DIR}/include
|
|
176
|
+
PRIVATE
|
|
177
|
+
${PROJECT_SOURCE_DIR}/src)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
add_executable(example examples/main.cpp)
|
|
181
|
+
target_link_libraries(example PRIVATE url::base)
|
|
182
|
+
|
|
183
|
+
install(TARGETS urlparser
|
|
184
|
+
LIBRARY DESTINATION lib
|
|
185
|
+
ARCHIVE DESTINATION lib
|
|
186
|
+
INCLUDES DESTINATION include
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
enable_testing()
|
|
192
|
+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest)
|
|
193
|
+
file(GLOB TEST_SOURCES ${PROJECT_SOURCE_DIR}/tests/cpp/*.cpp)
|
|
194
|
+
|
|
195
|
+
add_executable(test_liburlparser ${TEST_SOURCES})
|
|
196
|
+
target_link_libraries(test_liburlparser PRIVATE url::base gtest gtest_main pthread)
|
|
197
|
+
target_include_directories(test_liburlparser PRIVATE ${PROJECT_SOURCE_DIR}/tests/cpp)
|
|
198
|
+
add_test(NAME unitTests COMMAND test_liburlparser)
|
|
199
|
+
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V DEPENDS test_liburlparser)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
if(BUILD_PYTHON)
|
|
203
|
+
add_test(NAME pythonTests
|
|
204
|
+
COMMAND ${Python3_EXECUTABLE} -m pytest -n auto ${PROJECT_SOURCE_DIR}/tests/python
|
|
205
|
+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
206
|
+
)
|
|
207
|
+
endif()
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
# Find Doxygen package
|
|
212
|
+
find_package(Doxygen)
|
|
213
|
+
message(STATUS "Doxygen_FOUND : ${Doxygen_FOUND}")
|
|
214
|
+
# Find Doxygen package
|
|
215
|
+
if (Doxygen_FOUND)
|
|
216
|
+
# Configure Doxyfile.in template
|
|
217
|
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
|
218
|
+
|
|
219
|
+
# Add target to generate documentation
|
|
220
|
+
add_custom_target(docs
|
|
221
|
+
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
|
222
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
223
|
+
COMMENT "Generating Doxygen documentation"
|
|
224
|
+
VERBATIM
|
|
225
|
+
)
|
|
226
|
+
endif ()
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: liburlparser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Fastest Url parser in the world
|
|
5
5
|
Author-Email: Mohammad Raziei <mohammadraziei1375@gmail.com>
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -18,7 +18,7 @@ Project-URL: Bug tracker, https://github.com/mohammadraziei/liburlparser/issues
|
|
|
18
18
|
Project-URL: Document, https://mohammadraziei.github.io/liburlparser/latest
|
|
19
19
|
Requires-Python: >=3.8
|
|
20
20
|
Requires-Dist: filelock
|
|
21
|
-
Requires-Dist: pytest; extra == "test"
|
|
21
|
+
Requires-Dist: pytest-xdist; extra == "test"
|
|
22
22
|
Requires-Dist: requests; extra == "test"
|
|
23
23
|
Requires-Dist: requests; extra == "online"
|
|
24
24
|
Provides-Extra: test
|
|
@@ -202,7 +202,7 @@ Host.extract_from_url("https://ee.aut.ac.ir/about") # from url
|
|
|
202
202
|
there is some examples in [examples](https://github.com/MohammadRaziei/liburlparser/tree/master/examples) folder
|
|
203
203
|
|
|
204
204
|
```c++
|
|
205
|
-
#include "
|
|
205
|
+
#include "urlparser.h"
|
|
206
206
|
...
|
|
207
207
|
/// for parsing url
|
|
208
208
|
TLD::Url url("https://ee.aut.ac.ir/about");
|
|
@@ -302,6 +302,9 @@ The test was conducted on a file containing 1 million random urls (Mar. 13rd 202
|
|
|
302
302
|
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
303
303
|
|
|
304
304
|
|
|
305
|
+
## Stats
|
|
306
|
+
[](https://starchart.cc/mohammadraziei/liburlparser)
|
|
307
|
+
|
|
305
308
|
## Contact
|
|
306
309
|
|
|
307
310
|
<!-- Gal Ben David - gal@intsights.com -->
|
|
@@ -175,7 +175,7 @@ Host.extract_from_url("https://ee.aut.ac.ir/about") # from url
|
|
|
175
175
|
there is some examples in [examples](https://github.com/MohammadRaziei/liburlparser/tree/master/examples) folder
|
|
176
176
|
|
|
177
177
|
```c++
|
|
178
|
-
#include "
|
|
178
|
+
#include "urlparser.h"
|
|
179
179
|
...
|
|
180
180
|
/// for parsing url
|
|
181
181
|
TLD::Url url("https://ee.aut.ac.ir/about");
|
|
@@ -275,6 +275,9 @@ The test was conducted on a file containing 1 million random urls (Mar. 13rd 202
|
|
|
275
275
|
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
276
276
|
|
|
277
277
|
|
|
278
|
+
## Stats
|
|
279
|
+
[](https://starchart.cc/mohammadraziei/liburlparser)
|
|
280
|
+
|
|
278
281
|
## Contact
|
|
279
282
|
|
|
280
283
|
<!-- Gal Ben David - gal@intsights.com -->
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ build-backend = "scikit_build_core.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "liburlparser"
|
|
9
|
-
version = "1.
|
|
9
|
+
version = "1.5.0"
|
|
10
10
|
description = "Fastest Url parser in the world"
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
authors = [
|
|
@@ -30,7 +30,7 @@ dependencies = [
|
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
[project.optional-dependencies]
|
|
33
|
-
test = ["pytest", "requests"]
|
|
33
|
+
test = ["pytest-xdist", "requests"]
|
|
34
34
|
online = ["requests"]
|
|
35
35
|
|
|
36
36
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by mohammad on 10/17/24.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include <nanobind/nanobind.h>
|
|
6
|
+
|
|
7
|
+
#include <string>
|
|
8
|
+
|
|
9
|
+
#define STRINGIFY(x) #x
|
|
10
|
+
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
NB_MODULE(NB_MODULE_NAME, m) {
|
|
14
|
+
#ifdef VERSION_INFO
|
|
15
|
+
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
|
|
16
|
+
#else
|
|
17
|
+
m.attr("__version__") = "dev";
|
|
18
|
+
#endif
|
|
19
|
+
}
|
|
@@ -76,7 +76,7 @@ inline nb::dict extract(const std::string& host){
|
|
|
76
76
|
return host_to_dict_minimal(TLD::Host(host));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
NB_MODULE(
|
|
79
|
+
NB_MODULE(NB_MODULE_NAME, m) {
|
|
80
80
|
m.doc() = R"pbdoc(
|
|
81
81
|
nanobind example plugin
|
|
82
82
|
-----------------------
|
|
@@ -150,9 +150,5 @@ NB_MODULE(_core, m) {
|
|
|
150
150
|
return std::string("<PSL : ") + (p.isLoaded() ? "loaded" : "not loaded") + ">";
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
|
|
155
|
-
#else
|
|
156
|
-
m.attr("__version__") = "dev";
|
|
157
|
-
#endif
|
|
153
|
+
|
|
158
154
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*
|
|
Binary file
|
|
Binary file
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.12)
|
|
2
|
-
|
|
3
|
-
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ version selection")
|
|
4
|
-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
5
|
-
|
|
6
|
-
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
|
|
10
|
-
include(PyProject)
|
|
11
|
-
message(STATUS "Project: ${PyProject_NAME}@v${PyProject_VERSION}")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if(NOT CMAKE_BUILD_TYPE)
|
|
15
|
-
set(CMAKE_BUILD_TYPE Release)
|
|
16
|
-
endif()
|
|
17
|
-
|
|
18
|
-
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
|
19
|
-
|
|
20
|
-
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
#if(MSVC)
|
|
24
|
-
# # Microsoft Visual Studio compiler
|
|
25
|
-
# set(MSVC_FLAGS "/O2")
|
|
26
|
-
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MSVC_FLAGS}")
|
|
27
|
-
#elseif(CMAKE_COMPILER_IS_GNUCXX)
|
|
28
|
-
# # GCC or Clang compiler
|
|
29
|
-
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
|
30
|
-
# if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
31
|
-
# # Linux
|
|
32
|
-
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
33
|
-
# else()
|
|
34
|
-
# # Other OS
|
|
35
|
-
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=generic")
|
|
36
|
-
# endif()
|
|
37
|
-
#endif()
|
|
38
|
-
|
|
39
|
-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
|
|
40
|
-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "" FORCE)
|
|
41
|
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE)
|
|
42
|
-
|
|
43
|
-
project(${PyProject_NAME} LANGUAGES CXX)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# Download the public suffix list file from the internet
|
|
47
|
-
set(PUBLIC_SUFFIX_LIST_URL "https://publicsuffix.org/list/public_suffix_list.dat")
|
|
48
|
-
set(PUBLIC_SUFFIX_LIST_DAT "public_suffix_list.dat")
|
|
49
|
-
if(NOT DEFINED SKBUILD)
|
|
50
|
-
set(PUBLIC_SUFFIX_LIST_DAT "${CMAKE_CURRENT_BINARY_DIR}/${PUBLIC_SUFFIX_LIST_DAT}")
|
|
51
|
-
endif()
|
|
52
|
-
|
|
53
|
-
# Download the public suffix list file from the internet if not already exists
|
|
54
|
-
if(EXISTS "${PUBLIC_SUFFIX_LIST_DAT}")
|
|
55
|
-
message(STATUS "[DATA] ${PUBLIC_SUFFIX_LIST_DAT} is found.")
|
|
56
|
-
else()
|
|
57
|
-
message(WARNING "[DATA] ${PUBLIC_SUFFIX_LIST_DAT} is not found. Trying to download it.")
|
|
58
|
-
file(DOWNLOAD "${PUBLIC_SUFFIX_LIST_URL}" ${PUBLIC_SUFFIX_LIST_DAT})
|
|
59
|
-
if(EXISTS "${PUBLIC_SUFFIX_LIST_DAT}")
|
|
60
|
-
message(STATUS "[DATA] ${PUBLIC_SUFFIX_LIST_DAT} is downloaded.")
|
|
61
|
-
else()
|
|
62
|
-
message(FATAL_ERROR "[DATA] Failed to download ${PUBLIC_SUFFIX_LIST_DAT}.")
|
|
63
|
-
endif()
|
|
64
|
-
endif()
|
|
65
|
-
|
|
66
|
-
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if(DEFINED SKBUILD)
|
|
70
|
-
# Try to import all Python components potentially needed by nanobind
|
|
71
|
-
find_package(Python 3.8
|
|
72
|
-
REQUIRED COMPONENTS Interpreter Development.Module
|
|
73
|
-
OPTIONAL_COMPONENTS Development.SABIModule)
|
|
74
|
-
|
|
75
|
-
# Import nanobind through CMake's find_package mechanism
|
|
76
|
-
find_package(nanobind CONFIG REQUIRED)
|
|
77
|
-
|
|
78
|
-
# We are now ready to compile the actual extension module
|
|
79
|
-
nanobind_add_module(
|
|
80
|
-
# Name of the extension
|
|
81
|
-
_core
|
|
82
|
-
|
|
83
|
-
# Target the stable ABI for Python 3.12+, which reduces
|
|
84
|
-
# the number of binary wheels that must be built. This
|
|
85
|
-
# does nothing on older Python versions
|
|
86
|
-
STABLE_ABI
|
|
87
|
-
|
|
88
|
-
# Build libnanobind statically and merge it into the
|
|
89
|
-
# extension (which itself remains a shared library)
|
|
90
|
-
#
|
|
91
|
-
# If your project builds multiple extensions, you can
|
|
92
|
-
# replace this flag by NB_SHARED to conserve space by
|
|
93
|
-
# reusing a shared libnanobind across libraries
|
|
94
|
-
NB_STATIC
|
|
95
|
-
|
|
96
|
-
# Source code goes here
|
|
97
|
-
src/binding/main.cpp
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
target_sources(_core PRIVATE ${SOURCES})
|
|
101
|
-
target_include_directories(_core PRIVATE include src)
|
|
102
|
-
target_compile_definitions(_core PRIVATE VERSION_INFO=${SKBUILD_PROJECT_VERSION})
|
|
103
|
-
target_compile_definitions(_core PRIVATE
|
|
104
|
-
DONT_INIT_PSL
|
|
105
|
-
PUBLIC_SUFFIX_LIST_URL="${PUBLIC_SUFFIX_LIST_URL}"
|
|
106
|
-
PUBLIC_SUFFIX_LIST_DAT="${PUBLIC_SUFFIX_LIST_DAT}"
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
install(TARGETS _core
|
|
110
|
-
CONFIGURATIONS Release
|
|
111
|
-
LIBRARY DESTINATION
|
|
112
|
-
${SKBUILD_PROJECT_NAME})
|
|
113
|
-
install (FILES ${PUBLIC_SUFFIX_LIST_DAT}
|
|
114
|
-
DESTINATION ${SKBUILD_PROJECT_NAME})
|
|
115
|
-
|
|
116
|
-
RETURN()
|
|
117
|
-
endif()
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
add_library(urlparser SHARED ${SOURCES})
|
|
121
|
-
add_library(url::base ALIAS urlparser)
|
|
122
|
-
target_compile_definitions(urlparser PRIVATE
|
|
123
|
-
PUBLIC_SUFFIX_LIST_DAT="${PUBLIC_SUFFIX_LIST_DAT}"
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
target_include_directories(urlparser
|
|
127
|
-
PUBLIC
|
|
128
|
-
${PROJECT_SOURCE_DIR}/include
|
|
129
|
-
PRIVATE
|
|
130
|
-
${PROJECT_SOURCE_DIR}/src)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
add_executable(example examples/main.cpp)
|
|
134
|
-
target_link_libraries(example PRIVATE url::base)
|
|
135
|
-
|
|
136
|
-
install(TARGETS urlparser
|
|
137
|
-
LIBRARY DESTINATION lib
|
|
138
|
-
ARCHIVE DESTINATION lib
|
|
139
|
-
INCLUDES DESTINATION include
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
enable_testing()
|
|
145
|
-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest)
|
|
146
|
-
file(GLOB TEST_SOURCES ${PROJECT_SOURCE_DIR}/tests/cpp/*.cpp)
|
|
147
|
-
|
|
148
|
-
add_executable(test_liburlparser ${TEST_SOURCES})
|
|
149
|
-
target_link_libraries(test_liburlparser PRIVATE url::base gtest gtest_main pthread)
|
|
150
|
-
target_include_directories(test_liburlparser PRIVATE ${PROJECT_SOURCE_DIR}/tests/cpp)
|
|
151
|
-
add_test(NAME unitTests COMMAND test_liburlparser)
|
|
152
|
-
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V DEPENDS test_liburlparser)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
# Find Doxygen package
|
|
157
|
-
find_package(Doxygen)
|
|
158
|
-
message(STATUS "Doxygen_FOUND : ${Doxygen_FOUND}")
|
|
159
|
-
# Find Doxygen package
|
|
160
|
-
if (Doxygen_FOUND)
|
|
161
|
-
# Configure Doxyfile.in template
|
|
162
|
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
|
163
|
-
|
|
164
|
-
# Add target to generate documentation
|
|
165
|
-
add_custom_target(docs
|
|
166
|
-
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
|
167
|
-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
168
|
-
COMMENT "Generating Doxygen documentation"
|
|
169
|
-
VERBATIM
|
|
170
|
-
)
|
|
171
|
-
endif ()
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|