Debian Codegraph @

docs/guide/users/checking.md

raw symbols SCIP
1 # Checking APIs
2
3 Griffe is able to compare two snapshots of your project to detect API breakages between the old and the new snapshot. By snapshot we mean a specific point in your Git history. For example, you can ask Griffe to compare your current code against a specific tag.
4
5 ## Command-line
6
7 ### Using Git
8
9 By default, Griffe will compare the current code to the latest tag:
10
11 ```console
12 $ griffe check mypackage
13 ```
14
15 To specify another Git reference to check against, use the `--against` or `-a` option:
16
17 ```console
18 $ griffe check mypackage -a 0.2.0
19 ```
20
21 You can specify a Git tag, commit (hash), or even a branch: Griffe will create a worktree at this reference in a temporary directory, and clean it up after finishing.
22
23 If you want to also specify the *base* reference to use (instead of the current code), use the `--base` or `-b` option. Some examples:
24
25 ```console
26 $ griffe check mypackage -b HEAD -a 2.0.0
27 $ griffe check mypackage -b 2.0.0 -a 1.0.0
28 $ griffe check mypackage -b fix-issue-90 -a 1.2.3
29 $ griffe check mypackage -b 8afcfd6e
30 ```
31
32 TIP: **Important:** Remember that the base is the most recent reference, and the one we compare it against is the oldest one.
33
34 The package name you pass to `griffe check` must be found relative to the repository root. For Griffe to find packages in subfolders, pass the parent subfolder to the `--search` or `-s` option. Example for `src`-layouts:
35
36 ```console
37 $ griffe check -s src griffe
38 ```
39
40 Example in a monorepo, within a deeper file tree:
41
42 ```console
43 $ griffe check -s back/services/identity-provider/src identity_provider
44 ```
45
46 ### Using PyPI
47
48 It's also possible to directly **check packages from PyPI.org** (or other indexes configured through `PIP_INDEX_URL`). This feature requires that you install Griffe with the `pypi` extra:
49
50 ```console
51 $ pip install griffe[pypi]
52 ```
53
54 The command syntax is:
55
56 ```console
57 $ griffe check package_name -b project-name==2.0 -a project-name==1.0
58 ```
59
60 You can let Griffe guess the package name by passing an empty string:
61
62 ```console
63 $ griffe check "" -b project-name==2.0 -a project-name==1.0
64 ```
65
66 [PEP 508 version specifiers](https://peps.python.org/pep-0508/) are supported (`<`, `<=`, `!=`, `==`, `>=`, `>`, `~=`). For example, to compare v2 against the version just before it:
67
68 ```console
69 $ griffe check "" -b project-name==2.0 -a project-name<2.0
70 ```
71
72 Without a version specifier on the base reference, or without a base reference at all, Griffe will use the latest available version. The two following commands compare the latest version against v1:
73
74 ```console
75 $ griffe check "" -b project-name -a project-name==1.0
76 $ griffe check "" -a project-name==1.0
77 ```
78
79 Griffe will actually install packages in a cache directory. It means a few things: source distributions are supported, and only packages that are compatible with your current environment can be checked.
80
81 ## Python API
82
83 To programmatically check for API breaking changes, you have to load two snapshots of your code base, for example using our [`load_git()`][griffe.load_git] utility, and then passing them both to the [`find_breaking_changes()`][griffe.find_breaking_changes] function. This function will yield instances of [`Breakage`][griffe.Breakage]. It's up to you how you want to use these breakage instances.
84
85 ```python
86 import griffe
87
88 my_pkg_v1 = griffe.load_git("my_pkg", ref="v1")
89 my_pkg_v2 = griffe.load_git("my_pkg", ref="v2")
90
91 for breaking_change in find_breaking_changes(my_pkg_v1, my_pkg_v2):
92 print(breaking_change.explain())
93 ```
94
95 ## In CI
96
97 It is of course possible to Griffe in CI (Continuous Integration) to make sure no breaking changes are introduced in pull/merge requests.
98
99 ### GitHub {#ci-github}
100
101 Here is a quick example on how to use Griffe in a GitHub workflow:
102
103 ```yaml
104 jobs:
105 check-api:
106 runs-on: ubuntu-latest
107 steps:
108 - uses: actions/checkout@v5
109 with:
110 fetch-depth: 0 # We the need the full Git history.
111 - uses: astral-sh/setup-uv@v6
112 # The following command will compare current changes to latest tag.
113 - run: uvx griffe check --search src --format github your_package_name
114 ```
115
116 The last step will fail the workflow if any breaking change is found.
117
118 ### Azure Pipelines {#ci-azdo}
119
120 Here is a quick example on how to use Griffe in an Azure Pipeline. Griffe can format its output using Azure DevOps [task logging commands](https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#task-commands), similar to GitHub Actions messages:
121
122 ```yaml
123 jobs:
124 - name: check-api
125 pool:
126 vmImage: 'ubuntu-latest'
127 steps:
128 - checkout: self
129 fetchDepth: 0 # We the need the full Git history.
130 - task: CmdLine@2
131 inputs:
132 script: pip install --user griffe
133 - task: CmdLine@2
134 inputs:
135 # The following command will compare current changes to latest tag.
136 script: |
137 griffe check --search src --format azdo your_package_name
138 ```
139
140 The last step will fail the workflow if any breaking change is found.
141
142 ## Detected breakages
143
144 In this section, we will describe the breakages that Griffe detects, giving some code examples and hints on how to properly communicate breakages with deprecation messages before actually releasing them.
145
146 Obviously, these explanations and the value of the hints we provide depend on your definition of what is a public Python API. There is no clear and generally agreed upon definition of "public Python API". A public Python API might vary from one project to another. In essence, your public API is what you say it is.
147
148 However, we do have conventions like prefixing objects with an underscore to tell users these objects are part of the private API, or internals, and therefore should not be used. For the rest, Griffe can detect changes that *will* trigger immediate errors in your users code', and changes that *might* cause issues in your users' code. Although the latter sound less impactful, they do have a serious impact, because they can *silently* change the behavior of your users' code, leading to issues that are hard to detect, understand and fix.
149
150 [Knowing that every change is a breaking change](https://xkcd.com/1172/), the more we detect and document (potentially) breaking changes in our changelogs, the better.
151
152 ### Parameter moved
153
154 > Positional parameter was moved.
155
156 Moving the order of positional parameters can *silently* break your users' code.
157
158 ```python title="before"
159 # your code
160 def greet(prefix, name):
161 print(prefix + " " + name)
162
163 # user's code
164 greet("hello", "world")
165 ```
166
167 ```python title="after"
168 # your code
169 def greet(name, prefix):
170 print(prefix + " " + name)
171
172 # user's code: no immediate error, broken behavior
173 greet("hello", "world")
174 ```
175
176 NOTE: Moving required parameters around is not really an API breakage, depending on our definition of API, since this won't raise immediate errors like `TypeError`. The function expects a number of arguments, and the developer passes it this same number of arguments: the contract is fulfilled. But parameters very often have specific meaning, and changing their order will *silently lead* (no immediate error) to incorrect behavior, potentially making it difficult to detect, understand and fix the issue. That is why it is important to warn developers about such changes.
177
178 > TIP: **Hint**
179 > If you often add, move or remove parameters, consider making them keyword-only, so that their order doesn't matter.
180 >
181 > ```python title="before"
182 > def greet(*, prefix, name):
183 > print(prefix + " " + name)
184 >
185 > greet(prefix="hello", name="world")
186 > ```
187 >
188 > ```python title="after"
189 > def greet(*, name, prefix):
190 > print(prefix + " " + name)
191 >
192 > # still working as expected
193 > greet(prefix="hello", name="world")
194 > ```
195
196 ### Parameter removed
197
198 > Parameter was removed.
199
200 Removing a parameter can immediately break your users' code.
201
202 ```python title="before"
203 # your code
204 def greet(prefix, name):
205 print(prefix + " " + name)
206
207 # user's code
208 greet("hello", "world")
209 ```
210
211 ```python title="after"
212 # your code
213 def greet(name):
214 print("hello " + name)
215
216 # user's code: immediate error
217 greet("hello", "world")
218
219 # even with keyword parameters: immediate error
220 greet(prefix="hello", name="world")
221 ```
222
223 > TIP: **Hint**
224 > Allow a deprecation period for the removed parameter by swallowing it in a variadic positional parameter, a variadic keyword parameter, or both.
225 >
226 > === "positional-only"
227 > ```python title="before"
228 > # your parameters are positional-only parameters (difficult deprecation)
229 > def greet(prefix, name, /):
230 > print(prefix + " " + name)
231 >
232 > greet("hello", "world")
233 > ```
234 >
235 > ```python title="after"
236 > # swallow prefix using a variadic positional parameter
237 > def greet(*args):
238 > if len(args) == 2:
239 > prefix, name = args
240 > elif len(args) == 1:
241 > prefix = None
242 > name = args[0]
243 > else:
244 > raise ValueError("missing parameter 'name'")
245 > if prefix is not None:
246 > warnings.warn(DeprecationWarning, "prefix is deprecated")
247 > print("hello " + name)
248 >
249 > # still working as expected
250 > greet("hello", "world")
251 > ```
252 >
253 > === "keyword-only"
254 > ```python title="before"
255 > # your parameters are keyword-only parameters (easy deprecation)
256 > def greet(*, prefix, name):
257 > print(prefix + " " + name)
258 >
259 > greet(prefix="hello", name="world")
260 > ```
261 >
262 > ```python title="after"
263 > # swallow prefix using a variadic keyword parameter
264 > def greet(name, **kwargs):
265 > prefix = kwargs.get("prefix", None)
266 > if prefix is not None:
267 > warnings.warn(DeprecationWarning, "prefix is deprecated")
268 > print("hello " + name)
269 >
270 > # still working as expected
271 > greet(prefix="hello", name="world")
272 > ```
273 >
274 > === "positional or keyword"
275 > ```python title="before"
276 > # your parameters are positional or keyword parameters (very difficult deprecation)
277 > def greet(prefix, name):
278 > print(prefix + " " + name)
279 >
280 > greet("hello", name="world")
281 > ```
282 >
283 > ```python title="after"
284 > # no other choice than swallowing both forms...
285 > # ignoring the deprecated parameter becomes quite complex
286 > def greet(*args, **kwargs):
287 > if len(args) == 2:
288 > prefix, name = args
289 > elif len(args) == 1:
290 > prefix = None
291 > name = args[0]
292 > if "name" in kwargs:
293 > name = kwargs["name"]
294 > if "prefix" in kwargs:
295 > prefix = kwargs["prefix"]
296 > if prefix is not None:
297 > warnings.warn(DeprecationWarning, "prefix is deprecated")
298 > print("hello " + name)
299 >
300 > # still working as expected
301 > greet("hello", "world")
302 > greet("hello", name="world")
303 > greet(prefix="hello", name="world")
304 > ```
305
306 ### Parameter changed kind
307
308 > Parameter kind was changed
309
310 Changing the kind of a parameter to another (positional-only, keyword-only, positional or keyword, variadic positional, variadic keyword) can immediately break your users' code.
311
312 ```python title="before"
313 # your code
314 def greet(name):
315 print("hello " + name)
316
317 def greet2(name):
318 print("hello " + name)
319
320 # user's code: all working fine
321 greet("tim")
322 greet(name="tim")
323 greet2("tim")
324 greet2(name="tim")
325 ```
326
327 ```python title="after"
328 # your code
329 def greet(name, /):
330 print("hello " + name)
331
332 def greet2(*, name):
333 print("hello " + name)
334
335 # user's code: working as expected
336 greet("tim")
337 greet2(name="tim")
338
339 # immediate error
340 greet(name="tim")
341 greet2("tim")
342 ```
343
344 > TIP: **Hint**
345 > Although it actually is a breaking change, changing your positional or keyword parameters' kind to keyword-only makes your public function more robust to future changes (forward-compatibility).
346 >
347 > For functions with lots of optional parameters, and a few (one or two) required parameters, it can be a good idea to accept the required parameters as positional or keyword, while accepting the optional parameters as keyword-only parameters:
348 >
349 > ```python
350 > def greet(name, *, punctuation=False, bold=False, italic=False):
351 > ...
352 >
353 > # simple cases are easy to write
354 > greet("tim")
355 > greet("tiff")
356 >
357 > # complex cases are never ambiguous
358 > greet("tim", italic=True, bold=True)
359 > greet(name="tiff", bold=True, punctuation=True)
360 > ```
361 >
362 > Positional-only parameters are useful in some specific cases, such as when a function takes two or more numeric values, and their order does not matter, and naming the parameters would not make sense:
363 >
364 > ```python
365 > def multiply3(a, b, c, /):
366 > return a * b * c
367 >
368 > # all the following are equivalent
369 > multiply3(4, 2, 3)
370 > multiply3(4, 3, 2)
371 > multiply3(2, 3, 4)
372 > # etc.
373 > ```
374
375 ### Parameter changed default
376
377 > Parameter default was changed
378
379 Changing the default value of a parameter can *silently* break your users' code.
380
381 ```python title="before"
382 # your code
383 def compute_something(value: int, to_float=True):
384 value = ...
385 if to_float:
386 return float(value)
387 return value
388
389 # user's code: condition is entered
390 if isinstance(compute_something(7), float):
391 ...
392 ```
393
394 ```python title="after"
395 # your code
396 def compute_something(value: int, to_float=False):
397 value = ...
398 if to_float:
399 return float(value)
400 return value
401
402 # user's code: condition is not entered anymore
403 if isinstance(compute_something(7), float):
404 ...
405 ```
406
407 NOTE: Changing default value of parameters is not really an API breakage, depending on our definition of API, since this won't raise immediate errors like `TypeError`. Not using the parameter still provides the argument with a default value: the contract is fulfilled. But default values very often have specific meaning, and changing them will *silently lead* (no immediate error) to incorrect behavior, potentially making it difficult to detect, understand and fix the issue. That is why it is important to warn developers about such changes.
408
409 > TIP: **Hint**
410 > Allow a deprecation period for the old default value by using a sentinel value to detect when the parameter wasn't used by the user:
411 >
412 > ```python title="in the coming release"
413 > _sentinel = object()
414 >
415 > def compute_something(value: int, to_float=_sentinel):
416 > value = ...
417 > if to_float is _sentinel:
418 > to_float = True
419 > warnings.warn(
420 > DeprecationWarning,
421 > "default value of 'to_float' will change from True to False, "
422 > "please provide 'to_float=True' if you want to retain the current behavior"
423 > )
424 > if to_float:
425 > return float(value)
426 > return value
427 > ```
428 >
429 > In a later release you can remove the sentinel, the deprecation warning, and set `False` as default to `to_float`.
430 >
431 > ```python title="in a later release"
432 > def compute_something(value: int, to_float=False):
433 > value = ...
434 > if to_float:
435 > return float(value)
436 > return value
437 > ```
438
439 ### Parameter changed required
440
441 > Parameter is now required
442
443 Changing an optional parameter to a required one (by removing its default value) can immediately break your users' code.
444
445 ```python title="before"
446 # your code
447 def greet(name, prefix="hello"):
448 print(prefix + " " + name)
449
450 # user's code
451 greet("tiff")
452 ```
453
454 ```python title="after"
455 # your code
456 def greet(name, prefix):
457 print(prefix + " " + name)
458
459 # user's code: immediate error
460 greet("tiff")
461 ```
462
463 > TIP: **Hint**
464 > Allow a deprecation period for the default value by using a sentinel value to detect when the parameter wasn't used by the user:
465 >
466 > ```python title="in the coming release"
467 > _sentinel = object()
468 >
469 > def greet(name, prefix=_sentinel):
470 > if prefix is _sentinel:
471 > prefix = "hello"
472 > warnings.warn(DeprecationWarning, "'prefix' will become required in the next release")
473 > print(prefix + " " + name)
474 > ```
475 >
476 > In a later release you can remove the sentinel, the deprecation warning, and the default value of `prefix`.
477 >
478 > ```python title="in a later release"
479 > def greet(name, prefix):
480 > print(prefix + " " + name)
481 > ```
482
483 ### Parameter added required
484
485 > Parameter was added as required
486
487 Adding a new, required parameter can immediately break your users' code.
488
489 ```python title="before"
490 # your code
491 def greet(name):
492 print("hello " + name)
493
494 # user's code
495 greet("tiff")
496 ```
497
498 ```python title="after"
499 # your code
500 def greet(name, prefix):
501 print(prefix + " " + name)
502
503 # user's code: immediate error
504 greet("tiff")
505 ```
506
507 > TIP: **Hint**
508 > You can delay (or avoid) and inform your users about the upcoming breakage by temporarily (or permanently) providing a default value for the new parameter:
509 >
510 > ```python title="in the coming release"
511 > def greet(name, prefix="hello"):
512 > print(prefix + " " + name)
513 > ```
514
515 ### Return changed type
516
517 > Return types are incompatible
518
519 WARNING: **Not yet supported!** Telling if a type construct is compatible with another one is not trivial, especially statically. Support for this will be implemented later.
520
521 ### Object removed
522
523 > Public object was removed
524
525 Removing a public object from a module can immediately break your users' code.
526
527 ```python title="before"
528 # your/module.py
529 special_thing = "hey"
530
531 # user/module.py
532 from your.module import special_thing
533
534 # other/user/module.py
535 from your import module
536 print(module.special_thing)
537 ```
538
539 ```python title="after"
540 # user/module.py: import error
541 from your.module import special_thing
542
543 # other/user/module.py: attribute error
544 from your import module
545 print(module.special_thing)
546 ```
547
548 > TIP: **Hint**
549 > Allow a deprecation period by declaring a module-level `__getattr__` function that returns the given object while warning about its deprecation:
550 >
551 > ```python
552 > def __getattr__(name):
553 > if name == "special_thing":
554 > warnings.warn(DeprecationWarning, "'special_thing' is deprecated and will be removed")
555 > return "hey"
556 > ```
557
558 ### Object changed kind
559
560 > Public object points to a different kind of object
561
562 Changing the kind (type alias, attribute, function, class, module) of a public object can *silently* break your users' code.
563
564 ```python title="before"
565 # your code
566 class Factory:
567 def __call__(self, ...):
568 ...
569
570 factory = Factory(...)
571
572 # user's code: condition is entered
573 if isinstance(factory, Factory):
574 ...
575 ```
576
577 ```python title="after"
578 # your code
579 class Factory:
580 ...
581
582 def factory(...):
583 ...
584
585 # user's code: condition is not entered anymore
586 if isinstance(factory, Factory):
587 ...
588 ```
589
590 NOTE: Changing the kind of an object is not really an API breakage, depending on our definition of API, since this won't always raise immediate errors like `TypeError`. The object is still here and accessed: the contract is fulfilled. But developers sometimes rely on the kind of an object, so changing it will lead to incorrect behavior, potentially making it difficult to detect, understand and fix the issue. That is why it is important to warn developers about such changes.
591
592 ### Attribute changed type
593
594 > Attribute types are incompatible
595
596 WARNING: **Not yet supported!** Telling if a type construct is compatible with another one is not trivial, especially statically. Support for this will be implemented later.
597
598 ### Attribute changed value
599
600 > Attribute value was changed
601
602 Changing the value of an attribute can *silently* break your users' code.
603
604 ```python title="before"
605 # your code
606 PY_VERSION = os.getenv("PY_VERSION")
607
608 # user's code: condition is entered
609 if PY_VERSION is None:
610 ...
611 ```
612
613 ```python title="after"
614 # your code
615 PY_VERSION = os.getenv("PY_VERSION", "3.8")
616
617 # user's code: condition is not entered anymore
618 if PY_VERSION is None:
619 ...
620 ```
621
622 NOTE: Changing the value of an attribute is not really an API breakage, depending on our definition of API, since this won't raise immediate errors like `TypeError`. The attribute is still here and accessed: the contract is fulfilled. But developers heavily rely on the value of public attributes, so changing it will lead to incorrect behavior, potentially making it difficult to detect, understand and fix the issue. That is why it is important to warn developers about such changes.
623
624 TIP: **Hint**
625 Make sure to document the change of value of the attribute in your changelog, particularly the previous and new range of values it can take.
626
627 ### Class removed base
628
629 > Base class was removed
630
631 Removing a class from another class' bases can *silently* break your users' code.
632
633 ```python title="before"
634 # your code
635 class A: ...
636 class B: ...
637 class C(A, B): ...
638
639 # user's code: condition is entered
640 if B in klass.__bases__:
641 ...
642 ```
643
644 ```python title="after"
645 # your code
646 class A: ...
647 class B: ...
648 class C(A): ...
649
650 # user's code: condition is not entered anymore
651 if B in klass.__bases__:
652 ...
653 ```
654
655 NOTE: Unless inherited members are lost in the process, removing a class base is not really an API breakage, depending on our definition of API, since this won't raise immediate errors like `TypeError`. The class is here, its members as well: the contract is fulfilled. But developers sometimes rely on the actual bases of a class, so changing them will lead to incorrect behavior, potentially making it difficult to detect, understand and fix the issue. That is why it is important to warn developers about such changes.
656
657 ## Output style
658
659 Griffe supports writing detected breakages in multiple formats, or styles.
660
661 [](){#format-oneline}
662
663 ### One-line
664
665 - **CLI**: `-f oneline` / no flags
666 - **API**: `check(...)` / `check(..., style="oneline")` / `check(..., style=ExplanationStyle.ONE_LINE)`
667
668 This is the default format. Griffe will print each detected breakage on a single line:
669
670 ```console exec="1" source="console" result="ansi" returncode="1" id="griffe-check-oneline"
671 $ export FORCE_COLOR=1 # markdown-exec: hide
672 $ griffe check griffe -ssrc -b0.46.0 -a0.45.0
673 ```
674
675 [](){#format-verbose}
676
677 ### Verbose
678
679 - **CLI**: `-f verbose` / `-v`
680 - **API**: `check(..., style="verbose")` / `check(..., style=ExplanationStyle.VERBOSE)` / `check(..., verbose=True)`
681
682 Depending on the detected breakages, the lines might be hard to read (being too compact), so `griffe check` also accepts a `--verbose` or `-v` option to add some space to the output:
683
684 ```console exec="1" source="console" result="ansi" returncode="1" id="griffe-check-verbose"
685 $ export FORCE_COLOR=1 # markdown-exec: hide
686 $ griffe check griffe -ssrc -b0.46.0 -a0.45.0 --verbose
687 ```
688
689 [](){#format-markdown}
690
691 ### Markdown
692
693 - **CLI**: `-f markdown`
694 - **API**: `check(..., style="markdown")` / `check(..., style=ExplanationStyle.MARKDOWN)`
695
696 The Markdown format is adapted for changelogs. It doesn't show the file and line number, and instead prints out the complete path of your API objects. With a bit of automation, you will be able to automatically insert a summary of breaking changes in your changelog entries.
697
698 ```md exec="1" source="tabbed-left" tabs="Output|Result"
699 - `griffe.loader.GriffeLoader.resolve_aliases(only_exported)`: *Parameter kind was changed*: positional or keyword -> keyword-only
700 - `griffe.loader.GriffeLoader.resolve_aliases(only_exported)`: *Parameter default was changed*: `True` -> `None`
701 - `griffe.loader.GriffeLoader.resolve_aliases(only_known_modules)`: *Parameter kind was changed*: positional or keyword -> keyword-only
702 - `griffe.loader.GriffeLoader.resolve_aliases(only_known_modules)`: *Parameter default was changed*: `True` -> `None`
703 - `griffe.loader.GriffeLoader.resolve_aliases(max_iterations)`: *Parameter kind was changed*: positional or keyword -> keyword-only
704 - `griffe.loader.GriffeLoader.resolve_module_aliases(only_exported)`: *Parameter was removed*
705 - `griffe.loader.GriffeLoader.resolve_module_aliases(only_known_modules)`: *Parameter was removed*
706 - `griffe.git.tmp_worktree(commit)`: *Parameter was removed*
707 - `griffe.git.tmp_worktree(repo)`: *Positional parameter was moved*: position: from 2 to 1 (-1)
708 - `griffe.git.load_git(commit)`: *Parameter was removed*
709 - `griffe.git.load_git(repo)`: *Parameter kind was changed*: positional or keyword -> keyword-only
710 - `griffe.git.load_git(submodules)`: *Parameter kind was changed*: positional or keyword -> keyword-only
711 - `griffe.git.load_git(try_relative_path)`: *Parameter was removed*
712 - `griffe.git.load_git(extensions)`: *Parameter kind was changed*: positional or keyword -> keyword-only
713 - `griffe.git.load_git(search_paths)`: *Parameter kind was changed*: positional or keyword -> keyword-only
714 - `griffe.git.load_git(docstring_parser)`: *Parameter kind was changed*: positional or keyword -> keyword-only
715 - `griffe.git.load_git(docstring_options)`: *Parameter kind was changed*: positional or keyword -> keyword-only
716 - `griffe.git.load_git(lines_collection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
717 - `griffe.git.load_git(modules_collection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
718 - `griffe.git.load_git(allow_inspection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
719 ```
720
721 [](){#format-github}
722
723 ### GitHub
724
725 - **CLI**: `-f github`
726 - **API**: `check(..., style="github")` / `check(..., style=ExplanationStyle.GITHUB)`
727
728 When running `griffe check` in CI, you can enable GitHub's annotations thanks to the GitHub output style. Annotations are displayed on specific lines of code. They are visible in the Checks tab. When you create an annotation for a file that is part of the pull request, the annotations are also shown in the Files changed tab.
729
730 /// tab | Files changed tab
731 ![gha_annotations_2](../../img/gha_annotations_2.png)
732 ///
733
734 /// tab | Checks tab
735 ![gha_annotations_1](../../img/gha_annotations_1.png)
736 ///
737
738 ```console
739 % python -m griffe check -fgithub -ssrc griffe
740 ::warning file=src/griffe/finder.py,line=58,title=Package.name::Attribute value was changed: `name` -> unset
741 ::warning file=src/griffe/finder.py,line=60,title=Package.path::Attribute value was changed: `path` -> unset
742 ::warning file=src/griffe/finder.py,line=62,title=Package.stubs::Attribute value was changed: `stubs` -> `None`
743 ::warning file=src/griffe/finder.py,line=75,title=NamespacePackage.name::Attribute value was changed: `name` -> unset
744 ::warning file=src/griffe/finder.py,line=77,title=NamespacePackage.path::Attribute value was changed: `path` -> unset
745 ```
746
747 [](){#format-azdo}
748
749 ### Azure DevOps / Azure Pipelines
750
751 - **CLI**: `-f azdo`
752 - **API**: `check(..., style="azdo")` / `check(..., style=ExplanationStyle.AZURE_DEVOPS)`
753
754 Similarly to the GitHub workflow syntax, Griffe is capable of using the task logging command syntax used by Azure Pipelines as part of the Azure DevOps Services.
755
756 When running `griffe check` in CI, warnings are displayed in the warnings panel of your pipeline.
757
758 ## Next steps
759
760 If you are using a third-party library to mark objects as public, or if you follow conventions different than the one Griffe understands, you might get false-positives, or breaking changes could go undetected. In that case, you might be interested in [extending](extending.md) how Griffe loads API data to support these third-party libraries or other conventions.