Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .flake8

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: [ "macos-latest" ]

exclude:
include:
# Don't need to run x86 tests on every Python version
- python-version: "3.13"
runs-on: "macos-13"
runs-on: "macos-15-intel"

steps:
- name: Checkout
Expand Down
23 changes: 5 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,18 @@ repos:
rev: v0.11.0.1
hooks:
- id: shellcheck
- repo: https://github.com/PyCQA/isort
rev: 7.0.0
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.0
hooks:
- id: pyupgrade
args: [--py39-plus]
# Docformatter 1.7.5 isn't compatible with Pre-commit 4.0
# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.5
# hooks:
# - id: docformatter
# args: [--in-place, --black]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.9.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.2
hooks:
- id: flake8
- id: ruff-format
- id: ruff-check
args: [ --fix ]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
Expand Down
27 changes: 18 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "mobile-forge"
version = "2024.0.0"
description = "A tool to manage building cross-platform binary wheels for mobile devices"
readme = { file = "README.md", content-type = "text/x-rst"}
requires-python = ">=3.9"
requires-python = ">=3.10"
license = { file = "LICENSE" }
authors = [
{name = "Russell Keith-Magee", email = "russell@keith-magee.com"}
Expand All @@ -20,10 +20,10 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development",
]
Expand Down Expand Up @@ -54,14 +54,23 @@ Tracker = "https://github.com/beeware/briefcase/issues"
forge = "forge.__main__:main"
forge-env = "forge.cross:main"

[tool.isort]
profile = "black"
skip_glob = [
"docs/conf.py",
"venv*",
"local",
[tool.ruff.lint]
# In addition to the default rules, these additional rules will be used:
extend-select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"YTT", # flake8-2020
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"I", # isort
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
# They may be worth occasionally turning on just to see if something could actually
# use improvement.
# "SIM", # flake8-simplify
]
multi_line_output = 3

[tool.codespell]
skip = '.git,*.pdf,*.svg'
Expand Down
4 changes: 2 additions & 2 deletions recipes/numpy/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def test_performance():
b = np.random.rand(SIZE, SIZE)
np.dot(a, b)

# With OpenBLAS, the test devices take at most 0.4 seconds. Without OpenBLAS, they take
# at least 1.0 seconds.
# With OpenBLAS, the test devices take at most 0.4 seconds.
# Without OpenBLAS, they take at least 1.0 seconds.
duration = time() - start_time
print(f"{duration:.3f}")
assert duration < 0.7
5 changes: 4 additions & 1 deletion recipes/pandas/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ def test_basic():
columns=["Letter", "Number"],
)
assert df.to_csv() == (
",Letter,Number\n" "0,alpha,1\n" "1,bravo,2\n" "2,charlie,3\n"
",Letter,Number\n",
"0,alpha,1\n",
"1,bravo,2\n",
"2,charlie,3\n",
)
3 changes: 2 additions & 1 deletion src/forge/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ def main() -> int:
# subsequent builds will be isolated by

first = True
# Packages that generate -py3-none-any wheels only need to be built on a single platform.
# Packages that generate -py3-none-any wheels only need to be built
# on a single platform.
if package_name_or_recipe in py_any_targets:
build_platforms = platforms[:1]
else:
Expand Down
14 changes: 10 additions & 4 deletions src/forge/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,13 @@ def compile_env(self, **kwargs) -> dict[str:str]:

cflags = self.cross_venv.sysconfig_data["CFLAGS"]

# Pre Python 3.11 versions included BZip2 and XZ includes in CFLAGS. Remove them.
# Pre Python 3.11 versions included BZip2 and XZ includes in CFLAGS.
# The should be removed.
cflags = re.sub(r"-I.*/merge/iOS/.*/bzip2-.*/include", "", cflags)
cflags = re.sub(r"-I.*/merge/iOS/.*/xs-.*/include", "", cflags)

# Replace any hard-coded reference to --sysroot=<sysroot> with the actual reference
# Replace any hard-coded reference to --sysroot=<sysroot>
# with the actual reference
cflags = re.sub(r"--sysroot=\w+", f"--sysroot={sdk_root}", cflags)

# Add the install root and SDK root includes
Expand All @@ -240,7 +242,8 @@ def compile_env(self, **kwargs) -> dict[str:str]:

ldflags = self.cross_venv.sysconfig_data["LDFLAGS"]

# Replace any hard-coded reference to -isysroot <sysroot> with the actual reference
# Replace any hard-coded reference to -isysroot <sysroot>
# with the actual reference
ldflags = re.sub(r"-isysroot \w+", f"-isysroot={sdk_root}", ldflags)

# Add the framework path
Expand Down Expand Up @@ -489,7 +492,10 @@ def log_file_path(self) -> Path:
return (
Path.cwd()
/ "logs"
/ f"{self.package.name}-{self.package.version}-cp3{sys.version_info.minor}-{self.cross_venv.tag}.log"
/ (
f"{self.package.name}-{self.package.version}-"
f"cp3{sys.version_info.minor}-{self.cross_venv.tag}.log"
)
)

def download_source_url(self):
Expand Down
24 changes: 16 additions & 8 deletions src/forge/cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ def create(
],
**self.cross_kwargs({}),
)
except subprocess.CalledProcessError:
raise RuntimeError(f"Unable to create cross platform environment {self}.")
except subprocess.CalledProcessError as e:
raise RuntimeError(
f"Unable to create cross platform environment {self}."
) from e

print("Verifying cross-platform environment...")
self.verify()
Expand Down Expand Up @@ -294,7 +296,8 @@ def verify(self):
).strip()
if output != self.platform_identifier:
raise RuntimeError(
f"Cross platform python should be {self.platform_identifier}; got {output}"
f"Cross platform python should be {self.platform_identifier}; "
f"got {output}"
)

# python is the same version as the local python
Expand All @@ -305,7 +308,8 @@ def verify(self):
).strip()
if python_version != local_python_version:
raise RuntimeError(
f"Cross platform python should be {local_python_version!r}; got {python_version!r}"
f"Cross platform python should be {local_python_version!r}; "
f"got {python_version!r}"
)

# build-python returns the build environment tag.
Expand All @@ -315,7 +319,8 @@ def verify(self):
).strip()
if output != sysconfig.get_platform():
raise RuntimeError(
f"Cross platform build-python should be {sysconfig.get_platform()}; got {output}"
f"Cross platform build-python should be {sysconfig.get_platform()}; "
f"got {output}"
)

# build-python is the same version as the local python
Expand All @@ -325,7 +330,8 @@ def verify(self):
).strip()
if build_python_version != local_python_version:
raise RuntimeError(
f"Cross platform build-python should be {local_python_version}; got {build_python_version}"
f"Cross platform build-python should be {local_python_version}; "
f"got {build_python_version}"
)

# cross-python returns the cross-platform host tag.
Expand All @@ -335,7 +341,8 @@ def verify(self):
).strip()
if output != self.platform_identifier:
raise RuntimeError(
f"Cross platform cross-python should be {self.platform_identifier}; got {output}"
f"Cross platform cross-python should be {self.platform_identifier}; "
f"got {output}"
)

# cross-python is the same version as the local python
Expand All @@ -345,7 +352,8 @@ def verify(self):
).strip()
if cross_python_version != local_python_version:
raise RuntimeError(
f"Cross platform python should be {local_python_version}; got {cross_python_version}"
f"Cross platform python should be {local_python_version}; "
f"got {cross_python_version}"
)

def cross_kwargs(self, kwargs):
Expand Down