diff --git a/ada_url/__init__.py b/ada_url/__init__.py index 1ae6cef..ea161f7 100644 --- a/ada_url/__init__.py +++ b/ada_url/__init__.py @@ -3,6 +3,7 @@ HostType, SchemeType, URLSearchParams, + get_version, check_url, idna, idna_to_ascii, @@ -21,6 +22,7 @@ 'URL', 'URLSearchParams', 'check_url', + 'get_version', 'idna', 'idna_to_ascii', 'idna_to_unicode', diff --git a/ada_url/ada_adapter.py b/ada_url/ada_adapter.py index 0139bcc..3aeaa19 100644 --- a/ada_url/ada_adapter.py +++ b/ada_url/ada_adapter.py @@ -754,3 +754,6 @@ def encode(s: Union[str, bytes]) -> bytes: idna_to_unicode = idna.decode idna_to_ascii = idna.encode + +def get_version(): + return ffi.string(lib.ada_get_version()).decode() diff --git a/pyproject.toml b/pyproject.toml index 803525b..b9e4fad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,8 @@ authors = [ description = 'URL parser and manipulator based on the WHAT WG URL standard' readme = "README.rst" requires-python = ">=3.10" -license = {text = "Apache 2.0"} +license = "Apache-2.0" classifiers = [ - "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", ] diff --git a/requirements/development.txt b/requirements/development.txt index 662427b..ab7fd35 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,7 +1,8 @@ build coverage ruff -setuptools +setuptools>=77.0.0 +packaging>=24.2 Sphinx twine urllib3 diff --git a/tests/test_ada_url.py b/tests/test_ada_url.py index ecfa166..d269b31 100644 --- a/tests/test_ada_url.py +++ b/tests/test_ada_url.py @@ -9,6 +9,7 @@ URLSearchParams as SearchParams, URL, check_url, + get_version, idna, idna_to_ascii, idna_to_unicode, @@ -548,3 +549,12 @@ def test_url_suite(self): else: urlobj = URL(s, base=base) self.assertEqual(urlobj.href, item['href']) + + +class GetVersionTests(TestCase): + def test_get_version(self): + value = get_version() + version_parts = value.split('.') + self.assertEqual(len(version_parts), 3) # Three parts + int(version_parts[0]) # Major should be an integer + int(version_parts[1]) # Minor should be an integer