itqan-cli 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/CHANGELOG.md +10 -0
  2. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/PKG-INFO +10 -1
  3. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/README.md +9 -0
  4. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/RELEASING.md +13 -0
  5. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/pyproject.toml +1 -1
  6. itqan_cli-0.1.1/scripts/homebrew_formula.py +91 -0
  7. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/browse.py +3 -1
  8. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_browse.py +24 -0
  9. itqan_cli-0.1.1/tests/test_homebrew_formula.py +63 -0
  10. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/.gitignore +0 -0
  11. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/LICENSE +0 -0
  12. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/__init__.py +0 -0
  13. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/__main__.py +0 -0
  14. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/client.py +0 -0
  15. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/credentials.py +0 -0
  16. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/downloader.py +0 -0
  17. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/exceptions.py +0 -0
  18. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/init_template.py +0 -0
  19. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/lockfile.py +0 -0
  20. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/main.py +0 -0
  21. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/manifest.py +0 -0
  22. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/src/itqan_cli/semver.py +0 -0
  23. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/__init__.py +0 -0
  24. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/conftest.py +0 -0
  25. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_access.py +0 -0
  26. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_assets_dir.py +0 -0
  27. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_cli_integration.py +0 -0
  28. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_client.py +0 -0
  29. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_downloader.py +0 -0
  30. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_entry_points.py +0 -0
  31. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_init.py +0 -0
  32. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_languages.py +0 -0
  33. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_lockfile.py +0 -0
  34. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_login.py +0 -0
  35. {itqan_cli-0.1.0 → itqan_cli-0.1.1}/tests/test_manifest.py +0 -0
@@ -1,3 +1,13 @@
1
+ ## v0.1.1 (2026-10-11)
2
+
3
+ ### Feat
4
+
5
+ - publish a Homebrew formula on each release
6
+
7
+ ### Fix
8
+
9
+ - **browse**: say when an asset has no published version yet
10
+
1
11
  ## v0.1.0 (2026-10-11)
2
12
 
3
13
  ### Feat
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: itqan-cli
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Itqan Quranic Asset Manager: install and pin Itqan Quranic assets in your project.
5
5
  Project-URL: Homepage, https://github.com/Itqan-community/itqan-cli
6
6
  Project-URL: Repository, https://github.com/Itqan-community/itqan-cli
@@ -50,6 +50,15 @@ pipx install itqan-cli # or: uv tool install itqan-cli
50
50
 
51
51
  This installs the `itqan` command; `itqan-cli` is the same command under the package's name.
52
52
 
53
+ ### Homebrew
54
+
55
+ On macOS (Apple Silicon or Intel) and Linux, without Python:
56
+
57
+ ```bash
58
+ brew install itqan-community/tap/itqan
59
+ brew upgrade itqan # later, to update
60
+ ```
61
+
53
62
  ### Without Python
54
63
 
