phyx 1.7.0__tar.gz → 1.7.2__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 (106) hide show
  1. {phyx-1.7.0/phyx.egg-info → phyx-1.7.2}/PKG-INFO +2 -2
  2. {phyx-1.7.0 → phyx-1.7.2}/README.md +1 -1
  3. {phyx-1.7.0 → phyx-1.7.2}/docs/cookbook.md +1 -1
  4. {phyx-1.7.0 → phyx-1.7.2}/docs/guide.md +1 -1
  5. {phyx-1.7.0 → phyx-1.7.2}/docs/index.md +1 -1
  6. {phyx-1.7.0 → phyx-1.7.2}/docs/rationale.md +2 -2
  7. {phyx-1.7.0 → phyx-1.7.2}/docs/reference.md +1 -1
  8. {phyx-1.7.0 → phyx-1.7.2}/docs/releasing.md +32 -1
  9. {phyx-1.7.0 → phyx-1.7.2}/docs/roadmap.md +2 -4
  10. {phyx-1.7.0 → phyx-1.7.2}/docs/toolchain.md +22 -3
  11. phyx-1.7.2/editors/README.md +98 -0
  12. {phyx-1.7.0 → phyx-1.7.2}/editors/package.json +29 -1
  13. {phyx-1.7.0 → phyx-1.7.2}/phyx/cli.py +56 -27
  14. {phyx-1.7.0 → phyx-1.7.2}/phyx/compiler.py +74 -13
  15. phyx-1.7.2/phyx/fonts.py +304 -0
  16. {phyx-1.7.0 → phyx-1.7.2}/phyx/lint.py +10 -4
  17. {phyx-1.7.0 → phyx-1.7.2}/phyx/lsp.py +3 -2
  18. {phyx-1.7.0 → phyx-1.7.2}/phyx/parser.py +39 -7
  19. {phyx-1.7.0 → phyx-1.7.2}/phyx/repl.py +10 -10
  20. {phyx-1.7.0 → phyx-1.7.2/phyx.egg-info}/PKG-INFO +2 -2
  21. {phyx-1.7.0 → phyx-1.7.2}/phyx.egg-info/SOURCES.txt +2 -0
  22. {phyx-1.7.0 → phyx-1.7.2}/pyproject.toml +1 -1
  23. phyx-1.7.2/tests/test_fetch.py +340 -0
  24. {phyx-1.7.0 → phyx-1.7.2}/tests/test_host_faults.py +218 -30
  25. phyx-1.7.2/tests/test_lint_imported.py +203 -0
  26. {phyx-1.7.0 → phyx-1.7.2}/tests/test_parity_fuzz.py +369 -16
  27. {phyx-1.7.0 → phyx-1.7.2}/tests/test_repl.py +77 -0
  28. {phyx-1.7.0 → phyx-1.7.2}/tests/test_tools.py +285 -0
  29. phyx-1.7.0/editors/README.md +0 -83
  30. phyx-1.7.0/phyx/fonts.py +0 -134
  31. {phyx-1.7.0 → phyx-1.7.2}/LICENSE +0 -0
  32. {phyx-1.7.0 → phyx-1.7.2}/MANIFEST.in +0 -0
  33. {phyx-1.7.0 → phyx-1.7.2}/docs/python.md +0 -0
  34. {phyx-1.7.0 → phyx-1.7.2}/docs/spec.md +0 -0
  35. {phyx-1.7.0 → phyx-1.7.2}/docs/stdlib.md +0 -0
  36. {phyx-1.7.0 → phyx-1.7.2}/docs/tour.md +0 -0
  37. {phyx-1.7.0 → phyx-1.7.2}/editors/ftdetect/phyx.vim +0 -0
  38. {phyx-1.7.0 → phyx-1.7.2}/editors/language-configuration.json +0 -0
  39. {phyx-1.7.0 → phyx-1.7.2}/editors/phyx.tmLanguage.json +0 -0
  40. {phyx-1.7.0 → phyx-1.7.2}/editors/syntax/phyx.vim +0 -0
  41. {phyx-1.7.0 → phyx-1.7.2}/examples/01_welcome.phyx +0 -0
  42. {phyx-1.7.0 → phyx-1.7.2}/examples/02_compleation.phyx +0 -0
  43. {phyx-1.7.0 → phyx-1.7.2}/examples/03_abilities.phyx +0 -0
  44. {phyx-1.7.0 → phyx-1.7.2}/examples/04_herd.phyx +0 -0
  45. {phyx-1.7.0 → phyx-1.7.2}/examples/05_mistakes.phyx +0 -0
  46. {phyx-1.7.0 → phyx-1.7.2}/examples/06_ask.phyx +0 -0
  47. {phyx-1.7.0 → phyx-1.7.2}/examples/07_ascii.phyx +0 -0
  48. {phyx-1.7.0 → phyx-1.7.2}/examples/08_vertical.vphyx +0 -0
  49. {phyx-1.7.0 → phyx-1.7.2}/examples/09_sieve.phyx +0 -0
  50. {phyx-1.7.0 → phyx-1.7.2}/examples/10_command.phyx +0 -0
  51. {phyx-1.7.0 → phyx-1.7.2}/examples/11_machine.phyx +0 -0
  52. {phyx-1.7.0 → phyx-1.7.2}/examples/12_sort.phyx +0 -0
  53. {phyx-1.7.0 → phyx-1.7.2}/examples/13_notes.phyx +0 -0
  54. {phyx-1.7.0 → phyx-1.7.2}/examples/14_compleat.phyx +0 -0
  55. {phyx-1.7.0 → phyx-1.7.2}/examples/15_conjugation.phyx +0 -0
  56. {phyx-1.7.0 → phyx-1.7.2}/examples/lib_as/311/231r/316/270.phyx" +0 -0
  57. {phyx-1.7.0 → phyx-1.7.2}/examples/lib_/305/245ewn.phyx" +0 -0
  58. {phyx-1.7.0 → phyx-1.7.2}/phyx/__init__.py +0 -0
  59. {phyx-1.7.0 → phyx-1.7.2}/phyx/__main__.py +0 -0
  60. {phyx-1.7.0 → phyx-1.7.2}/phyx/ast.py +0 -0
  61. {phyx-1.7.0 → phyx-1.7.2}/phyx/builtins.py +0 -0
  62. {phyx-1.7.0 → phyx-1.7.2}/phyx/conjugation.py +0 -0
  63. {phyx-1.7.0 → phyx-1.7.2}/phyx/errors.py +0 -0
  64. {phyx-1.7.0 → phyx-1.7.2}/phyx/fmt.py +0 -0
  65. {phyx-1.7.0 → phyx-1.7.2}/phyx/hints.py +0 -0
  66. {phyx-1.7.0 → phyx-1.7.2}/phyx/interpreter.py +0 -0
  67. {phyx-1.7.0 → phyx-1.7.2}/phyx/lexer.py +0 -0
  68. {phyx-1.7.0 → phyx-1.7.2}/phyx/lib/as/311/231r/316/270.phyx" +0 -0
  69. {phyx-1.7.0 → phyx-1.7.2}/phyx/lib/compleat.phyx +0 -0
  70. {phyx-1.7.0 → phyx-1.7.2}/phyx/lib//305/245ewn.phyx" +0 -0
  71. {phyx-1.7.0 → phyx-1.7.2}/phyx/limits.py +0 -0
  72. {phyx-1.7.0 → phyx-1.7.2}/phyx/numerals.py +0 -0
  73. {phyx-1.7.0 → phyx-1.7.2}/phyx/paths.py +0 -0
  74. {phyx-1.7.0 → phyx-1.7.2}/phyx/render.py +0 -0
  75. {phyx-1.7.0 → phyx-1.7.2}/phyx/scaffold.py +0 -0
  76. {phyx-1.7.0 → phyx-1.7.2}/phyx/testing.py +0 -0
  77. {phyx-1.7.0 → phyx-1.7.2}/phyx/values.py +0 -0
  78. {phyx-1.7.0 → phyx-1.7.2}/phyx/vertical.py +0 -0
  79. {phyx-1.7.0 → phyx-1.7.2}/phyx/vocabulary.py +0 -0
  80. {phyx-1.7.0 → phyx-1.7.2}/phyx.egg-info/dependency_links.txt +0 -0
  81. {phyx-1.7.0 → phyx-1.7.2}/phyx.egg-info/entry_points.txt +0 -0
  82. {phyx-1.7.0 → phyx-1.7.2}/phyx.egg-info/requires.txt +0 -0
  83. {phyx-1.7.0 → phyx-1.7.2}/phyx.egg-info/top_level.txt +0 -0
  84. {phyx-1.7.0 → phyx-1.7.2}/setup.cfg +0 -0
  85. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_as/311/231r/316/270.phyx" +0 -0
  86. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_compleat.phyx +0 -0
  87. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_conjugation.phyx +0 -0
  88. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_core_ability.phyx +0 -0
  89. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_core_list.phyx +0 -0
  90. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_core_loop.phyx +0 -0
  91. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_core_must.phyx +0 -0
  92. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_speak.phyx +0 -0
  93. {phyx-1.7.0 → phyx-1.7.2}/tests/phyx/test_/305/245ewn.phyx" +0 -0
  94. {phyx-1.7.0 → phyx-1.7.2}/tests/test_conjugation.py +0 -0
  95. {phyx-1.7.0 → phyx-1.7.2}/tests/test_docs.py +0 -0
  96. {phyx-1.7.0 → phyx-1.7.2}/tests/test_dx.py +0 -0
  97. {phyx-1.7.0 → phyx-1.7.2}/tests/test_engine_parity.py +0 -0
  98. {phyx-1.7.0 → phyx-1.7.2}/tests/test_interpreter.py +0 -0
  99. {phyx-1.7.0 → phyx-1.7.2}/tests/test_lexer.py +0 -0
  100. {phyx-1.7.0 → phyx-1.7.2}/tests/test_lsp.py +0 -0
  101. {phyx-1.7.0 → phyx-1.7.2}/tests/test_machine.py +0 -0
  102. {phyx-1.7.0 → phyx-1.7.2}/tests/test_new.py +0 -0
  103. {phyx-1.7.0 → phyx-1.7.2}/tests/test_parser.py +0 -0
  104. {phyx-1.7.0 → phyx-1.7.2}/tests/test_spec_verbs.py +0 -0
  105. {phyx-1.7.0 → phyx-1.7.2}/tests/test_stdlib.py +0 -0
  106. {phyx-1.7.0 → phyx-1.7.2}/tests/test_versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phyx
