Skip to content

Commit 8b903fb

Browse files
committed
update getting-started, remove uselss flags
1 parent 018ad58 commit 8b903fb

6 files changed

Lines changed: 27 additions & 46 deletions

File tree

‎docs/getting-started/beginner-workflow.md‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,11 @@ build and smoke test still need to run.
7171

7272
```bash
7373
python3 -m x2py src/scale.f90 \
74-
--wrap \
75-
--out-dir build/scale \
76-
--json
74+
--out-dir build/scale
7775
```
7876

79-
Build output goes under `build/scale`, leaving `src/scale.f90` untouched. Keep
80-
the JSON result in build logs when debugging. It records the module name, output
81-
directory, shared-library path, generated files, and native build plan. Use
82-
`--verbose` instead of `--json` when you need exact compiler and linker
83-
commands.
77+
Build output goes under `build/scale`, leaving `src/scale.f90` untouched. Use
78+
`--verbose` when you need exact compiler and linker commands in build logs.
8479

8580
## 4. Run A Python Smoke Test
8681

@@ -132,12 +127,12 @@ selected output directory first:
132127

133128
```bash
134129
rm -rf build/scale
135-
python3 -m x2py src/scale.f90 --wrap --out-dir build/scale --json
130+
python3 -m x2py src/scale.f90 --out-dir build/scale
136131
```
137132

138-
Use `--wrap --makefile` when you intentionally want inspectable commands and
139-
manual rebuild control. `--makefile` and `--verbose` are separate modes and
140-
cannot be combined.
133+
The advanced Makefile workflow is available when you intentionally want
134+
inspectable commands and manual rebuild control. Makefile generation and
135+
`--verbose` are separate modes and cannot be combined.
141136

142137
## Advanced Next Step: Edit The Semantic Contract
143138

‎docs/getting-started/first-wrapped-function.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ From the directory containing `scale.f90`:
2525

2626
```bash
2727
python3 -m x2py scale.f90 \
28-
--wrap \
29-
--out-dir build/first-function \
30-
--json
28+
--out-dir build/first-function
3129
```
3230

3331
The extension is named after the source stem: `scale`. The standalone native

‎docs/getting-started/first-wrapped-module.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ From the directory containing `module_state.f90`:
5353

5454
```bash
5555
python3 -m x2py module_state.f90 \
56-
--wrap \
57-
--out-dir build/first-module \
58-
--json
56+
--out-dir build/first-module
5957
```
6058

6159
The source stem creates extension `module_state`. Its contained module is

‎docs/getting-started/installation.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ Install these before attempting a wrapper build:
3737
- NumPy, whose Python package supplies the required C headers; and
3838
X2PY_C_DOCS_END -->
3939

40-
GNU Make is optional. Direct builds do not require it, but `--wrap --makefile`
41-
emits a `Makefile.x2py` that expects GNU Make and a POSIX-style shell.
40+
GNU Make is optional. Direct builds do not require it. The generated Makefile
41+
workflow is an advanced build mode that expects GNU Make and a POSIX-style
42+
shell.
4243

4344
On Ubuntu or Debian, the prerequisite packages normally come from:
4445

‎docs/getting-started/verification.md‎

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,41 +69,29 @@ From the same directory, build `scale.f90` into a dedicated directory:
6969

7070
```bash
7171
python3 -m x2py scale.f90 \
72-
--wrap \
73-
--out-dir build/verify \
74-
--json
72+
--out-dir build/verify
7573
```
7674

77-
The JSON result must report:
75+
The command must create:
7876

79-
- `compiled` as `true`;
80-
- `module_name` as `scale`;
81-
- an existing `shared_library` under `build/verify`; and
82-
- generated native bridge, object, runtime-support, and extension paths.
77+
- an importable `scale` extension under `build/verify`; and
78+
- generated native bridge, object, runtime-support, and extension files.
8379

8480
<!-- X2PY_C_DOCS_START
85-
- generated bridge, C binding, object, and runtime-support paths.
81+
- generated bridge, C binding, object, and runtime-support files.
8682
X2PY_C_DOCS_END -->
8783

88-
Import the extension through the Python API result so the platform-specific
89-
shared-library suffix does not need to be guessed:
84+
Import the extension from that build directory:
9085

9186
```python
92-
from importlib.util import module_from_spec, spec_from_file_location
87+
import sys
9388

9489
import numpy as np
9590

96-
from x2py import build_fortran_extension
97-
98-
build = build_fortran_extension(
99-
"scale.f90",
100-
output_dir="build/verify",
101-
)
102-
spec = spec_from_file_location(build.module_name, build.shared_library)
103-
extension = module_from_spec(spec)
104-
spec.loader.exec_module(extension)
91+
sys.path.insert(0, "build/verify")
92+
import scale
10593

106-
assert extension.scale(np.float64(3.0), np.float64(2.5)) == np.float64(7.5)
94+
assert scale.scale(np.float64(3.0), np.float64(2.5)) == np.float64(7.5)
10795
```
10896

10997
## 4. Inspect Generated Files
@@ -127,9 +115,8 @@ print(build.output_dir)
127115
print(build.shared_library)
128116
```
129117

130-
For CLI builds, `--json` exposes the same fields. Add `--verbose` when a
131-
compiler or linker command fails; it prints the exact native commands and stage
132-
timings.
118+
For CLI builds, add `--verbose` when a compiler or linker command fails; it
119+
prints the exact native commands and stage timings.
133120

134121
## Escalation Path
135122

‎tests/tools/test_documentation_structure.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ def test_beginner_workflow_reuses_scale_example_without_renaming_it() -> None:
762762
source_reference_index = page.index("[README Quick Start](../../README.md#quick-start)")
763763
layout_index = page.index("src/\n scale.f90")
764764
contract_index = page.index("python3 -m x2py src/scale.f90 --pyi")
765-
build_index = page.index("python3 -m x2py src/scale.f90 \\\n --wrap \\\n --out-dir build/scale")
765+
build_index = page.index("python3 -m x2py src/scale.f90 \\\n --out-dir build/scale")
766766
smoke_index = page.index("result = scale.scale(np.float64(3.0), np.float64(2.5))")
767767
advanced_index = page.index("## Advanced Next Step: Edit The Semantic Contract")
768768

@@ -777,7 +777,9 @@ def test_getting_started_pages_keep_advanced_stage_flags_out_of_beginner_path()
777777

778778
assert "--parse" not in content
779779
assert "--semantics" not in content
780+
assert "--wrap" not in content
780781
assert "--wrap-readiness" not in content
782+
assert "--json" not in content
781783

782784

783785
@pytest.mark.parametrize("heading", CLI_HELP_GROUP_HEADINGS)

0 commit comments

Comments
 (0)