Skip to content

Commit

Permalink
Fix building on the main branch (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbayles authored Jun 24, 2024
1 parent 8eb4133 commit f7eaf87
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 105 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -38,4 +38,5 @@ c_lib:
.PHONY: package
package: c_lib
python -m build --no-isolation
python ./update_sdist.py
twine check dist/*
40 changes: 39 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"},
]
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']
Expand All @@ -22,6 +55,11 @@ quote-style = "single"
select = ["E", "F"]
ignore = ["E501"]

[tool.coverage.run]
include = [
"ada_url/**",
]

[tool.cibuildwheel]
build = [
"cp38-*",
Expand Down
64 changes: 8 additions & 56 deletions requirements/development.txt
Original file line number Diff line number Diff line change
@@ -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
45 changes: 0 additions & 45 deletions setup.cfg

This file was deleted.

37 changes: 37 additions & 0 deletions update_sdist.py
Original file line number Diff line number Diff line change
@@ -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}')

0 comments on commit f7eaf87

Please sign in to comment.