diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index d476848..92fdb03 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -21,12 +21,12 @@ jobs: build_test: strategy: matrix: - os: ["ubuntu-20.04", "macos-11"] + os: ["ubuntu-latest", "macos-latest"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.8 uses: actions/setup-python@v4 with: diff --git a/Makefile b/Makefile index dc0ca1b..996ea1c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: requirements requirements: - python3 -m pip install -r requirements/development.txt ${req_args} + python -m pip install -U -r requirements/development.txt ${req_args} .PHONY: check check: @@ -38,4 +38,5 @@ c_lib: .PHONY: package package: c_lib python -m build --no-isolation + python ./update_sdist.py twine check dist/* diff --git a/pyproject.toml b/pyproject.toml index 24610b8..52943f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,40 @@ [build-system] -requires = ["cffi", "setuptools", "urllib3>=2.0.2", "wheel"] +requires = ["cffi", "setuptools", "urllib3", "wheel"] build-backend = "setuptools.build_meta" +[project] +name = "ada-url" +version = "1.14.0" +authors = [ + {name = "Bo Bayles", email = "bo@bbayles.com"}, +] +description = 'URL parser and manipulator based on the WHAT WG URL standard' +readme = "README.rst" +requires-python = ">=3.8" +license = {text = "Apache 2.0"} +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", +] +dependencies = [ + "cffi", +] + +[project.urls] +Homepage = "https://www.ada-url.com/" +Documentation = "https://ada-url.readthedocs.io" +Repository = "https://github.com/ada-url/ada-python" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.package-data] +ada_url = ["*.c", "*.h", "*.o"] + [tool.black] line-length = 88 target-version = ['py38'] @@ -22,6 +55,11 @@ quote-style = "single" select = ["E", "F"] ignore = ["E501"] +[tool.coverage.run] +include = [ + "ada_url/**", +] + [tool.cibuildwheel] build = [ "cp38-*", diff --git a/requirements/development.txt b/requirements/development.txt index a8ea3dc..662427b 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,58 +1,10 @@ -# What we want -build==1.2.1 -coverage==7.4.3 -ruff==0.3.7 -setuptools==69.5.1 -Sphinx==7.1.2 -twine==5.1.0 -wheel==0.43.0 - -# What we need -alabaster==0.7.13;python_version<"3.9" -alabaster==0.7.16;python_version>="3.9" -Babel==2.14.0 -backports.tarfile==1.0.0 -certifi==2024.2.2 -charset-normalizer==3.3.2 -docutils==0.20.1 -idna==3.7 -imagesize==1.4.1 -importlib_metadata==7.1.0 -importlib_resources==6.4.0 -jaraco.classes==3.4.0 -jaraco.context==5.3.0 -jaraco.functools==4.0.1 -Jinja2==3.1.3 -keyring==25.2.0 -markdown-it-py==3.0.0 -MarkupSafe==2.1.5 -mdurl==0.1.2 -more-itertools==10.2.0 -nh3==0.2.17 -packaging==24.0 -pkginfo==1.11.0 -Pygments==2.17.2 -pyproject_hooks==1.0.0 -pytz==2024.1 -readme_renderer==43.0 -requests==2.31.0 -requests-toolbelt==1.0.0 -rfc3986==2.0.0 -rich==13.7.1 -snowballstemmer==2.2.0 -sphinxcontrib-applehelp==1.0.4;python_version<"3.9" -sphinxcontrib-applehelp==1.0.8;python_version>="3.9" -sphinxcontrib-devhelp==1.0.2;python_version<"3.9" -sphinxcontrib-devhelp==1.0.6;python_version>="3.9" -sphinxcontrib-htmlhelp==2.0.1;python_version<"3.9" -sphinxcontrib-htmlhelp==2.0.5;python_version>="3.9" -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5;python_version<"3.9" -sphinxcontrib-serializinghtml==1.1.10;python_version>="3.9" -tomli==2.0.1 -typing_extensions==4.11.0 -urllib3==2.2.1 -zipp==3.18.1 +build +coverage +ruff +setuptools +Sphinx +twine +urllib3 +wheel -r base.txt diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d46d3b8..0000000 --- a/setup.cfg +++ /dev/null @@ -1,45 +0,0 @@ -[metadata] -name = ada-url -version = 1.14.0 -description = 'URL parser and manipulator based on the WHAT WG URL standard' -long_description = file: README.rst -long_description_content_type = text/x-rst -author = Bo Bayles -author_email = bo@bbayles.com -license = Apache 2.0 -license_files = - LICENSE -classifiers = - License :: OSI Approved :: Apache Software License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only -project_urls = - homepage = https://github.com/ada-url/ada-python - -[options] -packages = find: -python_requires = >=3.8 -include_package_data = True -install_requires = - cffi - -[options.packages.find] -exclude = - tests - -[options.package_data] -ada_url = - *.c - *.cpp - *.o - *.so - *.h - py.typed - -[coverage:run] -include = - ada_url/** - -[coverage:report] -exclude_lines = - if __name__ == .__main__.: diff --git a/update_sdist.py b/update_sdist.py new file mode 100644 index 0000000..86ac6b5 --- /dev/null +++ b/update_sdist.py @@ -0,0 +1,37 @@ +""" +update_sdist.py + +Run this script to remove compiled artifacts from source distribution tarballs. +""" +from pathlib import Path +from tarfile import open as tar_open +from tempfile import TemporaryDirectory + +REMOVE_FILES = frozenset(['ada_url/ada.o']) + + +def update_archive(file_path, removals): + with TemporaryDirectory() as temp_dir: + with tar_open(file_path, mode='r:gz') as tf: + tf.extractall(temp_dir) + + dir_path = next(Path(temp_dir).glob('ada_url-*')) + all_files = [] + for file_path in Path(temp_dir).glob('**/*'): + if file_path.is_dir(): + continue + if str(file_path.relative_to(dir_path)) in REMOVE_FILES: + continue + all_files.append(file_path) + + with tar_open(file_path, mode='w:gz') as tf: + for file_path in all_files: + arcname = file_path.relative_to(temp_dir) + print(arcname) + tf.add(file_path, arcname=arcname) + + +if __name__ == '__main__': + for file_path in Path().glob('dist/*.tar.gz'): + update_archive(file_path, REMOVE_FILES) + print(f'Updated {file_path}')