stdlb 0.0.3__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,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stdlb
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Wildcard-import the Python standard library
5
- Home-page: UNKNOWN
5
+ Home-page: https://github.com/runsascoded/stdlb
6
6
  Author: Ryan Williams
7
7
  Author-email: ryan@runsascoded.com
8
8
  License: MIT
@@ -13,6 +13,8 @@ Description-Content-Type: text/markdown
13
13
 
14
14
  Wildcard-import the Python standard library
15
15
 
16
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
17
+
16
18
  ```python
17
19
  from stdlb import *
18
20
 
@@ -21,12 +23,20 @@ print(f"Current directory: {getcwd()}")
21
23
  stderr.write("Python version: {version}\n")
22
24
  ```
23
25
 
24
- ## 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>
25
35
  ```bash
26
36
  pip install stdlb
27
37
  ```
28
38
 
29
- ## Notes
39
+ ## Notes <a id="notes"></a>
30
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.
31
41
 
32
42
  Importing seems to take a few milliseconds (on my Macbook Air):
@@ -37,7 +47,19 @@ from stdlb import *
37
47
  # Wall time: 1.6 ms
38
48
  ```
39
49
 
40
- ### 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>
41
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:
42
64
 
43
65
  ```python
@@ -54,6 +76,8 @@ path # resolves to os.path, not sys.path
54
76
  join # os.path.join, not shlex.join
55
77
  ```
56
78
 
79
+ ### Aliases <a id="aliases"></a>
80
+
57
81
  For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
58
82
  ```python
59
83
  dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
@@ -61,7 +85,7 @@ fromtimestamp # datetime.datetime.fromtimestamp
61
85
  fromisoformat # datetime.datetime.fromisoformat
62
86
  ```
63
87
 
64
- ### Custom `cached_property`
88
+ ### Custom `cached_property` <a id="cached-property"></a>
65
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).
66
90
 
67
91
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  Wildcard-import the Python standard library
4
4
 
5
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
6
+
5
7
  ```python
6
8
  from stdlb import *
7
9
 
@@ -10,12 +12,20 @@ print(f"Current directory: {getcwd()}")
10
12
  stderr.write("Python version: {version}\n")
11
13
  ```
12
14
 
13
- ## 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>
14
24
  ```bash
15
25
  pip install stdlb
16
26
  ```
17
27
 
18
- ## Notes
28
+ ## Notes <a id="notes"></a>
19
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.
20
30
 
21
31
  Importing seems to take a few milliseconds (on my Macbook Air):
@@ -26,7 +36,19 @@ from stdlb import *
26
36
  # Wall time: 1.6 ms
27
37
  ```
28
38
 
29
- ### 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>
30
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:
31
53
 
32
54
  ```python
@@ -43,6 +65,8 @@ path # resolves to os.path, not sys.path
43
65
  join # os.path.join, not shlex.join
44
66
  ```
45
67
 
68
+ ### Aliases <a id="aliases"></a>
69
+
46
70
  For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
47
71
  ```python
48
72
  dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
@@ -50,5 +74,5 @@ fromtimestamp # datetime.datetime.fromtimestamp
50
74
  fromisoformat # datetime.datetime.fromisoformat
51
75
  ```
52
76
 
53
- ### Custom `cached_property`
77
+ ### Custom `cached_property` <a id="cached-property"></a>
54
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).
@@ -2,12 +2,13 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name="stdlb",
5
- version="0.0.3",
5
+ version="0.0.4",
6
6
  packages=["stdlb"],
7
7
  license="MIT",
8
8
  author="Ryan Williams",
9
9
  author_email="ryan@runsascoded.com",
10
10
  author_url="https://github.com/ryan-williams",
11
+ url="https://github.com/runsascoded/stdlb",
11
12
  description="Wildcard-import the Python standard library",
12
13
  long_description=open("README.md").read(),
13
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,6 +37,7 @@ 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 *
@@ -47,6 +49,7 @@ from pathlib import *
47
49
 
48
50
  import re
49
51
  from re import *
52
+ compile = __builtins__['compile']
50
53
 
51
54
  from shlex import *
52
55
  import shlex
@@ -61,6 +64,7 @@ from subprocess import *
61
64
  import sys
62
65
  from sys import *
63
66
  path = os.path
67
+ copyright = __builtins__['copyright']
64
68
 
65
69
  import tempfile
66
70
  from tempfile import *
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stdlb
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Wildcard-import the Python standard library
5
- Home-page: UNKNOWN
5
+ Home-page: https://github.com/runsascoded/stdlb
6
6
  Author: Ryan Williams
7
7
  Author-email: ryan@runsascoded.com
8
8
  License: MIT
@@ -13,6 +13,8 @@ Description-Content-Type: text/markdown
13
13
 
14
14
  Wildcard-import the Python standard library
15
15
 
16
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
17
+
16
18
  ```python
17
19
  from stdlb import *
18
20
 
@@ -21,12 +23,20 @@ print(f"Current directory: {getcwd()}")
21
23
  stderr.write("Python version: {version}\n")
22
24
  ```
23
25
 
24
- ## 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>
25
35
  ```bash
26
36
  pip install stdlb
27
37
  ```
28
38
 
29
- ## Notes
39
+ ## Notes <a id="notes"></a>
30
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.
31
41
 
32
42
  Importing seems to take a few milliseconds (on my Macbook Air):
@@ -37,7 +47,19 @@ from stdlb import *
37
47
  # Wall time: 1.6 ms
38
48
  ```
39
49
 
40
- ### 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>
41
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:
42
64
 
43
65
  ```python
@@ -54,6 +76,8 @@ path # resolves to os.path, not sys.path
54
76
  join # os.path.join, not shlex.join
55
77
  ```
56
78
 
79
+ ### Aliases <a id="aliases"></a>
80
+
57
81
  For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
58
82
  ```python
59
83
  dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
@@ -61,7 +85,7 @@ fromtimestamp # datetime.datetime.fromtimestamp
61
85
  fromisoformat # datetime.datetime.fromisoformat
62
86
  ```
63
87
 
64
- ### Custom `cached_property`
88
+ ### Custom `cached_property` <a id="cached-property"></a>
65
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).
66
90
 
67
91
 
File without changes
File without changes
File without changes