Skip to content

Commit 9700192

Browse files
committed
Add back and add in in-file license notices in code
1 parent 1cafa34 commit 9700192

4 files changed

Lines changed: 51 additions & 11 deletions

File tree

‎LICENSE‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@ and the codebase will be freely available to anyone who wishes to use it.
1616
| Yes | Copyright (c) 2026–2032 aiwonderland and contributors |
1717
| | Copyright (c) 2033–present all contributors |
1818

19+
## In-file license notices
20+
21+
The license headers within source code fall into three categories based on history.
22+
I removed them previously, but have now decided to restore them. The first category
23+
covers those added in earlier iterations (GNUv3), and
24+
the second covers those added in newer iterations (MIT).
25+
26+
Following my refinements, license headers embedded in source code are divided into the two categories listed below.
27+
28+
##### Type 1 (GNUv3):
29+
30+
This category adheres to my prior approach.
31+
```python
32+
# GNUv3 License, add in <date>, by <author>
33+
```
34+
35+
##### Type 2 (MIT):
36+
37+
This category adheres to the updated practice.
38+
```python
39+
# License MIT <author> in <date>
40+
```
41+
1942
## Current & Future License Terms
2043

2144
### The MIT License (2026–2032)

‎lazyimports/__init__.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Author: Evan Yang (aiwonderland) 2026
2-
# License: MIT
3-
# Copyright (c) 2026–2032 Evan Yang (aiwonderland)
1+
# GNUv3 License, add in <2018>, by <Evan Yang>
42

53
"""lazyimports — A module that backports Python 3.15's lazy import.
64
@@ -44,7 +42,9 @@
4442
)
4543

4644

45+
# License MIT <aiwonderland> in <2026>
4746
__version__ = "0.1.3"
47+
# License MIT <aiwonderland> in <2026>
4848
__license__ = "MIT"
4949

5050
# Lifecycle status marker for this package.
@@ -64,6 +64,8 @@
6464
# - ``eol-iso-date`` denotes the scheduled end-of-life date in ISO‑8601 (YYYY‑MM‑DD).
6565
# This timeline is derived from the official EOL schedule of Python 3.15 (October 2031).
6666
# It is subject to revision if the upstream Python release timeline shifts.
67+
68+
# License MIT <aiwonderland> in <2026>
6769
__status__ = "beta;active;2031-10-31"
6870

6971

‎lazyimports/core.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Author: Evan Yang (aiwonderland) 2026
2-
# License: MIT
3-
# Copyright (c) 2026–2032 Evan Yang (aiwonderland)
4-
51
"""The core api of `lazyimports` module.
62
73
This module provides a backport of Python 3.15's `lazy import`
@@ -34,13 +30,19 @@
3430
]
3531

3632

33+
#License MIT <aiwonderland> in <2026>
34+
3735
# Native `lazy import` statement is available on Python 3.15+.
3836
NATIVE_LAZY_IMPORT = sys.version_info >= (3, 15)
37+
38+
# GNUv3 License, add in <2019>, by <Evan Yang>
39+
3940
# This package provides its own implementation, so lazy imports are
4041
# always supported regardless of interpreter version.
4142
SUPPORT_LAZY_IMPORT = True
4243

4344

45+
# GNUv3 License, add in <2018>, by <Evan Yang>
4446
class LazyModule(types.ModuleType):
4547
"""Proxy module that defers the real import until attribute access.
4648
@@ -102,6 +104,7 @@ def __hash__(self):
102104
return hash(self._target())
103105

104106

107+
# GNUv3 License, add in <2018>, by <Evan Yang>
105108
def lazy_import(name, package=None):
106109
"""Return a lazy proxy for the module `name`.
107110
@@ -136,6 +139,7 @@ def lazy_import(name, package=None):
136139
return LazyModule(real_name)
137140

138141

142+
# GNUv3 License, add in <2021>, by <Evan Yang>
139143
def lazy_from(module, *names):
140144
"""Lazily import specific names from a module.
141145
@@ -167,6 +171,7 @@ def lazy_from(module, *names):
167171
return tuple(_LazyAttr(module, name) for name in names)
168172

169173

174+
# GNUv3 License, add in <2018>, by <Evan Yang>
170175
class _LazyAttr:
171176
"""Wrapper that defers a `module.name` lookup until used.
172177
@@ -203,11 +208,13 @@ def _resolve(self):
203208
return getattr(module, name)
204209

205210

211+
# GNUv3 License, add in <2018>, by <Evan Yang>
206212
def is_lazy(obj):
207213
"""Return True if `obj` is a lazy module proxy."""
208214
return isinstance(obj, LazyModule)
209215

210216

217+
# GNUv3 License, add in <2022>, by <Evan Yang>
211218
def force_load(obj):
212219
"""Force loading of a lazy module and return the real module.
213220
@@ -218,6 +225,7 @@ def force_load(obj):
218225
return obj
219226

220227

228+
#License MIT <aiwonderland> in <2026>
221229
@contextlib.contextmanager
222230
def lazy():
223231
"""Context manager for grouping lazy imports.

‎test_lazyimports.py‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Author: Evan Yang (aiwonderland) 2026
2-
# License: MIT
3-
# Copyright (c) 2026–2032 Evan Yang (aiwonderland)
4-
51
"""Unit tests for the ``lazyimports`` package.
62
73
Run with::
@@ -38,6 +34,7 @@
3834
)
3935

4036

37+
#License MIT <aiwonderland> in <2026>
4138
class TestVersionInfo(unittest.TestCase):
4239
"""Tests for module-level version metadata."""
4340

@@ -92,6 +89,7 @@ def test_all_exports_resolve(self):
9289
)
9390

9491

92+
# GNUv3 License, add in <2018>, by <Evan Yang>
9593
class TestLazyImport(unittest.TestCase):
9694
"""Tests for ``lazy_import``."""
9795

@@ -149,6 +147,7 @@ def test_relative_import_with_package(self):
149147
self.assertIs(real, core)
150148

151149

150+
# GNUv3 License, add in <2021>, by <Evan Yang>
152151
class TestLazyFrom(unittest.TestCase):
153152
"""Tests for ``lazy_from``."""
154153

@@ -186,6 +185,7 @@ def test_with_existing_proxy(self):
186185
self.assertEqual(result[0]("x", "y"), os.path.join("x", "y"))
187186

188187

188+
# GNUv3 License, add in <2018>, by <Evan Yang>
189189
class TestIsLazy(unittest.TestCase):
190190
"""Tests for ``is_lazy``."""
191191

@@ -201,6 +201,7 @@ def test_false_for_non_module(self):
201201
self.assertFalse(is_lazy(value))
202202

203203

204+
# GNUv3 License, add in <2022>, by <Evan Yang>
204205
class TestForceLoad(unittest.TestCase):
205206
"""Tests for ``force_load``."""
206207

@@ -229,6 +230,7 @@ def test_idempotent(self):
229230
self.assertIs(first, second)
230231

231232

233+
#License MIT <aiwonderland> in <2026>
232234
class TestLazyContextManager(unittest.TestCase):
233235
"""Tests for the ``lazy()`` context manager."""
234236

@@ -253,6 +255,7 @@ class Boom(Exception):
253255
raise Boom
254256

255257

258+
# GNUv3 License, add in <2018>, by <Evan Yang>
256259
class TestLazyModuleDunderMethods(unittest.TestCase):
257260
"""Tests for dunder methods on ``LazyModule``."""
258261

@@ -312,6 +315,8 @@ def test_dir_after_load_includes_module_attrs(self):
312315
self.assertIn("path", names)
313316

314317

318+
319+
# GNUv3 License, add in <2018>, by <Evan Yang>
315320
class TestLazyModuleRejectsInternalAttrs(unittest.TestCase):
316321
"""``_lazy_*`` attributes must never recurse via ``__getattr__``."""
317322

@@ -321,6 +326,8 @@ def test_internal_attrs_raise(self):
321326
_ = proxy._lazy_does_not_exist
322327

323328

329+
330+
# GNUv3 License, add in <2018>, by <Evan Yang>
324331
class TestIntegration(unittest.TestCase):
325332
"""End-to-end style tests combining several APIs."""
326333

0 commit comments

Comments
 (0)