stdlb 0.0.2__tar.gz → 0.0.4__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.
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stdlb
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Wildcard-import the Python standard library
5
- Home-page: UNKNOWN
6
- Author: Ryan Williams <ryan@runsascoded.com>
5
+ Home-page: https://github.com/runsascoded/stdlb
6
+ Author: Ryan Williams
7
+ Author-email: ryan@runsascoded.com
7
8
  License: MIT
8
9
  Platform: UNKNOWN
9
10
  Description-Content-Type: text/markdown
@@ -12,6 +13,8 @@ Description-Content-Type: text/markdown
12
13
 
13
14
  Wildcard-import the Python standard library
14
15
 
16
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
17
+
15
18
  ```python
16
19
  from stdlb import *
17
20
 
@@ -20,12 +23,20 @@ print(f"Current directory: {getcwd()}")
20
23
  stderr.write("Python version: {version}\n")
21
24
  ```
22
25
 
23
- ## Install
26
+ - [Install](#install)
27
+ - [Notes](#notes)
28
+ - [Collision Resolution](#collisions)
29
+ - [`__builtins` vs. module members](#builtins)
30
+ - [Module/Members](#module-members)
31
+ - [Aliases](#aliases)
32
+ - [Custom `cached_property`](#cached-property)
33
+
34
+ ## Install <a id="install"></a>
24
35
  ```bash
25
36
  pip install stdlb
26
37
  ```
27
38
 
28
- ## Notes
39
+ ## Notes <a id="notes"></a>
29
40
  I've found this especially useful in Jupyter notebooks, where I don't have an easy "add `import` statements as I add code" setup.
30
41
 
31
42
  Importing seems to take a few milliseconds (on my Macbook Air):
@@ -36,7 +47,19 @@ from stdlb import *
36
47
  # Wall time: 1.6 ms
37
48
  ```
38
49
 
39
- ### Collisions / Aliases
50
+ ### Collision Resolution <a id="collisions"></a>
51
+
52
+ #### `__builtins` vs. module members <a id="builtins"></a>
53
+ `stdlb` avoids overwriting `__builtins__` with conflicting module members, e.g.:
54
+ - `open` vs. `os.open`
55
+ - `compile` vs. `re.compile`
56
+ - `pow` vs. `math.pow`
57
+ - `copyright` vs. `sys.copyright`
58
+ - `BlockingIOError` vs. `io.BlockingIOError`
59
+
60
+ [`test.ipynb`](test.ipynb) is executed as part of [`ci.yml`](.github/workflows/ci.yml) to verify there are no `__builtins__` are unexpectedly shadowed.
61
+
62
+ #### Module/Members <a id="module-members"></a>
40
63
  In a few cases, a top-level standard library module also contains a member with the same name (e.g. `datetime`, `shlex`, `time`). `stdlb` makes an effort to ensure the module "wins" in this case:
41
64
 
42
65
  ```python
@@ -53,6 +76,8 @@ path # resolves to os.path, not sys.path
53
76
  join # os.path.join, not shlex.join
54
77
  ```
55
78
 
79
+ ### Aliases <a id="aliases"></a>
80
+
56
81
  For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
57
82
  ```python
58
83
  dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
@@ -60,7 +85,7 @@ fromtimestamp # datetime.datetime.fromtimestamp
60
85
  fromisoformat # datetime.datetime.fromisoformat
61
86
  ```
62
87
 
63
- ### Custom `cached_property`
88
+ ### Custom `cached_property` <a id="cached-property"></a>
64
89
  One additional bit of functionality is [this custom `cached_property` decorator](stdlb/cached_property.py), which omits an unnecessary/unserializable lock found in `functools.cached_property`. [cpython#87634](https://github.com/python/cpython/issues/87634) has more info, seems like [a fix is coming in Python 3.12](https://github.com/python/cpython/issues/87634#issuecomment-1467140709).
65
90
 
66
91
 
@@ -1,17 +1,9 @@
1
- Metadata-Version: 2.1
2
- Name: stdlb
3
- Version: 0.0.2
4
- Summary: Wildcard-import the Python standard library
5
- Home-page: UNKNOWN
6
- Author: Ryan Williams <ryan@runsascoded.com>
7
- License: MIT
8
- Platform: UNKNOWN
9
- Description-Content-Type: text/markdown
10
-
11
1
  # `stdlb`
12
2
 
13
3
  Wildcard-import the Python standard library
14
4
 
5
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
6
+
15
7
  ```python
16
8
  from stdlb import *
17
9
 
@@ -20,12 +12,20 @@ print(f"Current directory: {getcwd()}")
20
12
  stderr.write("Python version: {version}\n")
21
13
  ```
22
14
 
23
- ## Install
15
+ - [Install](#install)
16
+ - [Notes](#notes)
17
+ - [Collision Resolution](#collisions)
18
+ - [`__builtins` vs. module members](#builtins)
19
+ - [Module/Members](#module-members)
20
+ - [Aliases](#aliases)
21
+ - [Custom `cached_property`](#cached-property)
22
+
23
+ ## Install <a id="install"></a>
24
24
  ```bash
25
25
  pip install stdlb
26
26
  ```
27
27
 
28
- ## Notes
28
+ ## Notes <a id="notes"></a>
29
29
  I've found this especially useful in Jupyter notebooks, where I don't have an easy "add `import` statements as I add code" setup.
30
30
 
31
31
  Importing seems to take a few milliseconds (on my Macbook Air):
@@ -36,7 +36,19 @@ from stdlb import *
36
36
  # Wall time: 1.6 ms
37
37
  ```
38
38
 
39
- ### Collisions / Aliases
39
+ ### Collision Resolution <a id="collisions"></a>
40
+
41
+ #### `__builtins` vs. module members <a id="builtins"></a>
42
+ `stdlb` avoids overwriting `__builtins__` with conflicting module members, e.g.:
43
+ - `open` vs. `os.open`
44
+ - `compile` vs. `re.compile`
45
+ - `pow` vs. `math.pow`
46
+ - `copyright` vs. `sys.copyright`
47
+ - `BlockingIOError` vs. `io.BlockingIOError`
48
+
49
+ [`test.ipynb`](test.ipynb) is executed as part of [`ci.yml`](.github/workflows/ci.yml) to verify there are no `__builtins__` are unexpectedly shadowed.
50
+
51
+ #### Module/Members <a id="module-members"></a>
40
52
  In a few cases, a top-level standard library module also contains a member with the same name (e.g. `datetime`, `shlex`, `time`). `stdlb` makes an effort to ensure the module "wins" in this case:
41
53
 
42
54
  ```python
@@ -53,6 +65,8 @@ path # resolves to os.path, not sys.path
53
65
  join # os.path.join, not shlex.join
54
66
  ```
55
67
 
68
+ ### Aliases <a id="aliases"></a>
69
+
56
70
  For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
57
71
  ```python
58
72
  dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
@@ -60,7 +74,5 @@ fromtimestamp # datetime.datetime.fromtimestamp
60
74
  fromisoformat # datetime.datetime.fromisoformat
61
75
  ```
62
76
 
63
- ### Custom `cached_property`
77
+ ### Custom `cached_property` <a id="cached-property"></a>
64
78
  One additional bit of functionality is [this custom `cached_property` decorator](stdlb/cached_property.py), which omits an unnecessary/unserializable lock found in `functools.cached_property`. [cpython#87634](https://github.com/python/cpython/issues/87634) has more info, seems like [a fix is coming in Python 3.12](https://github.com/python/cpython/issues/87634#issuecomment-1467140709).
65
-
66
-
@@ -2,10 +2,13 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name="stdlb",
5
- version="0.0.2",
5
+ version="0.0.4",
6
6
  packages=["stdlb"],
7
7
  license="MIT",
8
- author="Ryan Williams <ryan@runsascoded.com>",
8
+ author="Ryan Williams",
9
+ author_email="ryan@runsascoded.com",
10
+ author_url="https://github.com/ryan-williams",
11
+ url="https://github.com/runsascoded/stdlb",
9
12
  description="Wildcard-import the Python standard library",
10
13
  long_description=open("README.md").read(),
11
14
  long_description_content_type="text/markdown",
@@ -28,6 +28,7 @@ from hashlib import *
28
28
 
29
29
  import io
30
30
  from io import *
31
+ BlockingIOError = __builtins__['BlockingIOError']
31
32
 
32
33
  import itertools
33
34
  from itertools import *
@@ -36,9 +37,11 @@ import json
36
37
 
37
38
  import math
38
39
  from math import *
40
+ pow = __builtins__['pow']
39
41
 
40
42
  import os
41
43
  from os import *
44
+ open = __builtins__['open']
42
45
  from os.path import *
43
46
 
44
47
  import pathlib
@@ -46,6 +49,7 @@ from pathlib import *
46
49
 
47
50
  import re
48
51
  from re import *
52
+ compile = __builtins__['compile']
49
53
 
50
54
  from shlex import *
51
55
  import shlex
@@ -60,6 +64,7 @@ from subprocess import *
60
64
  import sys
61
65
  from sys import *
62
66
  path = os.path
67
+ copyright = __builtins__['copyright']
63
68
 
64
69
  import tempfile
65
70
  from tempfile import *
@@ -1,7 +1,20 @@
1
+ Metadata-Version: 2.1
2
+ Name: stdlb
3
+ Version: 0.0.4
4
+ Summary: Wildcard-import the Python standard library
5
+ Home-page: https://github.com/runsascoded/stdlb
6
+ Author: Ryan Williams
7
+ Author-email: ryan@runsascoded.com
8
+ License: MIT
9
+ Platform: UNKNOWN
10
+ Description-Content-Type: text/markdown
11
+
1
12
  # `stdlb`
2
13
 
3
14
  Wildcard-import the Python standard library
4
15
 
16
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
17
+
5
18
  ```python
6
19
  from stdlb import *
7
20
 
@@ -10,12 +23,20 @@ print(f"Current directory: {getcwd()}")
10
23
  stderr.write("Python version: {version}\n")
11
24
  ```
12
25
 
13
- ## Install
26
+ - [Install](#install)
27
+ - [Notes](#notes)
28
+ - [Collision Resolution](#collisions)
29
+ - [`__builtins` vs. module members](#builtins)
30
+ - [Module/Members](#module-members)
31
+ - [Aliases](#aliases)
32
+ - [Custom `cached_property`](#cached-property)
33
+
34
+ ## Install <a id="install"></a>
14
35
  ```bash
15
36
  pip install stdlb
16
37
  ```
17
38
 
18
- ## Notes
39
+ ## Notes <a id="notes"></a>
19
40
  I've found this especially useful in Jupyter notebooks, where I don't have an easy "add `import` statements as I add code" setup.
20
41
 
21
42
  Importing seems to take a few milliseconds (on my Macbook Air):
@@ -26,7 +47,19 @@ from stdlb import *
26
47
  # Wall time: 1.6 ms
27
48
  ```
28
49
 
29
- ### Collisions / Aliases
50
+ ### Collision Resolution <a id="collisions"></a>
51
+
52
+ #### `__builtins` vs. module members <a id="builtins"></a>
53
+ `stdlb` avoids overwriting `__builtins__` with conflicting module members, e.g.:
54
+ - `open` vs. `os.open`
55
+ - `compile` vs. `re.compile`
56
+ - `pow` vs. `math.pow`
57
+ - `copyright` vs. `sys.copyright`
58
+ - `BlockingIOError` vs. `io.BlockingIOError`
59
+
60
+ [`test.ipynb`](test.ipynb) is executed as part of [`ci.yml`](.github/workflows/ci.yml) to verify there are no `__builtins__` are unexpectedly shadowed.
61
+
62
+ #### Module/Members <a id="module-members"></a>
30
63
  In a few cases, a top-level standard library module also contains a member with the same name (e.g. `datetime`, `shlex`, `time`). `stdlb` makes an effort to ensure the module "wins" in this case:
31
64
 
32
65
  ```python
@@ -43,6 +76,8 @@ path # resolves to os.path, not sys.path
43
76
  join # os.path.join, not shlex.join
44
77
  ```
45
78
 
79
+ ### Aliases <a id="aliases"></a>
80
+
46
81
  For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
47
82
  ```python
48
83
  dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
@@ -50,5 +85,7 @@ fromtimestamp # datetime.datetime.fromtimestamp
50
85
  fromisoformat # datetime.datetime.fromisoformat
51
86
  ```
52
87
 
53
- ### Custom `cached_property`
88
+ ### Custom `cached_property` <a id="cached-property"></a>
54
89
  One additional bit of functionality is [this custom `cached_property` decorator](stdlb/cached_property.py), which omits an unnecessary/unserializable lock found in `functools.cached_property`. [cpython#87634](https://github.com/python/cpython/issues/87634) has more info, seems like [a fix is coming in Python 3.12](https://github.com/python/cpython/issues/87634#issuecomment-1467140709).
90
+
91
+
File without changes
File without changes
File without changes