55
64
  Each [GitHub Release](https://github.com/Itqan-community/itqan-cli/releases) has a standalone
@@ -19,6 +19,15 @@ pipx install itqan-cli # or: uv tool install itqan-cli
19
19
 
20
20
  This installs the `itqan` command; `itqan-cli` is the same command under the package's name.
21
21
 
22
+ ### Homebrew
23
+
24
+ On macOS (Apple Silicon or Intel) and Linux, without Python:
25
+
26
+ ```bash
27
+ brew install itqan-community/tap/itqan
28
+ brew upgrade itqan # later, to update
29
+ ```
30
+
22
31
  ### Without Python
23
32
 
24
33
  Each [GitHub Release](https://github.com/Itqan-community/itqan-cli/releases) has a standalone
@@ -51,3 +51,16 @@ itqan-cli` skips them unless asked for explicitly: `pipx install itqan-cli==0.2.
51
51
  - Environment: `pypi`
52
52
  - **GitHub:** create an environment named `pypi` under *Settings → Environments*. Adding required
53
53
  reviewers makes every release wait for a maintainer's approval.
54
+ - **Homebrew:** after a final (not pre-) release, the `homebrew` job regenerates
55
+ `Formula/itqan.rb` in [`Itqan-community/homebrew-tap`](https://github.com/Itqan-community/homebrew-tap)
56
+ with [`scripts/homebrew_formula.py`](scripts/homebrew_formula.py) and pushes it. It pushes with
57
+ an SSH deploy key, so no personal token is stored:
58
+
59
+ ```bash
60
+ ssh-keygen -t ed25519 -N "" -C "itqan-cli release" -f tap_key
61
+ gh repo deploy-key add tap_key.pub --repo Itqan-community/homebrew-tap --allow-write --title "itqan-cli release"
62
+ gh secret set HOMEBREW_TAP_DEPLOY_KEY --repo Itqan-community/itqan-cli < tap_key
63
+ rm tap_key tap_key.pub
64
+ ```
65
+
66
+ If the job fails, the release is still out on PyPI and GitHub; fix the cause and re-run the job.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "itqan-cli"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Itqan Quranic Asset Manager: install and pin Itqan Quranic assets in your project."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -0,0 +1,91 @@
1
+ """Print the Homebrew formula for a release, for the tap at Itqan-community/homebrew-tap.
2
+
3
+ python scripts/homebrew_formula.py 0.2.0 dist/SHA256SUMS > Formula/itqan.rb
4
+
5
+ The formula installs the standalone binaries from the GitHub Release (binaries.yml), so
6
+ Homebrew users don't need Python. release.yml runs this on every final release.
7
+ """
8
+
9
+ from pathlib import Path
10
+ import sys
11
+
12
+ REPO = "Itqan-community/itqan-cli"
13
+
14
+ # Homebrew (os, CPU) -> the binary's os-arch suffix.
15
+ PLATFORMS = {
16
+ ("macos", "arm"): "macos-arm64",
17
+ ("macos", "intel"): "macos-x86_64",
18
+ ("linux", "arm"): "linux-arm64",
19
+ ("linux", "intel"): "linux-x86_64",
20
+ }
21
+
22
+ TEMPLATE = """\
23
+ # Generated by https://github.com/{repo}/blob/main/scripts/homebrew_formula.py
24
+ # on each release. Don't edit by hand.
25
+ class Itqan < Formula
26
+ desc "Install and pin Itqan Quranic assets in your project"
27
+ homepage "https://github.com/{repo}"
28
+ version "{version}"
29
+ license "MIT"
30
+
31
+ on_macos do
32
+ on_arm do
33
+ {macos_arm}
34
+ end
35
+ on_intel do
36
+ {macos_intel}
37
+ end
38
+ end
39
+
40
+ on_linux do
41
+ on_arm do
42
+ {linux_arm}
43
+ end
44
+ on_intel do
45
+ {linux_intel}
46
+ end
47
+ end
48
+
49
+ def install
50
+ bin.install Dir["itqan-*"].first => "itqan"
51
+ end
52
+
53
+ test do
54
+ assert_equal "itqan, version #{{version}}", shell_output("#{{bin}}/itqan --version").strip
55
+ end
56
+ end
57
+ """
58
+
59
+
60
+ def parse_checksums(text: str) -> dict[str, str]:
61
+ """`sha256sum` output -> {file name: checksum}."""
62
+ checksums = {}
63
+ for line in text.splitlines():
64
+ if line.strip():
65
+ checksum, name = line.split(maxsplit=1)
66
+ checksums[name.lstrip("*")] = checksum
67
+ return checksums
68
+
69
+
70
+ def render(version: str, checksums: dict[str, str]) -> str:
71
+ blocks = {}
72
+ for (os, cpu), suffix in PLATFORMS.items():
73
+ name = f"itqan-{version}-{suffix}"
74
+ if name not in checksums:
75
+ raise ValueError(f"{name} is missing from SHA256SUMS")
76
+ url = f"https://github.com/{REPO}/releases/download/v{version}/{name}"
77
+ blocks[f"{os}_{cpu}"] = f' url "{url}"\n sha256 "{checksums[name]}"'
78
+ return TEMPLATE.format(repo=REPO, version=version, **blocks)
79
+
80
+
81
+ def main(argv: list[str]) -> int:
82
+ if len(argv) != 2:
83
+ print(__doc__, file=sys.stderr)
84
+ return 2
85
+ version, sums_path = argv
86
+ sys.stdout.write(render(version, parse_checksums(Path(sums_path).read_text())))
87
+ return 0
88
+
89
+
90
+ if __name__ == "__main__":
91
+ sys.exit(main(sys.argv[1:]))
@@ -191,7 +191,7 @@ def render_table(packages: list[CatalogPackage], targets: set[Target]) -> str:
191
191
  header = ("SLUG", "CATEGORY", "LANGUAGES", "LATEST", "ACCESS", "NAME")
192
192
  rows = [header] + [
193
193
  (
194
- ("* " if not missing_languages(targets, package) else "") + package.slug,
194
+ ("* " if package.languages and not missing_languages(targets, package) else "") + package.slug,
195
195
  package.category,
196
196
  _languages_text(package),
197
197
  _latest_text(package),
@@ -266,6 +266,8 @@ def choice_description(package: CatalogPackage, has_api_key: bool) -> str:
266
266
 
267
267
  def unavailable_reason(package: CatalogPackage, targets: set[Target], has_api_key: bool) -> str | None:
268
268
  """Why a package can't be picked, or None when it can."""
269
+ if not package.languages: # listed, but no language has an installable version yet
270
+ return "no published version"
269
271
  if not missing_languages(targets, package):
270
272
  return "in manifest"
271
273
  if not can_install(package, has_api_key):
@@ -161,6 +161,30 @@ def test_unavailable_reason_where_gated_without_api_key_should_need_key():
161
161
  assert with_key is None
162
162
 
163
163
 
164
+ def test_unavailable_reason_where_no_published_version_should_say_so():
165
+ # Arrange: listed by the registry, but no language has a version it can install yet.
166
+ package = _package({**SINGLE, "languages": []})
167
+
168
+ # Act
169
+ reason = browse.unavailable_reason(package, set(), has_api_key=True)
170
+
171
+ # Assert
172
+ assert reason == "no published version"
173
+
174
+
175
+ def test_render_table_where_no_published_version_should_not_mark_it_in_manifest():
176
+ # Arrange
177
+ package = _package({**SINGLE, "languages": []})
178
+
179
+ # Act
180
+ table = browse.render_table([package], set())
181
+
182
+ # Assert
183
+ row = table.splitlines()[1]
184
+ assert row.startswith("mushaf-madinah")
185
+ assert "* " not in row
186
+
187
+
164
188
  # --- editing the manifest -------------------------------------------------------
165
189
 
166
190
 
@@ -0,0 +1,63 @@
1
+ """Tests for scripts/homebrew_formula.py, which writes the tap's formula on each release."""
2
+
3
+ import importlib.util
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+
8
+ _SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "homebrew_formula.py"
9
+ _spec = importlib.util.spec_from_file_location("homebrew_formula", _SCRIPT)
10
+ homebrew_formula = importlib.util.module_from_spec(_spec)
11
+ _spec.loader.exec_module(homebrew_formula)
12
+
13
+ SUMS = """\
14
+ b6b1 itqan-0.2.0-linux-arm64
15
+ 60c4 itqan-0.2.0-linux-x86_64
16
+ bca1 itqan-0.2.0-macos-arm64
17
+ 7bd3 *itqan-0.2.0-macos-x86_64
18
+ f805 itqan-0.2.0-windows-x86_64.exe
19
+ 3dee itqan_cli-0.2.0-py3-none-any.whl
20
+ """
21
+
22
+
23
+ def test_render_where_all_binaries_listed_should_pin_each_platform_url_and_checksum():
24
+ # Arrange
25
+ checksums = homebrew_formula.parse_checksums(SUMS)
26
+
27
+ # Act
28
+ formula = homebrew_formula.render("0.2.0", checksums)
29
+
30
+ # Assert
31
+ base = "https://github.com/Itqan-community/itqan-cli/releases/download/v0.2.0"
32
+ assert 'version "0.2.0"' in formula
33
+ for name, checksum in [
34
+ ("macos-arm64", "bca1"),
35
+ ("macos-x86_64", "7bd3"),
36
+ ("linux-arm64", "b6b1"),
37
+ ("linux-x86_64", "60c4"),
38
+ ]:
39
+ assert f'url "{base}/itqan-0.2.0-{name}"\n sha256 "{checksum}"' in formula
40
+ assert "windows" not in formula
41
+ assert 'assert_equal "itqan, version #{version}", shell_output("#{bin}/itqan --version").strip' in formula
42
+
43
+
44
+ def test_render_where_binary_missing_should_refuse():
45
+ # Arrange
46
+ checksums = homebrew_formula.parse_checksums(SUMS.replace(" itqan-0.2.0-linux-arm64\n", " other\n"))
47
+
48
+ # Act / Assert
49
+ with pytest.raises(ValueError, match="itqan-0.2.0-linux-arm64"):
50
+ homebrew_formula.render("0.2.0", checksums)
51
+
52
+
53
+ def test_main_where_given_sums_file_should_print_formula(tmp_path: Path, capsys):
54
+ # Arrange
55
+ sums = tmp_path / "SHA256SUMS"
56
+ sums.write_text(SUMS)
57
+
58
+ # Act
59
+ code = homebrew_formula.main(["0.2.0", str(sums)])
60
+
61
+ # Assert
62
+ assert code == 0
63
+ assert capsys.readouterr().out.startswith("# Generated by")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes