Skip to content

Commit e522972

Browse files
authored
Merge pull request #91 from braboj/codex/add-headers-describing-import-mechanics
Add headers to import system examples
2 parents a88b6a2 + 3a02dea commit e522972

27 files changed

Lines changed: 27 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Examples showing different aspects of Python's import system."""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Package demonstrating circular imports."""

examples/17_import_system/circular/submodule1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""First module in a circular import chain."""
12
from . import submodule2
23

34

examples/17_import_system/circular/submodule2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Second module that completes the circular import chain."""
12
from . import submodule1
23

34
def func2():

examples/17_import_system/export_decorator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Defines an export decorator for populating a package's __all__."""
12
# Example of the export decorator that shall be placed in the __init__.py file of the package
23

34
# Export decorator

examples/17_import_system/foo/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Demo package with relative imports and an export decorator."""
12
# Define the packet API
23
__version__ = '1.0.0'
34

examples/17_import_system/foo/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Entry point executed when running the package with -m."""
12
import sys
23
import os.path
34

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
"""API subpackage exposing a version constant."""
12
__version__ = '0.1.0'

examples/17_import_system/foo/api/submodule1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Submodule used to demonstrate absolute and relative imports."""
12
# Define a constant
23
my_id = 1
34

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Core subpackage used in import examples."""

0 commit comments

Comments
 (0)