bc-lantern 0.7.0__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.
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,78 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: Test and build distributions
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.13"
21
+ cache: pip
22
+ - name: Install development tools
23
+ run: python -m pip install ".[dev]"
24
+ - name: Verify tag matches package version
25
+ shell: python
26
+ run: |
27
+ import os
28
+ import pathlib
29
+ import tomllib
30
+
31
+ tag_version = os.environ["GITHUB_REF_NAME"].removeprefix("v")
32
+ project = tomllib.loads(
33
+ pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
34
+ )["project"]
35
+ if project["version"] != tag_version:
36
+ raise SystemExit(
37
+ f"Tag version {tag_version!r} does not match "
38
+ f"project version {project['version']!r}"
39
+ )
40
+ - run: python -m pytest
41
+ - run: bcl docs sync --check
42
+ - name: Build distributions
43
+ run: python -m build
44
+ - name: Check distribution metadata
45
+ run: python -m twine check dist/*
46
+ - name: Test the built wheel
47
+ run: |
48
+ python -m venv /tmp/bc-lantern-wheel
49
+ /tmp/bc-lantern-wheel/bin/python -m pip install dist/*.whl
50
+ /tmp/bc-lantern-wheel/bin/bcl --help
51
+ - name: Test the source distribution
52
+ run: |
53
+ python -m venv /tmp/bc-lantern-sdist
54
+ /tmp/bc-lantern-sdist/bin/python -m pip install dist/*.tar.gz
55
+ /tmp/bc-lantern-sdist/bin/bcl --help
56
+ - uses: actions/upload-artifact@v4
57
+ with:
58
+ name: python-package-distributions
59
+ path: dist/
60
+ if-no-files-found: error
61
+
62
+ publish:
63
+ name: Publish distributions
64
+ needs: build
65
+ runs-on: ubuntu-latest
66
+ environment:
67
+ name: pypi
68
+ url: https://pypi.org/project/bc-lantern/
69
+ permissions:
70
+ id-token: write
71
+
72
+ steps:
73
+ - uses: actions/download-artifact@v4
74
+ with:
75
+ name: python-package-distributions
76
+ path: dist/
77
+ - name: Publish distributions to PyPI
78
+ uses: pypa/gh-action-pypi-publish@v1.14.2
@@ -0,0 +1,26 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ test:
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, windows-latest]
15
+ python-version: ["3.10", "3.13"]
16
+ runs-on: ${{ matrix.os }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ cache: pip
24
+ - run: python -m pip install -e ".[dev]"
25
+ - run: python -m pytest
26
+ - run: bcl docs sync --check
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ .pytest_cache/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ app-json.json
9
+ object-range-report*.json
10
+ object-range-report*.md
11
+ .smoke-output/
@@ -0,0 +1,15 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome through GitHub issues and pull requests.
4
+
5
+ ## Development
6
+
7
+ 1. Fork and clone the repository.
8
+ 2. Create a focused branch.
9
+ 3. Install the project with `python -m pip install -e ".[dev]"`.
10
+ 4. Make the change and add or update tests.
11
+ 5. Run `python -m pytest` and `bcl docs sync --check`.
12
+ 6. Open a pull request that explains the behavior change.
13
+
14
+ Keep generated aggregate and report files out of commits. By submitting a
15
+ contribution, you agree that it is licensed under this repository's MIT License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oliver Schulz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.5
2
+ Name: bc-lantern
3
+ Version: 0.7.0
4
+ Summary: A growing toolbox for Business Central and AL projects
5
+ Project-URL: Homepage, https://github.com/SchulzOli/bc-lantern
6
+ Project-URL: Documentation, https://github.com/SchulzOli/bc-lantern#readme
7
+ Project-URL: Issues, https://github.com/SchulzOli/bc-lantern/issues
8
+ Project-URL: Source, https://github.com/SchulzOli/bc-lantern
9
+ Author: Oliver Schulz
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: al,business-central,cli,github
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
24
+ Provides-Extra: dev
25
+ Requires-Dist: build>=1.2; extra == 'dev'
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Requires-Dist: twine>=6; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # BC Lantern
31
+
32
+ BC Lantern is a Python command-line toolbox for Microsoft Dynamics 365 Business Central
33
+ and AL projects.
34
+
35
+ It can:
36
+
37
+ - collect `app.json` manifests from GitHub repositories that contain AL code;
38
+ - cache manifests and download only changed files;
39
+ - compare declared object ranges with a central allocation file;
40
+ - report reservations, free ranges, conflicts, and ranges outside the allocation;
41
+ - write object-range reports as JSON or Markdown.
42
+
43
+ ## Requirements
44
+
45
+ - Python 3.10 or later
46
+ - [GitHub CLI](https://cli.github.com/) for `app-json retrieve`
47
+ - Git for installation directly from GitHub
48
+
49
+ Authenticate GitHub CLI before you collect manifests:
50
+
51
+ ```text
52
+ gh auth login
53
+ ```
54
+
55
+ The authenticated account controls access to private repositories.
56
+
57
+ ## Install
58
+
59
+ ### Install from PyPI
60
+
61
+ Use `pipx` to install BC Lantern in an isolated environment:
62
+
63
+ ```text
64
+ pipx install bc-lantern
65
+ ```
66
+
67
+ You can also use pip:
68
+
69
+ ```text
70
+ python -m pip install bc-lantern
71
+ ```
72
+
73
+ Upgrade an existing installation:
74
+
75
+ ```text
76
+ pipx upgrade bc-lantern
77
+ ```
78
+
79
+ ### Install from GitHub
80
+
81
+ Install a specific release tag before or without a PyPI release:
82
+
83
+ ```text
84
+ python -m pip install "bc-lantern @ git+https://github.com/SchulzOli/bc-lantern.git@v0.7.0"
85
+ ```
86
+
87
+ Use a tag or full commit SHA in automated builds. Do not install from `main` in
88
+ a reproducible pipeline.
89
+
90
+ Verify the installation:
91
+
92
+ ```text
93
+ bcl --help
94
+ ```
95
+
96
+ ## Quick start
97
+
98
+ ### 1. Collect `app.json` manifests
99
+
100
+ Collect manifests from the repositories of the authenticated GitHub account:
101
+
102
+ ```text
103
+ bcl app-json retrieve
104
+ ```
105
+
106
+ Collect manifests from a specified user or organization:
107
+
108
+ ```text
109
+ bcl app-json retrieve \
110
+ --owner my-organization \
111
+ --output app-json.json
112
+ ```
113
+
114
+ BC Lantern excludes archived repositories by default. Add `--include-archived` to
115
+ include them.
116
+
117
+ The command writes one aggregate JSON file. It does not create repository
118
+ folders or separate manifest files.
119
+
120
+ ### 2. Create an allocation file
121
+
122
+ Create an `object_ranges.json` file with named allocations:
123
+
124
+ ```json
125
+ {
126
+ "My team": {
127
+ "ranges": [
128
+ { "from": 1000000, "to": 1000999 }
129
+ ]
130
+ }
131
+ }
132
+ ```
133
+
134
+ Allocation ranges are inclusive. Reference allocations must not overlap.
135
+
136
+ ### 3. Create an object-range report
137
+
138
+ Compare the collected manifests with the allocation file:
139
+
140
+ ```text
141
+ bcl object-ranges report \
142
+ --app-json app-json.json \
143
+ --reference object_ranges.json \
144
+ --output object-range-report.json
145
+ ```
146
+
147
+ Create a Markdown report:
148
+
149
+ ```text
150
+ bcl object-ranges report \
151
+ --reference object_ranges.json \
152
+ --output object-range-report.md \
153
+ --output-format markdown
154
+ ```
155
+
156
+ `--app-json` defaults to `app-json.json`. The JSON output defaults to
157
+ `object-range-report.json`.
158
+
159
+ The report compares declared reservations. It does not scan AL source files for
160
+ implemented object IDs.
161
+
162
+ ## Range filters
163
+
164
+ BC Lantern classifies declared ranges with these Business Central categories:
165
+
166
+ | Type | Inclusive IDs |
167
+ |---|---:|
168
+ | `base` | 0-49,999 |
169
+ | `customization` | 50,000-99,999 |
170
+ | `localization` | 100,000-999,999 |
171
+ | `rsp` | 1,000,000-69,999,999 |
172
+ | `app` | 70,000,000-74,999,999 |
173
+ | `unclassified` | 75,000,000 and above |
174
+
175
+ Hide a category from report details but keep it in calculations:
176
+
177
+ ```text
178
+ bcl object-ranges report \
179
+ --reference object_ranges.json \
180
+ --hide-range-type rsp
181
+ ```
182
+
183
+ Remove a category from all calculations:
184
+
185
+ ```text
186
+ bcl object-ranges report \
187
+ --reference object_ranges.json \
188
+ --ignore-range-type customization
189
+ ```
190
+
191
+ Both options are repeatable. Use `--conflict-range-type` to replace the default
192
+ set of conflict-enabled categories. By default, all categories except
193
+ `customization` participate in conflict detection.
194
+
195
+ See the [CLI reference](docs/cli-reference.md) for every command and option.
196
+
197
+ ## Cache
198
+
199
+ BC Lantern caches GitHub metadata and manifests by default:
200
+
201
+ ```text
202
+ Windows: %LOCALAPPDATA%\bc-lantern\cache
203
+ macOS: ~/Library/Caches/bc-lantern
204
+ Linux: ${XDG_CACHE_HOME:-~/.cache}/bc-lantern
205
+ ```
206
+
207
+ Force a complete scan:
208
+
209
+ ```text
210
+ bcl app-json retrieve --refresh
211
+ ```
212
+
213
+ Disable the cache:
214
+
215
+ ```text
216
+ bcl app-json retrieve --no-cache
217
+ ```
218
+
219
+ Set another cache directory:
220
+
221
+ ```text
222
+ bcl app-json retrieve --cache-dir path/to/cache
223
+ ```
224
+
225
+ ## Pipeline example
226
+
227
+ Pin the package version in a pipeline:
228
+
229
+ ```yaml
230
+ steps:
231
+ - uses: actions/checkout@v4
232
+
233
+ - uses: actions/setup-python@v5
234
+ with:
235
+ python-version: "3.13"
236
+
237
+ - run: python -m pip install bc-lantern==0.7.0
238
+
239
+ - run: >-
240
+ bcl object-ranges report
241
+ --app-json app-json.json
242
+ --reference object_ranges.json
243
+ --output object-range-report.json
244
+ ```
245
+
246
+ The pipeline must provide `app-json.json` and `object_ranges.json`. Alternatively,
247
+ run `app-json retrieve` first and authenticate GitHub CLI in the pipeline.
248
+
249
+ ## PowerShell example
250
+
251
+ [`example.ps1`](example.ps1) collects manifests and creates several reports:
252
+
253
+ ```powershell
254
+ .\example.ps1 `
255
+ -Owner my-organization `
256
+ -Reference C:\path\to\object_ranges.json
257
+ ```
258
+
259
+ Generated aggregates and reports are ignored by Git. They can contain repository
260
+ metadata.
261
+
262
+ ## Development
263
+
264
+ Install the project and its development tools:
265
+
266
+ ```text
267
+ python -m pip install -e ".[dev]"
268
+ ```
269
+
270
+ Run the tests:
271
+
272
+ ```text
273
+ python -m pytest
274
+ ```
275
+
276
+ Check the generated CLI reference:
277
+
278
+ ```text
279
+ bcl docs sync --check
280
+ ```
281
+
282
+ Use `bcl docs sync` after you change a command or option.
283
+
284
+ ## Project information
285
+
286
+ - [CLI reference](docs/cli-reference.md)
287
+ - [Contributing guide](CONTRIBUTING.md)
288
+ - [Security policy](SECURITY.md)
289
+ - [PyPI publishing guide](docs/publishing.md)
290
+ - [MIT License](LICENSE)
@@ -0,0 +1,261 @@
1
+ # BC Lantern
2
+
3
+ BC Lantern is a Python command-line toolbox for Microsoft Dynamics 365 Business Central
4
+ and AL projects.
5
+
6
+ It can:
7
+
8
+ - collect `app.json` manifests from GitHub repositories that contain AL code;
9
+ - cache manifests and download only changed files;
10
+ - compare declared object ranges with a central allocation file;
11
+ - report reservations, free ranges, conflicts, and ranges outside the allocation;
12
+ - write object-range reports as JSON or Markdown.
13
+
14
+ ## Requirements
15
+
16
+ - Python 3.10 or later
17
+ - [GitHub CLI](https://cli.github.com/) for `app-json retrieve`
18
+ - Git for installation directly from GitHub
19
+
20
+ Authenticate GitHub CLI before you collect manifests:
21
+
22
+ ```text
23
+ gh auth login
24
+ ```
25
+
26
+ The authenticated account controls access to private repositories.
27
+
28
+ ## Install
29
+
30
+ ### Install from PyPI
31
+
32
+ Use `pipx` to install BC Lantern in an isolated environment:
33
+
34
+ ```text
35
+ pipx install bc-lantern
36
+ ```
37
+
38
+ You can also use pip:
39
+
40
+ ```text
41
+ python -m pip install bc-lantern
42
+ ```
43
+
44
+ Upgrade an existing installation:
45
+
46
+ ```text
47
+ pipx upgrade bc-lantern
48
+ ```
49
+
50
+ ### Install from GitHub
51
+
52
+ Install a specific release tag before or without a PyPI release:
53
+
54
+ ```text
55
+ python -m pip install "bc-lantern @ git+https://github.com/SchulzOli/bc-lantern.git@v0.7.0"
56
+ ```
57
+
58
+ Use a tag or full commit SHA in automated builds. Do not install from `main` in
59
+ a reproducible pipeline.
60
+
61
+ Verify the installation:
62
+
63
+ ```text
64
+ bcl --help
65
+ ```
66
+
67
+ ## Quick start
68
+
69
+ ### 1. Collect `app.json` manifests
70
+
71
+ Collect manifests from the repositories of the authenticated GitHub account:
72
+
73
+ ```text
74
+ bcl app-json retrieve
75
+ ```
76
+
77
+ Collect manifests from a specified user or organization:
78
+
79
+ ```text
80
+ bcl app-json retrieve \
81
+ --owner my-organization \
82
+ --output app-json.json
83
+ ```
84
+
85
+ BC Lantern excludes archived repositories by default. Add `--include-archived` to
86
+ include them.
87
+
88
+ The command writes one aggregate JSON file. It does not create repository
89
+ folders or separate manifest files.
90
+
91
+ ### 2. Create an allocation file
92
+
93
+ Create an `object_ranges.json` file with named allocations:
94
+
95
+ ```json
96
+ {
97
+ "My team": {
98
+ "ranges": [
99
+ { "from": 1000000, "to": 1000999 }
100
+ ]
101
+ }
102
+ }
103
+ ```
104
+
105
+ Allocation ranges are inclusive. Reference allocations must not overlap.
106
+
107
+ ### 3. Create an object-range report
108
+
109
+ Compare the collected manifests with the allocation file:
110
+
111
+ ```text
112
+ bcl object-ranges report \
113
+ --app-json app-json.json \
114
+ --reference object_ranges.json \
115
+ --output object-range-report.json
116
+ ```
117
+
118
+ Create a Markdown report:
119
+
120
+ ```text
121
+ bcl object-ranges report \
122
+ --reference object_ranges.json \
123
+ --output object-range-report.md \
124
+ --output-format markdown
125
+ ```
126
+
127
+ `--app-json` defaults to `app-json.json`. The JSON output defaults to
128
+ `object-range-report.json`.
129
+
130
+ The report compares declared reservations. It does not scan AL source files for
131
+ implemented object IDs.
132
+
133
+ ## Range filters
134
+
135
+ BC Lantern classifies declared ranges with these Business Central categories:
136
+
137
+ | Type | Inclusive IDs |
138
+ |---|---:|
139
+ | `base` | 0-49,999 |
140
+ | `customization` | 50,000-99,999 |
141
+ | `localization` | 100,000-999,999 |
142
+ | `rsp` | 1,000,000-69,999,999 |
143
+ | `app` | 70,000,000-74,999,999 |
144
+ | `unclassified` | 75,000,000 and above |
145
+
146
+ Hide a category from report details but keep it in calculations:
147
+
148
+ ```text
149
+ bcl object-ranges report \
150
+ --reference object_ranges.json \
151
+ --hide-range-type rsp
152
+ ```
153
+
154
+ Remove a category from all calculations:
155
+
156
+ ```text
157
+ bcl object-ranges report \
158
+ --reference object_ranges.json \
159
+ --ignore-range-type customization
160
+ ```
161
+
162
+ Both options are repeatable. Use `--conflict-range-type` to replace the default
163
+ set of conflict-enabled categories. By default, all categories except
164
+ `customization` participate in conflict detection.
165
+
166
+ See the [CLI reference](docs/cli-reference.md) for every command and option.
167
+
168
+ ## Cache
169
+
170
+ BC Lantern caches GitHub metadata and manifests by default:
171
+
172
+ ```text
173
+ Windows: %LOCALAPPDATA%\bc-lantern\cache
174
+ macOS: ~/Library/Caches/bc-lantern
175
+ Linux: ${XDG_CACHE_HOME:-~/.cache}/bc-lantern
176
+ ```
177
+
178
+ Force a complete scan:
179
+
180
+ ```text
181
+ bcl app-json retrieve --refresh
182
+ ```
183
+
184
+ Disable the cache:
185
+
186
+ ```text
187
+ bcl app-json retrieve --no-cache
188
+ ```
189
+
190
+ Set another cache directory:
191
+
192
+ ```text
193
+ bcl app-json retrieve --cache-dir path/to/cache
194
+ ```
195
+
196
+ ## Pipeline example
197
+
198
+ Pin the package version in a pipeline:
199
+
200
+ ```yaml
201
+ steps:
202
+ - uses: actions/checkout@v4
203
+
204
+ - uses: actions/setup-python@v5
205
+ with:
206
+ python-version: "3.13"
207
+
208
+ - run: python -m pip install bc-lantern==0.7.0
209
+
210
+ - run: >-
211
+ bcl object-ranges report
212
+ --app-json app-json.json
213
+ --reference object_ranges.json
214
+ --output object-range-report.json
215
+ ```
216
+
217
+ The pipeline must provide `app-json.json` and `object_ranges.json`. Alternatively,
218
+ run `app-json retrieve` first and authenticate GitHub CLI in the pipeline.
219
+
220
+ ## PowerShell example
221
+
222
+ [`example.ps1`](example.ps1) collects manifests and creates several reports:
223
+
224
+ ```powershell
225
+ .\example.ps1 `
226
+ -Owner my-organization `
227
+ -Reference C:\path\to\object_ranges.json
228
+ ```
229
+
230
+ Generated aggregates and reports are ignored by Git. They can contain repository
231
+ metadata.
232
+
233
+ ## Development
234
+
235
+ Install the project and its development tools:
236
+
237
+ ```text
238
+ python -m pip install -e ".[dev]"
239
+ ```
240
+
241
+ Run the tests:
242
+
243
+ ```text
244
+ python -m pytest
245
+ ```
246
+
247
+ Check the generated CLI reference:
248
+
249
+ ```text
250
+ bcl docs sync --check
251
+ ```
252
+
253
+ Use `bcl docs sync` after you change a command or option.
254
+
255
+ ## Project information
256
+
257
+ - [CLI reference](docs/cli-reference.md)
258
+ - [Contributing guide](CONTRIBUTING.md)
259
+ - [Security policy](SECURITY.md)
260
+ - [PyPI publishing guide](docs/publishing.md)
261
+ - [MIT License](LICENSE)