Skip to content

Commit 6343131

Browse files
bbaylesanonrig
authored andcommitted
Rename from what-url to ada-url
1 parent e5e03fb commit 6343131

File tree

14 files changed

+48
-50
lines changed

14 files changed

+48
-50
lines changed

.github/workflows/build_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
if: "matrix.os == 'ubuntu-20.04'"
3636
run: |
3737
pip install -U auditwheel patchelf
38-
auditwheel repair --plat manylinux_2_31_x86_64 --wheel-dir dist dist/what_url-*linux*.whl
38+
auditwheel repair --plat manylinux_2_31_x86_64 --wheel-dir dist dist/ada_url-*linux*.whl
3939
- name: Run tests
4040
run: |
4141
pip install -e .
@@ -47,5 +47,5 @@ jobs:
4747
- name: Upload packages
4848
uses: actions/upload-artifact@v3
4949
with:
50-
name: what-url-packages
50+
name: ada-url-packages
5151
path: dist/*

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ docs:
2828
clean:
2929
rm -rf _build/
3030
rm -rf _dist/
31-
rm -rf what_url.egg-info/
32-
rm -f what_url/_ada_wrapper.abi3.so
33-
rm -f what_url/ada.o
31+
rm -rf ada_url.egg-info/
32+
rm -f ada_url/_ada_wrapper.abi3.so
33+
rm -f ada_url/ada.o
3434

3535
.PHONY: package
3636
package:
37-
c++ -c "what_url/ada.cpp" -fPIC -std="c++17" -O2 -o "what_url/ada.o"
37+
c++ -c "ada_url/ada.cpp" -fPIC -std="c++17" -O2 -o "ada_url/ada.o"
3838
python -m build --no-isolation
3939
twine check dist/*

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
what-url
1+
ada-url
22
========
33

4-
This is ``what_url``, a Python library for parsing and joining URLs.
4+
This is ``ada_url``, a Python library for parsing and joining URLs.
55

66
Examples
77
--------
88

99
.. code-block:: python
1010
11-
>>> import what_url
12-
>>> what_url.check_url('https://example.org')
11+
>>> import ada_url
12+
>>> ada_url.check_url('https://example.org')
1313
True
14-
>>> what_url.join_url(
14+
>>> ada_url.join_url(
1515
'https://example.org/dir/child.txt', '../parent.txt'
1616
)
1717
'https://example.org/parent.txt'
18-
>>> what_url.normalize_url('https://example.org/dir/../parent.txt')
18+
>>> ada_url.normalize_url('https://example.org/dir/../parent.txt')
1919
'https://example.org/parent.txt'
20-
>>> what_url.parse_url('https://user:pass@example.org:80/api?q=1#2')
20+
>>> ada_url.parse_url('https://user:pass@example.org:80/api?q=1#2')
2121
{
2222
'href': 'https://user:pass@example.org:80/api?q=1#2',
2323
'username': 'user',

what_url/__init__.py renamed to ada_url/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from what_url.ada_adapter import (
1+
from ada_url.ada_adapter import (
22
check_url,
33
join_url,
44
normalize_url,
File renamed without changes.
File renamed without changes.

what_url/ada_adapter.py renamed to ada_url/ada_adapter.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from what_url._ada_wrapper import ffi, lib
1+
from ada_url._ada_wrapper import ffi, lib
22

33
URL_ATTRIBUTES = (
44
'href',
@@ -26,7 +26,7 @@ def check_url(s):
2626
2727
.. code-block:: python
2828
29-
>>> from what_url import check_url
29+
>>> from ada_url import check_url
3030
>>> check_url('bogus')
3131
False
3232
>>> check_url('http://a/b/c/d;p?q')
@@ -38,11 +38,11 @@ def check_url(s):
3838
except Exception:
3939
return False
4040

41-
ada_url = lib.ada_parse(s_bytes, len(s_bytes))
41+
urlobj = lib.ada_parse(s_bytes, len(s_bytes))
4242
try:
43-
return lib.ada_is_valid(ada_url)
43+
return lib.ada_is_valid(urlobj)
4444
finally:
45-
lib.ada_free(ada_url)
45+
lib.ada_free(urlobj)
4646

4747

4848
def join_url(base_url, s):
@@ -52,7 +52,7 @@ def join_url(base_url, s):
5252
5353
.. code-block:: python
5454
55-
>>> from what_url import join_url
55+
>>> from ada_url import join_url
5656
>>> base_url = 'http://a/b/c/d;p?q'
5757
>>> join_url(base_url, '../g')
5858
'http://a/b/g'
@@ -64,16 +64,14 @@ def join_url(base_url, s):
6464
except Exception:
6565
raise ValueError('Invalid URL') from None
6666

67-
ada_url = lib.ada_parse_with_base(
68-
s_bytes, len(s_bytes), base_bytes, len(base_bytes)
69-
)
67+
urlobj = lib.ada_parse_with_base(s_bytes, len(s_bytes), base_bytes, len(base_bytes))
7068
try:
71-
if not lib.ada_is_valid(ada_url):
69+
if not lib.ada_is_valid(urlobj):
7270
raise ValueError('Invalid URL') from None
7371

74-
return _get_str(lib.ada_get_href(ada_url))
72+
return _get_str(lib.ada_get_href(urlobj))
7573
finally:
76-
lib.ada_free(ada_url)
74+
lib.ada_free(urlobj)
7775

7876

7977
def normalize_url(s):
@@ -82,7 +80,7 @@ def normalize_url(s):
8280
8381
.. code-block:: python
8482
85-
>>> from what_url import normalize_url
83+
>>> from ada_url import normalize_url
8684
>>> normalize_url('http://a/b/c/../g')
8785
'http://a/b/g'
8886
@@ -96,7 +94,7 @@ def parse_url(s, attributes=PARSE_ATTRIBUTES):
9694
9795
.. code-block:: python
9896
99-
>>> from what_url import parse_url
97+
>>> from ada_url import parse_url
10098
>>> url = 'https://user_1:password_1@example.org:8080/dir/../api?q=1#frag'
10199
>>> parse_url(url)
102100
{
@@ -120,7 +118,7 @@ def parse_url(s, attributes=PARSE_ATTRIBUTES):
120118
121119
.. code-block:: python
122120
123-
>>> from what_url import parse_url
121+
>>> from ada_url import parse_url
124122
>>> url = 'https://user_1:password_1@example.org:8080/dir/../api?q=1#frag'
125123
>>> parse_url(url, attributes=('protocol'))
126124
{'protocol': 'https:'}
@@ -134,19 +132,19 @@ def parse_url(s, attributes=PARSE_ATTRIBUTES):
134132
raise ValueError('Invalid URL') from None
135133

136134
ret = {}
137-
ada_url = lib.ada_parse(s_bytes, len(s_bytes))
135+
urlobj = lib.ada_parse(s_bytes, len(s_bytes))
138136
try:
139-
if not lib.ada_is_valid(ada_url):
137+
if not lib.ada_is_valid(urlobj):
140138
raise ValueError('Invalid URL') from None
141139

142140
for attr in attributes:
143141
get_func = getattr(lib, f'ada_get_{attr}')
144-
data = get_func(ada_url)
142+
data = get_func(urlobj)
145143
ret[attr] = _get_str(data)
146144
if attr == 'origin':
147145
lib.ada_free_owned_string(data)
148146
finally:
149-
lib.ada_free(ada_url)
147+
lib.ada_free(urlobj)
150148

151149
return ret
152150

@@ -160,7 +158,7 @@ def replace_url(s, **kwargs):
160158
161159
.. code-block:: python
162160
163-
>>> from what_url import replace_url
161+
>>> from ada_url import replace_url
164162
>>> base_url = 'https://user_1:password_1@example.org/resource'
165163
>>> replace_url(base_url, username='user_2', protocol='http:')
166164
'http://user_2:password_1@example.org/resource'
@@ -174,9 +172,9 @@ def replace_url(s, **kwargs):
174172
except Exception:
175173
raise ValueError('Invalid URL') from None
176174

177-
ada_url = lib.ada_parse(s_bytes, len(s_bytes))
175+
urlobj = lib.ada_parse(s_bytes, len(s_bytes))
178176
try:
179-
if not lib.ada_is_valid(ada_url):
177+
if not lib.ada_is_valid(urlobj):
180178
raise ValueError('Invalid URL') from None
181179

182180
for attr in URL_ATTRIBUTES:
@@ -190,10 +188,10 @@ def replace_url(s, **kwargs):
190188
raise ValueError(f'Invalid value for {attr}') from None
191189

192190
set_func = getattr(lib, f'ada_set_{attr}')
193-
set_result = set_func(ada_url, value_bytes, len(value_bytes))
191+
set_result = set_func(urlobj, value_bytes, len(value_bytes))
194192
if (set_result is not None) and (not set_result):
195193
raise ValueError(f'Invalid value for {attr}') from None
196194

197-
return _get_str(lib.ada_get_href(ada_url))
195+
return _get_str(lib.ada_get_href(urlobj))
198196
finally:
199-
lib.ada_free(ada_url)
197+
lib.ada_free(urlobj)

what_url/ada_build.py renamed to ada_url/ada_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
ffi_builder = FFI()
1010
ffi_builder.set_source(
11-
'what_url._ada_wrapper',
11+
'ada_url._ada_wrapper',
1212
'# include "ada_c.h"',
1313
include_dirs=[file_dir],
1414
libraries=libraries,
File renamed without changes.

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
readme_dst = os.path.join(build_dir, 'README.pprst')
1515
shutil.copyfile(readme_src, readme_dst)
1616

17-
project = 'bbayles/what-url'
18-
copyright = '2023, Bo Bayles'
19-
author = 'Bo Bayles'
17+
project = 'ada-url/python'
18+
copyright = '2023, Ada authors'
19+
author = 'Ada authors'
2020

2121
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
2222
autodoc_member_order = 'bysource'

0 commit comments

Comments
 (0)