3
- Version: 1.7.0
3
+ Version: 1.7.2
4
4
  Summary: φyrx (PhyrxScript / PhyrexianScript) — a programming language written in Phyrexian
5
5
  Author: Brage
6
6
  License-Expression: MIT
@@ -40,7 +40,7 @@ Dynamic: license-file
40
40
 
41
41
  φyrx is a programming language written in Phyrexian. Its orthography, vocabulary, and grammar are not invented: they come from the community [Phyrexian Dictionary](https://fxbuson.github.io/PhyrexianDictionary/) (tutorial chapters 1–3). A program is a sequence of Phyrexian sentences. The verb comes last. Numbers are hexadecimal. Text is read in vertical columns.
42
42
 
43
- The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The optional font and dictionary JSON are **GPL-3.0** and are fetched, not vendored. Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
43
+ The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The Phyrexian Regular font belongs to Wizards of the Coast and is used under their [Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy); Basilica is by GuruJ (CC-BY 4.0); the optional dictionary JSON comes from the [PhyrexianDictionary](https://github.com/fxbuson/PhyrexianDictionary) repository, whose LICENSE file is GPL-3.0. None of them is bundled: `python -m phyx fetch` downloads them. Details are in [docs/toolchain.md](docs/toolchain.md#fonts-and-licences). Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
44
44
 
45
45
  ```
46
46
  python -m phyx examples/01_welcome.phyx
@@ -11,7 +11,7 @@
11
11
 
12
12
  φyrx is a programming language written in Phyrexian. Its orthography, vocabulary, and grammar are not invented: they come from the community [Phyrexian Dictionary](https://fxbuson.github.io/PhyrexianDictionary/) (tutorial chapters 1–3). A program is a sequence of Phyrexian sentences. The verb comes last. Numbers are hexadecimal. Text is read in vertical columns.
13
13
 
14
- The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The optional font and dictionary JSON are **GPL-3.0** and are fetched, not vendored. Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
14
+ The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The Phyrexian Regular font belongs to Wizards of the Coast and is used under their [Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy); Basilica is by GuruJ (CC-BY 4.0); the optional dictionary JSON comes from the [PhyrexianDictionary](https://github.com/fxbuson/PhyrexianDictionary) repository, whose LICENSE file is GPL-3.0. None of them is bundled: `python -m phyx fetch` downloads them. Details are in [docs/toolchain.md](docs/toolchain.md#fonts-and-licences). Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
15
15
 
16
16
  ```
17
17
  python -m phyx examples/01_welcome.phyx
@@ -159,7 +159,7 @@ python -m phyx examples/10_command.phyx red blue
159
159
 
160
160
  ```
161
161
  python -m phyx explain if # English → ba
162
- python -m phyx lint FILE # dropped 'iţpənn, unused objects, English keywords, short calls in this file
162
+ python -m phyx lint FILE # dropped 'iţpənn, unused objects, English keywords, short calls in this file or brought in with bukð
163
163
  python -m phyx --ascii FILE # Te is ťe, TTE'' is ţə''
164
164
  ```
165
165
 
@@ -95,7 +95,7 @@ The number-words `'ii` (1), `ķu` (2), `ķi` (3) are constants. There is no deci
95
95
 
96
96
  A word is a **verb** if it is in the standard lexicon (`babg`, `ţə''`, `'uxq`, …) or a `ťe` name in this file (or in a file this file `bukð`s). Otherwise it is a **name**, and must already have been bound with `ţə''` when the sentence runs.
97
97
 
98
- You may not bind a reserved word. `python -m phyx words` is the authoritative list; `python -m phyx explain if` maps English to the marker; `python -m phyx lookup add` searches the lexicon (no fetch required). `python -m phyx lint FILE` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and an ability defined in this file, of arity 1 or more, written with fewer objects than it wants (quote it with `naķm` if you wanted the ability as a value).
98
+ You may not bind a reserved word. `python -m phyx words` is the authoritative list; `python -m phyx explain if` maps English to the marker; `python -m phyx lookup add` searches the lexicon (no fetch required). `python -m phyx lint FILE` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and an ability of arity 1 or more, defined in this file or brought in with `bukð`, written with fewer objects than it wants (quote it with `naķm` if you wanted the ability as a value).
99
99
 
100
100
  ```
101
101
  ^xe-5-x-ţə''. x = 5
@@ -22,7 +22,7 @@ Start here, then pick the page that matches the job.
22
22
 
23
23
  The standard library is φyrx: `phyx/lib/` is on the `bukð` search path. `python -m phyx test` runs tests written in φyrx (`ǩaπa` is the assertion; a sibling `.expected` file is exact stdout). `python -m phyx lookup` searches the lexicon without a fetch.
24
24
 
25
- Faults name the fix and the ability stack. `python -m phyx explain if` answers in Phyrexian. `fmt` rewrites a file into canonical separators and indent. `lint` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and a short call of an ability defined in the same file.
25
+ Faults name the fix and the ability stack. `python -m phyx explain if` answers in Phyrexian. `fmt` rewrites a file into canonical separators and indent. `lint` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and a short call of an ability defined in the same file or brought in with `bukð`.
26
26
 
27
27
  A program can bind names, close over them, store abilities, build lists and books, cast modules, read and write UTF-8 notes (`brøtjt` / `mɴyrx`), read program arguments, and run in the REPL. `render` sets the text in vertical columns in the official Phyrexian font.
28
28
 
@@ -53,9 +53,9 @@ A competent engineer who joined last week and has never read the compiler should
53
53
 
54
54
  A language that cannot test itself in itself is a host API. `python -m phyx test` runs φyrx files; Python's `unittest` still covers the interpreter.
55
55
 
56
- ## MIT interpreter, GPL dictionary/font
56
+ ## MIT interpreter, separate font and dictionary
57
57
 
58
- The language and toolchain are MIT so they can be used like Python. The official Phyrexian Regular font and the dictionary JSON are GPL-3.0 (Wizards / dictionary repo) and are fetched, not vendored. `phyx fetch` installs them for this user. Rendered HTML embeds the font as family `Phyrexian` (the TTF's family name).
58
+ The language and toolchain are MIT so they can be used like Python. Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/). The dictionary JSON comes from the PhyrexianDictionary repository, whose LICENSE file is GPL-3.0. `phyx fetch` downloads that repository's `_data/PhyrexianAPI.json` from a pinned commit, checks its SHA-256, and saves it as `dictionary.json`. The font and the dictionary JSON are fetched, not vendored. Rendered HTML embeds the font as family `Phyrexian` (the TTF's family name).
59
59
 
60
60
  ## What will not be added
61
61
 
@@ -247,7 +247,7 @@ The language has unbounded integers, unbounded lists (`bɬølπ` grows a tape in
247
247
 
248
248
  ## Provenance
249
249
 
250
- Phyrexian script, romanisation, grammar and lexicon: [fxbuson/PhyrexianDictionary](https://fxbuson.github.io/PhyrexianDictionary/), itself a compilation of the community reading of Wizards of the Coast’s Phyrexian. The font and dictionary JSON are **GPL-3.0**; this toolchain does not vendor them. φyrx (PhyrxScript / PhyrexianScript) the language and interpreter are **MIT**.
250
+ Phyrexian script, romanisation, grammar and lexicon: [fxbuson/PhyrexianDictionary](https://fxbuson.github.io/PhyrexianDictionary/), itself a compilation of the community reading of Wizards of the Coast’s Phyrexian. Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). The dictionary JSON comes from the PhyrexianDictionary repository, whose LICENSE file is GPL-3.0. `python -m phyx fetch` downloads that repository's `_data/PhyrexianAPI.json` from a pinned commit, checks its SHA-256, and saves it as `dictionary.json`; this toolchain does not vendor it. φyrx (PhyrxScript / PhyrexianScript) the language and interpreter are **MIT**.
251
251
 
252
252
  Reserved words are dictionary entries. The mapping of mood markers onto statement forms, and of verbs onto operations, is the language design: it is consistent, but it is still a mapping.
253
253
 
@@ -24,6 +24,8 @@ The language version is the first two numbers of the toolchain version (spec sec
24
24
 
25
25
  Do not create the tag or the release until the bump commit is the one you mean to ship.
26
26
 
27
+ One GitHub release publishes everything: the toolchain to PyPI, and the extension to Open VSX and the Marketplace. PyPI refuses to upload a version that already exists, so a release that changes only the extension still needs a toolchain patch bump, as 1.7.1 did for extension 1.8.0. `workflow_dispatch` on "Publish extension" can publish just the extension registries when the extension version is higher than what the registries hold.
28
+
27
29
  ## CI
28
30
 
29
31
  `.github/workflows/ci.yml` runs on every pull request, and on a push only when the branch is `main`, so a pull request is checked once. `workflow_call` runs the same jobs from the publish workflows. The last job is named `ci-passed`. It uses `if: always()` and fails unless `test`, `tree-walker`, `lint`, `fuzz`, `package`, and `extension` each finished as `success`. A skipped or cancelled job fails `ci-passed`. The required status check is `ci-passed`.
@@ -59,7 +61,24 @@ Both jobs run on `ubuntu-latest`, with `contents: read` and `id-token: write`, w
59
61
 
60
62
  Before the publish step, each job reads `version` from `editors/package.json` and queries that registry with the same tool it publishes with: `npx --yes @vscode/vsce show brage1025.phyx --json` for the Marketplace (`versions[0].version`, the version `vsce show` prints as current), and `npx --yes ovsx get brage1025.phyx --metadata` for Open VSX (the `version` field). When that published version equals `editors/package.json`, the publish step is skipped and the log prints a notice. The package step still runs. When the query fails, or the response has no version, the job fails and does not publish. A release that does not change the extension can succeed.
61
63
 
62
- The `marketplace` job uses `vsce publish --oidc` (`npx --yes @vscode/vsce publish --oidc --no-dependencies`). The workflow file contains no `VSCE_PAT` and no `--pat`, and there is nothing in GitHub secrets to fill in for this job. Whether the Marketplace accepts a trusted-publishing policy for this repository is unverified. Before relying on it for a release, run the "Publish extension" workflow manually (`workflow_dispatch`) with `registry=marketplace` and read the result. If it fails, the fix is a workflow change (a PAT secret or `--azure-credential`), not a docs change. The places to check are the [vsce README](https://github.com/microsoft/vscode-vsce/blob/main/README.md) and the VS Code [Publishing Extensions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) page.
64
+ The `marketplace` job uses `vsce publish --oidc` (`npx --yes @vscode/vsce publish --oidc --no-dependencies`). The workflow file contains no `VSCE_PAT` and no `--pat`, and there is nothing in GitHub secrets to fill in for this job.
65
+
66
+ #### Marketplace trusted publishing
67
+
68
+ Setup is on `https://marketplace.visualstudio.com/manage` → the publisher `brage1025` → the Trusted Publishing tab → Create. The VS Code [Publishing Extensions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) page describes the same policy.
69
+
70
+ Values:
71
+
72
+ - Policy name: `Release workflow`
73
+ - Provider: GitHub Actions
74
+ - Repository owner: `Brage1025`
75
+ - Repository: `phyrexianscript`
76
+ - Workflow: `publish-extension.yml` (the file that contains the publishing job)
77
+ - Environment: empty (the workflow uses no GitHub environment)
78
+
79
+ A GitHub token can be exchanged only once, and the resulting Marketplace credential lasts 15 minutes.
80
+
81
+ If the job fails with `401 Unauthorized ... The token could not be exchanged for the specified publisher`, the publisher has no policy that matches the repository owner, repository and workflow file name exactly. Fix the policy, then re-run "Publish extension" with `registry=marketplace`.
63
82
 
64
83
  The `openvsx` job runs `npx --yes ovsx publish --trusted-publishing --no-dependencies`. This workflow passes neither `--pat` nor `OVSX_PAT`.
65
84
 
@@ -88,3 +107,15 @@ Extension listings, version equal to `editors/package.json`:
88
107
 
89
108
  - Visual Studio Marketplace: `https://marketplace.visualstudio.com/items?itemName=brage1025.phyx`
90
109
  - Open VSX: `https://open-vsx.org/extension/brage1025/phyx`
110
+
111
+ ## Updating the pinned fonts and dictionary
112
+
113
+ `editors/fonts.js` and `phyx/fonts.py` name the PhyrexianDictionary commits and the SHA-256 of each file `phyx fetch` downloads.
114
+
115
+ 1. Find the new commit with `git ls-remote` (`refs/heads/main` for the fonts, `refs/heads/gh-pages` for the dictionary).
116
+ 2. Download each file and compute its SHA-256.
117
+ 3. Update `FONT_COMMIT` and the two font hashes in both `editors/fonts.js` and `phyx/fonts.py`. A test checks that they agree.
118
+ 4. Update the dictionary commit and hash in `phyx/fonts.py`.
119
+ 5. Run the tests.
120
+ 6. Add a CHANGELOG line.
121
+ 7. Release.
@@ -20,17 +20,15 @@ Nothing below is a promise, and nothing below adds a word or a form the Phyrexia
20
20
 
21
21
  ## Known issues
22
22
 
23
- - **`'u` on a name already bound in the same ability.** The compiled engine and the tree-walker still disagree in a few cases. Pinned as expected failures `test_BUG_R_enclosing_loop_name_persistent`, `test_BUG_S_fix_in_handler_of_try_name`, and `test_BUG_T_second_fix_message` in [tests/test_parity_fuzz.py](../tests/test_parity_fuzz.py) (`BUG_R`, `BUG_S`, `BUG_T`). GitHub: [#1](https://github.com/Brage1025/phyrexianscript/issues/1)
24
- - **`phyx lint` and abilities brought in with `bukð`.** A short call of an ability defined in the same file is a note. A short call of an ability brought in with `bukð` is not: `lint` collects arities from this file's `ťe` sentences only ([phyx/lint.py](../phyx/lint.py)). GitHub: [#2](https://github.com/Brage1025/phyrexianscript/issues/2)
25
23
  - **Guarded arithmetic.** Compiled programs keep a kind guard on operators, so arithmetic-heavy code is slower than the same code in CPython. `python -m phyx bench` prints the ratio. On the defaults (`--size 16`, `--loops 20000`) the ratio is typically two to four times and varies by machine. A specialised fast path is a possible optimisation. It is unscheduled. Compiling ordering to raw Python `<` stays rejected: `1 == True` is not Phyrexian (1.4.1). GitHub: [#3](https://github.com/Brage1025/phyrexianscript/issues/3)
26
- - **Ctrl-C and out-of-memory on CI.** Both are tested only where the platform supports the check. Ctrl-C tests skip on Windows (`SIGINT` delivery differs). The out-of-memory fault is tested on Linux only: macOS does not enforce `RLIMIT_AS`, and Windows has no `resource` module ([docs/toolchain.md](toolchain.md), [tests/test_host_faults.py](../tests/test_host_faults.py)). Windows CI therefore does not run either check. GitHub: [#4](https://github.com/Brage1025/phyrexianscript/issues/4)
27
- - **Publish workflows.** Whether the Marketplace accepts the OIDC publish is unverified ([docs/releasing.md](releasing.md)). GitHub: [#5](https://github.com/Brage1025/phyrexianscript/issues/5)
24
+ - **Ctrl-C and out-of-memory on CI.** Ctrl-C is tested on Linux, macOS, and Windows ([tests/test_host_faults.py](../tests/test_host_faults.py)). Windows starts the child in its own process group and sends `CTRL_BREAK_EVENT` (`SIGBREAK` raises `KeyboardInterrupt`); Linux and macOS send `SIGINT`. The out-of-memory fault is tested on Linux with `RLIMIT_AS` and on Windows with a Job Object process memory limit. It is still not tested on macOS, because macOS does not enforce `RLIMIT_AS` ([docs/toolchain.md](toolchain.md)). GitHub: [#4](https://github.com/Brage1025/phyrexianscript/issues/4)
28
25
 
29
26
  ## Planned work
30
27
 
31
28
  Unscheduled. Taking an item up is a later decision.
32
29
 
33
30
  - An optional `--safe` flag for running other people's programs. Today a program can read and write files, cast other files, and exit the process ([SECURITY.md](../SECURITY.md)).
31
+ - Editor diagnostics. `phyx.lsp.diagnostics_for` computes parse errors and lint notes but the language server does not publish them, and the extension's client ignores server notifications.
34
32
  - Fixes for the known issues above, if one of them is taken up. The arithmetic fast path, if it is ever written, still has to keep Phyrexian kinds.
35
33
 
36
34
  ## Will not be added
@@ -120,7 +120,26 @@ python -m phyx render examples/09_sieve.phyx -o sieve.html
120
120
 
121
121
  `render` writes a page in the official card font. The file is `Phyrexian-Regular.ttf`; its **family name is `Phyrexian`** (full name `Phyrexian Regular`). That is the name CSS and Windows use. `python -m phyx render` downloads and **embeds** a validated copy so the page cannot flash Latin fallbacks.
122
122
 
123
- `python -m phyx fetch` also pulls **Basilica** (native hexadecimal glyphs, CC-BY) and, on Windows, installs both into the current user’s font folder so editors can select **Phyrexian**. The lexer already reads those Mathematical Monospace digits as the same hex as `0–9a–f`. Assets live in `assets/` (gitignored). Override the directory with `PHYX_ASSETS`.
123
+ `python -m phyx fetch` also pulls **Basilica** (native hexadecimal glyphs). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/). On Windows it installs both fonts into the current user’s font folder so editors can select **Phyrexian**. The editor extension installs those same fonts on its own, from a pinned commit, and does not run `phyx fetch`. The lexer already reads those Mathematical Monospace digits as the same hex as `0–9a–f`. In a source checkout, fetched fonts and the dictionary live in `assets/` (gitignored). An installed phyx keeps them in a per-user data folder: `%LOCALAPPDATA%\phyx` on Windows, `~/Library/Application Support/phyx` on macOS, and `$XDG_DATA_HOME/phyx` or `~/.local/share/phyx` elsewhere. `PHYX_ASSETS` overrides that directory. When that per-user folder has no fonts yet, a valid font file still next to the installed package is read from there. A download is written to that per-user folder.
124
+
125
+ ---
126
+
127
+ ## Fonts and licences
128
+
129
+ Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
130
+
131
+ The six fonts below are the faces in the PhyrexianDictionary repository. The licence column is what the font file itself states.
132
+
133
+ | Font | Maker | Licence stated in the file | Used | Why |
134
+ | --- | --- | --- | --- | --- |
135
+ | `Phyrexian-Regular.ttf` | Wizards of the Coast; manufactured by Delve Fonts LLC | None. Copyright © 2019 by Wizards of the Coast, a Hasbro Subsidiary. All rights reserved. | Yes | Card font (family name `Phyrexian`) for `render` and the editor. |
136
+ | `Basilica.otf` | GuruJ (2023) | CC-BY (https://creativecommons.org/licenses/by/4.0/). Derived from Progress Engine and remapped to the official Wizards transliteration. | Yes | Native hexadecimal glyphs. |
137
+ | `Phi_horizontal_gbrsh_9.8.ttf` | Phie (Stas.tk), 2022 | SIL Open Font License 1.1 | No | Missing glyphs for `! : ; ^ ' " ( ) * = < > ? @ #`. |
138
+ | `PhyrexianCompleat.ttf` | Osmago, built with FontStruct | "Open Font License", no version stated | No | No digits and little punctuation, and the licence names no version. |
139
+ | `Phyrexian_Engraved.otf` | Aldurethar | SIL Open Font License (OFL), no version stated | No | Lacks many lowercase letters, and the licence names no version. |
140
+ | `ProgressEngine.otf` | GuruJ, 2020 | None stated | No | No licence is stated. Basilica is derived from this face. |
141
+
142
+ Phi_horizontal, Phyrexian Compleat, Phyrexian Engraved and ProgressEngine are not offered because their glyph coverage or licence statement is not good enough for source code. Fonts are downloaded at a pinned commit with a SHA-256 check rather than bundled: the editor fetches Phyrexian Regular and Basilica from PhyrexianDictionary commit `f3ea2bd41c433976493862325d91435dc3522cc3` and checks each file's SHA-256. `python -m phyx fetch` downloads the fonts and the dictionary from pinned commits and checks each file's SHA-256. The dictionary is saved as `dictionary.json`. `python -m phyx lookup` searches that file when it is present.
124
143
 
125
144
  ---
126
145
 
@@ -151,7 +170,7 @@ editors/ Cursor / VS Code extension (`package.json`) + Vim grammars
151
170
  examples/ programs, aliases of the herds, Turing machine, sort, file notes
152
171
  tests/ python -m unittest discover -s tests -v
153
172
  tests/phyx/ φyrx tests (`python -m phyx test`)
154
- assets/ font + dictionary after `phyx fetch` (gitignored)
173
+ assets/ source checkout: font + dictionary after `phyx fetch` (gitignored)
155
174
  ```
156
175
 
157
176
  ---
@@ -170,7 +189,7 @@ run_source('!"šdeχd".', argv=["ignored-by-this-program"])
170
189
 
171
190
  ## CI and the index
172
191
 
173
- GitHub Actions (`.github/workflows/ci.yml`) runs on pull requests and on pushes to `main` only. It runs `python -m unittest discover -s tests -v` and `python -m phyx test` on Ubuntu, Windows, and macOS for Python 3.11 and 3.13, and on Ubuntu for 3.12 and 3.14. Ubuntu 3.11 and 3.14 also run that suite with `PHYX_TREEWALK=1`. Ubuntu 3.13 writes a coverage report and does not set a minimum. Other jobs run `ruff check .`, `PHYX_FUZZ=3000` on `tests.test_parity_fuzz`, and `python -m build` / `twine check`, then install the wheel and the sdist outside the checkout. The extension job runs `node editors/check.js`. The last job is `ci-passed`. The out-of-memory fault is tested on Linux only because macOS does not enforce `RLIMIT_AS` and Windows has no `resource` module.
192
+ GitHub Actions (`.github/workflows/ci.yml`) runs on pull requests and on pushes to `main` only. It runs `python -m unittest discover -s tests -v` and `python -m phyx test` on Ubuntu, Windows, and macOS for Python 3.11 and 3.13, and on Ubuntu for 3.12 and 3.14. Ubuntu 3.11 and 3.14 also run that suite with `PHYX_TREEWALK=1`. Ubuntu 3.13 writes a coverage report and does not set a minimum. Other jobs run `ruff check .`, `PHYX_FUZZ=3000` on `tests.test_parity_fuzz`, and `python -m build` / `twine check`, then install the wheel and the sdist outside the checkout. The extension job runs `node editors/check.js` and `node --test "editors/*.test.js"`. The last job is `ci-passed`. Ctrl-C is tested on Linux, macOS, and Windows. The out-of-memory fault is tested on Linux with `RLIMIT_AS` and on Windows with a Job Object process memory limit. It is still not tested on macOS, because macOS does not enforce `RLIMIT_AS`.
174
193
 
175
194
  `pip install phyx` installs the latest release from the Python Package Index ([PyPI badge](https://img.shields.io/pypi/v/phyx), [project page](https://pypi.org/project/phyx/)). A GitHub Release retriggers `.github/workflows/publish.yml` (trusted publishing). `brage1025.phyx` is on the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=brage1025.phyx) and [Open VSX](https://open-vsx.org/extension/brage1025/phyx) (Cursor’s in-editor marketplace). `.github/workflows/publish-extension.yml` packages `editors/` and publishes with `vsce publish --oidc` and `ovsx publish --trusted-publishing`. Both publish workflows run CI first. An extension publish step is skipped when the registry already has the same version. After Eclipse grants namespace ownership ([claim](https://github.com/EclipseFdn/open-vsx.org/issues/14213)), Open VSX Settings → Trusted Publishers: GitHub user `Brage1025`, repo `phyrexianscript`, workflow `publish-extension.yml`.
176
195
 
@@ -0,0 +1,98 @@
1
+ # Editor support for φyrx
2
+
3
+ <img src="https://raw.githubusercontent.com/Brage1025/phyrexianscript/main/editors/phyx-original.png" width="96" height="96" alt="φyrx">
4
+
5
+ Grammars for `.phyx` (row layout) and `.vphyx` (vertical columns). They highlight mood markers, verbs, constants, notes (`^rukx`), strings, and hexadecimal numerals.
6
+
7
+ `editors/` **is** a Cursor / VS Code extension (`package.json`).
8
+
9
+ Install from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=brage1025.phyx) (VS Code) or [Open VSX](https://open-vsx.org/extension/brage1025/phyx) (Cursor’s in-editor marketplace). Both listings are `brage1025.phyx`.
10
+
11
+ ## Cursor / Visual Studio Code
12
+
13
+ From this repository, without the Marketplace:
14
+
15
+ 1. In `editors/`, run `npx --yes @vscode/vsce package --no-dependencies`.
16
+ 2. Extensions → `…` → **Install from VSIX…**.
17
+ 3. Choose the `phyx-<version>.vsix` file written in `editors/`.
18
+
19
+ Or copy the folder into the editor’s extensions directory (restart the editor after):
20
+
21
+ ```
22
+ # Cursor, Windows
23
+ xcopy /E /I editors %USERPROFILE%\.cursor\extensions\brage1025.phyx-1.8.1
24
+
25
+ # VS Code, Windows
26
+ xcopy /E /I editors %USERPROFILE%\.vscode\extensions\brage1025.phyx-1.8.1
27
+ ```
28
+
29
+ ```
30
+ # Cursor, macOS / Linux
31
+ cp -R editors ~/.cursor/extensions/brage1025.phyx-1.8.1
32
+
33
+ # VS Code, macOS / Linux
34
+ cp -R editors ~/.vscode/extensions/brage1025.phyx-1.8.1
35
+ ```
36
+
37
+ A VSIX, if you have Node:
38
+
39
+ ```
40
+ npx --yes @vscode/vsce package --no-dependencies
41
+ ```
42
+
43
+ That writes `phyx-1.8.1.vsix` in `editors/`. Then **Install from VSIX…**.
44
+
45
+ `.phyx` and `.vphyx` are associated with language id `phyx` (scope `source.phyx`).
46
+
47
+ `python -m phyx words` is the same lexicon the grammar was built from. After a lexicon change, regenerate:
48
+
49
+ ```
50
+ python editors/_gen.py
51
+ ```
52
+
53
+ `_gen.py` rewrites the TextMate and Vim grammars. It does not touch `package.json`.
54
+
55
+ ## Language server
56
+
57
+ Completions, jump to `ťe`, and hover come from the φyrx language server (`phyx lsp`). It needs Python 3.11 or newer with phyx installed (`python -m pip install phyx`).
58
+
59
+ `phyx.pythonPath` is the path to that Python interpreter or to a phyx executable. The setting is machine-scoped and defaults to empty. VS Code reads it from user settings, so a workspace `.vscode/settings.json` cannot choose the executable. An empty setting searches `PATH`. A filled-in setting is the only command the extension starts, so a wrong path fails on its own and the warning names that path.
60
+
61
+ Search order when the setting is empty: `PHYX_PYTHON`, then `phyx`, then `python`, then `python3`. On Windows, `py -3` comes last. A `PHYX_PYTHON` value or a `phyx.pythonPath` whose lowercase text contains `phyx` is run as `<path> lsp`. Any other interpreter is run as `<path> -P -m phyx lsp`. `python` and `python3` use `-P -m phyx lsp`. A `PATH` name is resolved to an absolute path from an absolute `PATH` directory. Empty entries, `.`, and relative entries are skipped, and the workspace folder is not a place the extension looks for the interpreter. `-P` (Python 3.11+) keeps that folder off `sys.path`, so a workspace that contains its own `phyx/` package cannot be the package Python imports. The server's working directory is still the workspace folder, because `bukð` looks up herds from the working directory.
62
+
63
+ In an untrusted workspace the language server stays off. Syntax highlighting and **φyrx: Install fonts** / **φyrx: Toggle Phyrexian font** still work. Trusting the workspace starts the server. If the server cannot start, one warning offers **Open Settings**, which opens `phyx.pythonPath`.
64
+
65
+ ## Font
66
+
67
+ The extension installs Phyrexian Regular and Basilica itself. Python and `phyx` are not needed for the fonts. The files are downloaded from the PhyrexianDictionary project at a pinned commit, checked against a SHA-256 hash, and never bundled with the extension.
68
+
69
+ On Windows they are installed for the current user in `%LOCALAPPDATA%\Microsoft\Windows\Fonts`. Restart VS Code to use them. On macOS they go in `~/Library/Fonts`. On Linux they go in `$XDG_DATA_HOME/fonts`, or `~/.local/share/fonts` when `XDG_DATA_HOME` is unset. Restart VS Code to use them.
70
+
71
+ The first time a φyrx file is open, if Phyrexian Regular is not already installed, it asks "Install the Phyrexian font so φyrx code looks right?" That offer is shown once. Opening the command palette alone does not ask. Set `phyx.offerFontInstall` to false to switch it off.
72
+
73
+ **φyrx: Install fonts** downloads and installs both fonts. **Turn on Phyrexian font** turns the language font on when it is off, and **Reveal folder** opens the install folder in the file manager.
74
+
75
+ **φyrx: Toggle Phyrexian font** switches the language-scoped setting `[phyx]` → `editor.fontFamily` between `Phyrexian` followed by your current font as a fallback, and unset. Nothing turns the font on until you run that command or choose **Turn on Phyrexian font**. The font is proportional, so it is opt-in.
76
+
77
+ The extension turns off VS Code's non-ASCII and ambiguous-character highlighting for φyrx files only, so Restricted Mode does not box every character. Invisible characters are still flagged.
78
+
79
+ Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
80
+
81
+ φyrx is unofficial Fan Content permitted under the Fan Content Policy. Not approved/endorsed by Wizards. Portions of the materials used are property of Wizards of the Coast. ©Wizards of the Coast LLC.
82
+
83
+ ## Vim / Neovim
84
+
85
+ ```
86
+ set runtimepath+=/path/to/PhyrexianScript/editors
87
+ ```
88
+
89
+ Or copy:
90
+
91
+ - `syntax/phyx.vim` → `~/.vim/syntax/phyx.vim`
92
+ - `ftdetect/phyx.vim` → `~/.vim/ftdetect/phyx.vim`
93
+
94
+ Neovim: the same paths under `~/.config/nvim/`.
95
+
96
+ ## What is not highlighted on purpose
97
+
98
+ User ability names (`fib`, `sort`, `abs`) are not keywords. They are names you bind with `ťe`. The grammar only knows the dictionary.
@@ -2,7 +2,7 @@
2
2
  "name": "phyx",
3
3
  "displayName": "φyrx",
4
4
  "description": "φyrx (PhyrxScript / PhyrexianScript) — a programming language written in Phyrexian",
5
- "version": "1.7.0",
5
+ "version": "1.8.1",
6
6
  "publisher": "brage1025",
7
7
  "icon": "phyx-original.png",
8
8
  "license": "MIT",
@@ -23,6 +23,12 @@
23
23
  "engines": {
24
24
  "vscode": "^1.74.0"
25
25
  },
26
+ "capabilities": {
27
+ "untrustedWorkspaces": {
28
+ "supported": "limited",
29
+ "description": "Language features run phyx, so they are disabled until the workspace is trusted. Syntax highlighting and the font commands still work."
30
+ }
31
+ },
26
32
  "categories": [
27
33
  "Programming Languages"
28
34
  ],
@@ -44,6 +50,28 @@
44
50
  "title": "φyrx: Toggle Phyrexian font"
45
51
  }
46
52
  ],
53
+ "configuration": {
54
+ "title": "φyrx",
55
+ "properties": {
56
+ "phyx.offerFontInstall": {
57
+ "type": "boolean",
58
+ "default": true,
59
+ "description": "Offer to install the Phyrexian font the first time a φyrx file is opened."
60
+ },
61
+ "phyx.pythonPath": {
62
+ "type": "string",
63
+ "default": "",
64
+ "scope": "machine",
65
+ "description": "Path to the Python interpreter or phyx executable used to start the φyrx language server. Leave empty to search PATH."
66
+ }
67
+ }
68
+ },
69
+ "configurationDefaults": {
70
+ "[phyx]": {
71
+ "editor.unicodeHighlight.nonBasicASCII": false,
72
+ "editor.unicodeHighlight.ambiguousCharacters": false
73
+ }
74
+ },
47
75
  "languages": [
48
76
  {
49
77
  "id": "phyx",
@@ -12,9 +12,7 @@ from __future__ import annotations
12
12
  import argparse
13
13
  import io
14
14
  import json
15
- import os
16
15
  import sys
17
- import urllib.request
18
16
  from collections.abc import Iterable
19
17
  from pathlib import Path
20
18
 
@@ -24,12 +22,24 @@ from .compiler import compile_to_python
24
22
  from .errors import PhyrexianError, format_error
25
23
  from .fmt import format_source
26
24
  from .fonts import (
25
+ BASILICA_CDN,
26
+ BASILICA_REMOTE,
27
+ BASILICA_SHA256,
28
+ DICT_CDN,
29
+ DICT_REMOTE,
30
+ DICT_SHA256,
31
+ FONT_CDN,
27
32
  FONT_FAMILY,
28
- ensure_basilica,
33
+ FONT_REMOTE,
34
+ PHYREXIAN_SHA256,
35
+ assets_dir,
29
36
  ensure_font,
37
+ ensure_pinned,
30
38
  install_user_font,
31
39
  is_font_file,
40
+ local_basilica,
32
41
  local_font,
42
+ matches_pin,
33
43
  )
34
44
  from .hints import explain_missing, explain_word, search_lexicon
35
45
  from .interpreter import Interpreter
@@ -68,17 +78,9 @@ SUBCOMMANDS = {
68
78
  "lsp",
69
79
  }
70
80
 
71
- DICT_REMOTE = "https://raw.githubusercontent.com/fxbuson/PhyrexianDictionary/gh-pages/_data/PhyrexianAPI.json"
72
81
  VERTICAL_EXT = ".vphyx"
73
82
 
74
83
 
75
- def assets_dir() -> Path:
76
- env = os.environ.get("PHYX_ASSETS")
77
- if env:
78
- return Path(env)
79
- return Path(__file__).resolve().parent.parent / "assets"
80
-
81
-
82
84
  def local_dictionary() -> Path:
83
85
  return assets_dir() / "dictionary.json"
84
86
 
@@ -191,12 +193,14 @@ def cmd_fmt(args: argparse.Namespace) -> int:
191
193
 
192
194
  def cmd_lint(args: argparse.Namespace) -> int:
193
195
  source = load_source(args.file, args.ascii, args.vertical)
196
+ root = Path(args.file).resolve().parent
194
197
  try:
195
- program = parse(source, base_dir=Path(args.file).resolve().parent)
198
+ brought: dict[str, int] = {}
199
+ program = parse(source, base_dir=root, imported=brought)
196
200
  except PhyrexianError as err:
197
201
  print(format_error(err, source), file=sys.stderr)
198
202
  return 1
199
- notes = lint_program(program)
203
+ notes = lint_program(program, imported=brought)
200
204
  if not notes:
201
205
  print(f"{args.file}: no notes")
202
206
  return 0
@@ -255,25 +259,50 @@ def cmd_translit(args: argparse.Namespace) -> int:
255
259
  return 0
256
260
 
257
261
 
262
+ def _fetch_pinned(heading: str, dest: Path, urls: list[str], sha256: str, *, require_font: bool) -> Path:
263
+ print(heading)
264
+ already = matches_pin(dest, sha256)
265
+ path = ensure_pinned(dest, urls, sha256, require_font=require_font)
266
+ if already:
267
+ print(" already up to date")
268
+ print(f" -> {path}")
269
+ return path
270
+
271
+
258
272
  def cmd_fetch(args: argparse.Namespace) -> int:
259
- print("fetching Phyrexian Regular (official card font, family name: Phyrexian)")
260
- font = ensure_font()
261
- print(f" -> {font}")
262
- print("fetching Basilica (native hexadecimal glyphs)")
263
- basilica = ensure_basilica()
264
- print(f" -> {basilica}")
265
- dest = local_dictionary()
266
- dest.parent.mkdir(parents=True, exist_ok=True)
267
- print(f"fetching {DICT_REMOTE}")
268
- req = urllib.request.Request(DICT_REMOTE, headers={"User-Agent": "phyx-font-fetch"})
269
- with urllib.request.urlopen(req, timeout=60) as resp: # noqa: S310 - fixed https URLs
270
- dest.write_bytes(resp.read())
271
- print(f" -> {dest}")
273
+ try:
274
+ font = _fetch_pinned(
275
+ "fetching Phyrexian Regular (official card font, family name: Phyrexian)",
276
+ local_font(),
277
+ [FONT_CDN, FONT_REMOTE],
278
+ PHYREXIAN_SHA256,
279
+ require_font=True,
280
+ )
281
+ basilica = _fetch_pinned(
282
+ "fetching Basilica (native hexadecimal glyphs)",
283
+ local_basilica(),
284
+ [BASILICA_CDN, BASILICA_REMOTE],
285
+ BASILICA_SHA256,
286
+ require_font=True,
287
+ )
288
+ _fetch_pinned(
289
+ f"fetching {DICT_REMOTE}",
290
+ local_dictionary(),
291
+ [DICT_REMOTE, DICT_CDN],
292
+ DICT_SHA256,
293
+ require_font=False,
294
+ )
295
+ except OSError as err:
296
+ print(f"error: {err}", file=sys.stderr)
297
+ return 1
272
298
  for path, family in ((font, FONT_FAMILY), (basilica, "Basilica")):
273
299
  installed = install_user_font(path, family)
274
300
  if installed:
275
301
  print(f"installed {family} for this user: {installed}")
276
- print("done. Phyrexian Regular is GPL-3.0 (Wizards / dictionary repo); Basilica is CC-BY.")
302
+ print(
303
+ "done. Phyrexian Regular is Wizards of the Coast's font, "
304
+ "used under the Fan Content Policy; Basilica is by GuruJ, CC-BY 4.0."
305
+ )
277
306
  return 0
278
307
 
279
308