Skip to content

Commit 10d1f8e

Browse files
committed
Add back stub header comment
1 parent dcd5c31 commit 10d1f8e

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

examples/example_pkg-stubs/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated with docstub. Manual edits will be overwritten!
1+
# File generated with docstub
22

33
import _numpy as np_
44
from _basic import func_contains

examples/example_pkg-stubs/_basic.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Generated with docstub. Manual edits will be overwritten!
1+
# File generated with docstub
2+
23
import configparser
34
import logging
45
from collections.abc import Sequence

examples/example_pkg-stubs/_numpy.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Generated with docstub. Manual edits will be overwritten!
1+
# File generated with docstub
2+
23
import numpy as np
34
from numpy.typing import ArrayLike, NDArray
45

src/docstub/_cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
logger = logging.getLogger(__name__)
2626

2727

28+
STUB_HEADER_COMMENT = "# File generated with docstub"
29+
30+
2831
def _load_configuration(config_path=None):
2932
"""Load and merge configuration from CWD and optional files.
3033
@@ -184,6 +187,7 @@ def main(source_dir, out_dir, config_path, verbose):
184187
stub_content = stub_transformer.python_to_stub(
185188
py_content, module_path=source_path
186189
)
190+
stub_content = f"{STUB_HEADER_COMMENT}\n\n{stub_content}"
187191
stub_content = try_format_stub(stub_content)
188192
except (SystemExit, KeyboardInterrupt):
189193
raise

0 commit comments

Comments
 (0)