stdlb 0.0.3__tar.gz → 0.1.0__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.
stdlb-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: stdlb
3
+ Version: 0.1.0
4
+ Summary: Wildcard-import the Python standard library
5
+ Project-URL: Homepage, https://github.com/runsascoded/stdlb
6
+ Project-URL: Repository, https://github.com/runsascoded/stdlb
7
+ Project-URL: Issues, https://github.com/runsascoded/stdlb/issues
8
+ Author-email: Ryan Williams <ryan@runsascoded.com>
9
+ License: MIT
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+
21
+ # `stdlb`
22
+
23
+ Wildcard-import the Python standard library
24
+
25
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
26
+
27
+ ```python
28
+ from stdlb import *
29
+
30
+ # Most of the standard library is now available:
31
+ print(f"Current directory: {getcwd()}")
32
+ stderr.write(f"Python version: {version}\n")
33
+ print(f"Today: {dt.now()}")
34
+ data = {"key": "value"}
35
+ dumps(data) # json.dumps
36
+ ```
37
+
38
+ **Features:**
39
+ - 🎯 **Comprehensive coverage**: 79+ stdlib modules available (up from ~20 in earlier versions)
40
+ - 🐍 **Python 3.10-3.13 support**: Automatically includes version-specific modules
41
+ - ⚡ **Fast**: Imports in ~2ms
42
+ - 🔒 **Safe**: Preserves all `__builtins__`, resolves name collisions intelligently
43
+
44
+ - [Install](#install)
45
+ - [Coverage](#coverage)
46
+ - [Notes](#notes)
47
+ - [Collision Resolution](#collisions)
48
+ - [`__builtins` vs. module members](#builtins)
49
+ - [Module/Members](#module-members)
50
+ - [Aliases](#aliases)
51
+ - [Custom `cached_property`](#cached-property)
52
+ - [Development](#development)
53
+
54
+ ## Install <a id="install"></a>
55
+ ```bash
56
+ pip install stdlb
57
+ ```
58
+
59
+ ## Coverage <a id="coverage"></a>
60
+
61
+ `stdlb` now includes 79+ stdlib modules, including:
62
+
63
+ **Core utilities**: `os`, `sys`, `pathlib`, `subprocess`, `tempfile`, `shutil`, `glob`, `fnmatch`
64
+
65
+ **Data structures & algorithms**: `collections`, `itertools`, `heapq`, `bisect`, `array`, `queue`
66
+
67
+ **Text processing**: `re`, `string`, `textwrap`, `difflib`, `unicodedata`
68
+
69
+ **Data formats**: `json`, `csv`, `configparser`, `pickle`, `base64`, `binascii`
70
+
71
+ **Math & numbers**: `math`, `cmath`, `decimal`, `fractions`, `statistics`, `random`, `secrets`
72
+
73
+ **Date & time**: `datetime`, `time`, `calendar`, `timeit`
74
+
75
+ **Functional programming**: `functools`, `operator`, `itertools`
76
+
77
+ **Type hints**: `typing`, `types`, `dataclasses`, `enum`
78
+
79
+ **Concurrency**: `threading`, `asyncio`, `subprocess`, `signal`
80
+
81
+ **Networking**: `socket`, `urllib`, `http`, `html`, `mimetypes`
82
+
83
+ **Cryptography**: `hashlib`, `hmac`, `secrets`
84
+
85
+ **Compression**: `zlib`, `zipfile`
86
+
87
+ **And more**: `logging`, `warnings`, `traceback`, `pprint`, `platform`, `locale`, etc.
88
+
89
+ ### Version-specific modules
90
+
91
+ - **Python 3.9+**: `graphlib`, `zoneinfo`
92
+ - **Python 3.11+**: `tomllib`
93
+
94
+ ## Notes <a id="notes"></a>
95
+ I've found this especially useful in Jupyter notebooks, where I don't have an easy "add `import` statements as I add code" setup.
96
+
97
+ Importing seems to take a few milliseconds (on my Macbook Air):
98
+ ```ipython
99
+ %%time
100
+ from stdlb import *
101
+ # CPU times: user 914 µs, sys: 397 µs, total: 1.31 ms
102
+ # Wall time: 1.6 ms
103
+ ```
104
+
105
+ ### Collision Resolution <a id="collisions"></a>
106
+
107
+ #### `__builtins` vs. module members <a id="builtins"></a>
108
+ `stdlb` avoids overwriting `__builtins__` with conflicting module members, e.g.:
109
+ - `open` vs. `os.open`
110
+ - `compile` vs. `re.compile`
111
+ - `pow` vs. `math.pow`
112
+ - `copyright` vs. `sys.copyright`
113
+ - `BlockingIOError` vs. `io.BlockingIOError`
114
+
115
+ [`test.ipynb`](test.ipynb) is executed as part of [`ci.yml`](.github/workflows/ci.yml) to verify there are no `__builtins__` are unexpectedly shadowed.
116
+
117
+ #### Module/Members <a id="module-members"></a>
118
+ 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:
119
+
120
+ ```python
121
+ from stdlb import *
122
+
123
+ datetime # <module 'datetime' from '$PYTHON_HOME/lib/python3.9/datetime.py'>
124
+ shlex # <module 'shlex' from '$PYTHON_HOME/lib/python3.9/shlex.py'>
125
+ time # <module 'time' (built-in)>
126
+ ```
127
+
128
+ A few names are disambiguated with the most sensible-seeming defaults:
129
+ ```python
130
+ path # resolves to os.path, not sys.path
131
+ join # os.path.join, not shlex.join
132
+ ```
133
+
134
+ ### Aliases <a id="aliases"></a>
135
+
136
+ For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
137
+ ```python
138
+ dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
139
+ fromtimestamp # datetime.datetime.fromtimestamp
140
+ fromisoformat # datetime.datetime.fromisoformat
141
+ ```
142
+
143
+ ### Custom `cached_property` <a id="cached-property"></a>
144
+ 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).
145
+
146
+ ## Development <a id="development"></a>
147
+
148
+ This project uses [uv](https://github.com/astral-sh/uv) for development.
149
+
150
+ ```bash
151
+ # Install dependencies
152
+ uv sync
153
+
154
+ # Run tests
155
+ uv run pytest tests/ -v
156
+
157
+ # Test across multiple Python versions
158
+ for v in .venv/3.*/bin/python; do $v scripts/quick_test.py; done
159
+
160
+ # Regenerate __init__.py (if needed)
161
+ uv run python scripts/generate_init.py > stdlb/__init__.py
162
+ ```
163
+
164
+ ### Scripts
165
+
166
+ - `scripts/discover_stdlib.py`: Analyze the stdlib and identify modules to include
167
+ - `scripts/generate_init.py`: Generate `stdlb/__init__.py` from stdlib discovery
168
+ - `scripts/quick_test.py`: Quick functionality test across Python versions
stdlb-0.1.0/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # `stdlb`
2
+
3
+ Wildcard-import the Python standard library
4
+
5
+ [![PyPI badge: "stdlb" library](https://img.shields.io/pypi/v/stdlb.svg)](https://pypi.python.org/pypi/stdlb)
6
+
7
+ ```python
8
+ from stdlb import *
9
+
10
+ # Most of the standard library is now available:
11
+ print(f"Current directory: {getcwd()}")
12
+ stderr.write(f"Python version: {version}\n")
13
+ print(f"Today: {dt.now()}")
14
+ data = {"key": "value"}
15
+ dumps(data) # json.dumps
16
+ ```
17
+
18
+ **Features:**
19
+ - 🎯 **Comprehensive coverage**: 79+ stdlib modules available (up from ~20 in earlier versions)
20
+ - 🐍 **Python 3.10-3.13 support**: Automatically includes version-specific modules
21
+ - ⚡ **Fast**: Imports in ~2ms
22
+ - 🔒 **Safe**: Preserves all `__builtins__`, resolves name collisions intelligently
23
+
24
+ - [Install](#install)
25
+ - [Coverage](#coverage)
26
+ - [Notes](#notes)
27
+ - [Collision Resolution](#collisions)
28
+ - [`__builtins` vs. module members](#builtins)
29
+ - [Module/Members](#module-members)
30
+ - [Aliases](#aliases)
31
+ - [Custom `cached_property`](#cached-property)
32
+ - [Development](#development)
33
+
34
+ ## Install <a id="install"></a>
35
+ ```bash
36
+ pip install stdlb
37
+ ```
38
+
39
+ ## Coverage <a id="coverage"></a>
40
+
41
+ `stdlb` now includes 79+ stdlib modules, including:
42
+
43
+ **Core utilities**: `os`, `sys`, `pathlib`, `subprocess`, `tempfile`, `shutil`, `glob`, `fnmatch`
44
+
45
+ **Data structures & algorithms**: `collections`, `itertools`, `heapq`, `bisect`, `array`, `queue`
46
+
47
+ **Text processing**: `re`, `string`, `textwrap`, `difflib`, `unicodedata`
48
+
49
+ **Data formats**: `json`, `csv`, `configparser`, `pickle`, `base64`, `binascii`
50
+
51
+ **Math & numbers**: `math`, `cmath`, `decimal`, `fractions`, `statistics`, `random`, `secrets`
52
+
53
+ **Date & time**: `datetime`, `time`, `calendar`, `timeit`
54
+
55
+ **Functional programming**: `functools`, `operator`, `itertools`
56
+
57
+ **Type hints**: `typing`, `types`, `dataclasses`, `enum`
58
+
59
+ **Concurrency**: `threading`, `asyncio`, `subprocess`, `signal`
60
+
61
+ **Networking**: `socket`, `urllib`, `http`, `html`, `mimetypes`
62
+
63
+ **Cryptography**: `hashlib`, `hmac`, `secrets`
64
+
65
+ **Compression**: `zlib`, `zipfile`
66
+
67
+ **And more**: `logging`, `warnings`, `traceback`, `pprint`, `platform`, `locale`, etc.
68
+
69
+ ### Version-specific modules
70
+
71
+ - **Python 3.9+**: `graphlib`, `zoneinfo`
72
+ - **Python 3.11+**: `tomllib`
73
+
74
+ ## Notes <a id="notes"></a>
75
+ I've found this especially useful in Jupyter notebooks, where I don't have an easy "add `import` statements as I add code" setup.
76
+
77
+ Importing seems to take a few milliseconds (on my Macbook Air):
78
+ ```ipython
79
+ %%time
80
+ from stdlb import *
81
+ # CPU times: user 914 µs, sys: 397 µs, total: 1.31 ms
82
+ # Wall time: 1.6 ms
83
+ ```
84
+
85
+ ### Collision Resolution <a id="collisions"></a>
86
+
87
+ #### `__builtins` vs. module members <a id="builtins"></a>
88
+ `stdlb` avoids overwriting `__builtins__` with conflicting module members, e.g.:
89
+ - `open` vs. `os.open`
90
+ - `compile` vs. `re.compile`
91
+ - `pow` vs. `math.pow`
92
+ - `copyright` vs. `sys.copyright`
93
+ - `BlockingIOError` vs. `io.BlockingIOError`
94
+
95
+ [`test.ipynb`](test.ipynb) is executed as part of [`ci.yml`](.github/workflows/ci.yml) to verify there are no `__builtins__` are unexpectedly shadowed.
96
+
97
+ #### Module/Members <a id="module-members"></a>
98
+ 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:
99
+
100
+ ```python
101
+ from stdlb import *
102
+
103
+ datetime # <module 'datetime' from '$PYTHON_HOME/lib/python3.9/datetime.py'>
104
+ shlex # <module 'shlex' from '$PYTHON_HOME/lib/python3.9/shlex.py'>
105
+ time # <module 'time' (built-in)>
106
+ ```
107
+
108
+ A few names are disambiguated with the most sensible-seeming defaults:
109
+ ```python
110
+ path # resolves to os.path, not sys.path
111
+ join # os.path.join, not shlex.join
112
+ ```
113
+
114
+ ### Aliases <a id="aliases"></a>
115
+
116
+ For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
117
+ ```python
118
+ dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
119
+ fromtimestamp # datetime.datetime.fromtimestamp
120
+ fromisoformat # datetime.datetime.fromisoformat
121
+ ```
122
+
123
+ ### Custom `cached_property` <a id="cached-property"></a>
124
+ 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).
125
+
126
+ ## Development <a id="development"></a>
127
+
128
+ This project uses [uv](https://github.com/astral-sh/uv) for development.
129
+
130
+ ```bash
131
+ # Install dependencies
132
+ uv sync
133
+
134
+ # Run tests
135
+ uv run pytest tests/ -v
136
+
137
+ # Test across multiple Python versions
138
+ for v in .venv/3.*/bin/python; do $v scripts/quick_test.py; done
139
+
140
+ # Regenerate __init__.py (if needed)
141
+ uv run python scripts/generate_init.py > stdlb/__init__.py
142
+ ```
143
+
144
+ ### Scripts
145
+
146
+ - `scripts/discover_stdlib.py`: Analyze the stdlib and identify modules to include
147
+ - `scripts/generate_init.py`: Generate `stdlb/__init__.py` from stdlib discovery
148
+ - `scripts/quick_test.py`: Quick functionality test across Python versions
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "stdlb"
7
+ version = "0.1.0"
8
+ description = "Wildcard-import the Python standard library"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Ryan Williams", email = "ryan@runsascoded.com"},
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ ]
24
+ requires-python = ">=3.10"
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/runsascoded/stdlb"
28
+ Repository = "https://github.com/runsascoded/stdlb"
29
+ Issues = "https://github.com/runsascoded/stdlb/issues"
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "ipykernel>=6.0.0",
34
+ "juq.py>=0.0.1",
35
+ "papermill>=2.0.0",
36
+ "pytest>=7.0.0",
37
+ ]
38
+
39
+ [tool.hatch.build.targets.sdist]
40
+ include = [
41
+ "/stdlb",
42
+ "/README.md",
43
+ ]
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["stdlb"]
@@ -0,0 +1,299 @@
1
+ """Wildcard-import the Python standard library.
2
+
3
+ This file is auto-generated by scripts/generate_init.py.
4
+ Do not edit manually.
5
+ """
6
+ import sys
7
+
8
+ import abc
9
+ from abc import *
10
+
11
+ import array
12
+ from array import *
13
+
14
+ import ast
15
+ from ast import *
16
+
17
+ import asyncio
18
+ from asyncio import *
19
+
20
+ import base64
21
+ from base64 import *
22
+
23
+ import binascii
24
+ from binascii import *
25
+
26
+ import bisect
27
+ from bisect import *
28
+
29
+ import calendar
30
+ from calendar import *
31
+
32
+ import cmath
33
+ from cmath import *
34
+
35
+ import code
36
+ from code import *
37
+
38
+ import codecs
39
+ from codecs import *
40
+
41
+ import collections
42
+ from collections import *
43
+
44
+ import configparser
45
+ from configparser import *
46
+
47
+ import contextlib
48
+ from contextlib import *
49
+
50
+ import copy
51
+ from copy import *
52
+
53
+ import csv
54
+ from csv import *
55
+
56
+ import dataclasses
57
+ from dataclasses import *
58
+
59
+ import datetime as _module_datetime
60
+ from datetime import *
61
+ datetime = _module_datetime
62
+
63
+ import decimal
64
+ from decimal import *
65
+
66
+ import difflib
67
+ from difflib import *
68
+
69
+ import enum
70
+ from enum import *
71
+
72
+ import fnmatch
73
+ from fnmatch import *
74
+
75
+ import fractions
76
+ from fractions import *
77
+
78
+ import functools
79
+ from functools import *
80
+
81
+ import glob as _module_glob
82
+ from glob import *
83
+ glob = _module_glob
84
+
85
+ if sys.version_info >= (3, 9):
86
+ import graphlib
87
+ from graphlib import *
88
+
89
+ import hashlib
90
+ from hashlib import *
91
+
92
+ import heapq
93
+ from heapq import *
94
+
95
+ import hmac
96
+ from hmac import *
97
+
98
+ import html
99
+ from html import *
100
+
101
+ import http
102
+ from http import *
103
+
104
+ import io
105
+ from io import *
106
+
107
+ import itertools
108
+ from itertools import *
109
+
110
+ import json
111
+ from json import *
112
+
113
+ import locale
114
+ from locale import *
115
+
116
+ import logging
117
+ from logging import *
118
+
119
+ import math
120
+ from math import *
121
+
122
+ import mimetypes
123
+ from mimetypes import *
124
+
125
+ import numbers
126
+ from numbers import *
127
+
128
+ import operator
129
+ from operator import *
130
+
131
+ import os as _module_os
132
+ from os import *
133
+ os = _module_os
134
+
135
+ import pathlib
136
+ from pathlib import *
137
+
138
+ import pickle
139
+ from pickle import *
140
+
141
+ import platform
142
+ from platform import *
143
+
144
+ import pprint
145
+ from pprint import *
146
+
147
+ import queue
148
+ from queue import *
149
+
150
+ import random
151
+ from random import *
152
+
153
+ import re
154
+ from re import *
155
+
156
+ import reprlib
157
+ from reprlib import *
158
+
159
+ import secrets
160
+ from secrets import *
161
+
162
+ import shelve
163
+ from shelve import *
164
+
165
+ import shlex as _module_shlex
166
+ from shlex import *
167
+ shlex = _module_shlex
168
+
169
+ import shutil
170
+ from shutil import *
171
+
172
+ import signal
173
+ from signal import *
174
+
175
+ import socket
176
+ from socket import *
177
+
178
+ import sqlite3
179
+ from sqlite3 import *
180
+
181
+ import statistics
182
+ from statistics import *
183
+
184
+ import string
185
+ from string import *
186
+
187
+ import struct
188
+ from struct import *
189
+
190
+ import subprocess
191
+ from subprocess import *
192
+
193
+ import sys as _module_sys
194
+ from sys import *
195
+ sys = _module_sys
196
+
197
+ import tempfile
198
+ from tempfile import *
199
+
200
+ import textwrap
201
+ from textwrap import *
202
+
203
+ import threading
204
+ from threading import *
205
+
206
+ import time as _module_time
207
+ from time import *
208
+ time = _module_time
209
+
210
+ import timeit
211
+ from timeit import *
212
+
213
+ if sys.version_info >= (3, 11):
214
+ import tomllib
215
+ from tomllib import *
216
+
217
+ import traceback
218
+ from traceback import *
219
+
220
+ import types
221
+ from types import *
222
+
223
+ import typing
224
+ from typing import *
225
+
226
+ import unicodedata
227
+ from unicodedata import *
228
+
229
+ import urllib
230
+ from urllib import *
231
+
232
+ import uuid
233
+ from uuid import *
234
+
235
+ import warnings
236
+ from warnings import *
237
+
238
+ import weakref
239
+ from weakref import *
240
+
241
+ import xml
242
+ from xml import *
243
+
244
+ import zipfile
245
+ from zipfile import *
246
+
247
+ import zlib
248
+ from zlib import *
249
+
250
+ if sys.version_info >= (3, 9):
251
+ import zoneinfo
252
+ from zoneinfo import *
253
+
254
+ # Preserve builtins that may be shadowed by module members
255
+ _builtins_dict = __builtins__ if isinstance(__builtins__, dict) else __builtins__.__dict__
256
+ if 'BlockingIOError' in _builtins_dict:
257
+ BlockingIOError = _builtins_dict['BlockingIOError']
258
+ if 'TimeoutError' in _builtins_dict:
259
+ TimeoutError = _builtins_dict['TimeoutError']
260
+ if 'Warning' in _builtins_dict:
261
+ Warning = _builtins_dict['Warning']
262
+ if 'abs' in _builtins_dict:
263
+ abs = _builtins_dict['abs']
264
+ if 'compile' in _builtins_dict:
265
+ compile = _builtins_dict['compile']
266
+ if 'copyright' in _builtins_dict:
267
+ copyright = _builtins_dict['copyright']
268
+ if 'enumerate' in _builtins_dict:
269
+ enumerate = _builtins_dict['enumerate']
270
+ if 'exit' in _builtins_dict:
271
+ exit = _builtins_dict['exit']
272
+ if 'filter' in _builtins_dict:
273
+ filter = _builtins_dict['filter']
274
+ if 'open' in _builtins_dict:
275
+ open = _builtins_dict['open']
276
+ if 'pow' in _builtins_dict:
277
+ pow = _builtins_dict['pow']
278
+ if 'property' in _builtins_dict:
279
+ property = _builtins_dict['property']
280
+ if 'repr' in _builtins_dict:
281
+ repr = _builtins_dict['repr']
282
+ if 'slice' in _builtins_dict:
283
+ slice = _builtins_dict['slice']
284
+ if 'str' in _builtins_dict:
285
+ str = _builtins_dict['str']
286
+
287
+ # Datetime convenience aliases
288
+ dt = datetime.datetime
289
+ fromtimestamp = dt.fromtimestamp
290
+ fromisoformat = dt.fromisoformat
291
+
292
+ # Collision resolution preferences
293
+ join = os.path.join
294
+ path = os.path
295
+
296
+ # Custom implementations
297
+ from .cached_property import cached_property
298
+
299
+
stdlb-0.0.3/PKG-INFO DELETED
@@ -1,67 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: stdlb
3
- Version: 0.0.3
4
- Summary: Wildcard-import the Python standard library
5
- Home-page: UNKNOWN
6
- Author: Ryan Williams
7
- Author-email: ryan@runsascoded.com
8
- License: MIT
9
- Platform: UNKNOWN
10
- Description-Content-Type: text/markdown
11
-
12
- # `stdlb`
13
-
14
- Wildcard-import the Python standard library
15
-
16
- ```python
17
- from stdlb import *
18
-
19
- # Most of the standard library is now available:
20
- print(f"Current directory: {getcwd()}")
21
- stderr.write("Python version: {version}\n")
22
- ```
23
-
24
- ## Install
25
- ```bash
26
- pip install stdlb
27
- ```
28
-
29
- ## Notes
30
- 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
-
32
- Importing seems to take a few milliseconds (on my Macbook Air):
33
- ```ipython
34
- %%time
35
- from stdlb import *
36
- # CPU times: user 914 µs, sys: 397 µs, total: 1.31 ms
37
- # Wall time: 1.6 ms
38
- ```
39
-
40
- ### Collisions / Aliases
41
- 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
-
43
- ```python
44
- from stdlb import *
45
-
46
- datetime # <module 'datetime' from '$PYTHON_HOME/lib/python3.9/datetime.py'>
47
- shlex # <module 'shlex' from '$PYTHON_HOME/lib/python3.9/shlex.py'>
48
- time # <module 'time' (built-in)>
49
- ```
50
-
51
- A few names are disambiguated with the most sensible-seeming defaults:
52
- ```python
53
- path # resolves to os.path, not sys.path
54
- join # os.path.join, not shlex.join
55
- ```
56
-
57
- For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
58
- ```python
59
- dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
60
- fromtimestamp # datetime.datetime.fromtimestamp
61
- fromisoformat # datetime.datetime.fromisoformat
62
- ```
63
-
64
- ### Custom `cached_property`
65
- 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
-
67
-
stdlb-0.0.3/README.md DELETED
@@ -1,54 +0,0 @@
1
- # `stdlb`
2
-
3
- Wildcard-import the Python standard library
4
-
5
- ```python
6
- from stdlb import *
7
-
8
- # Most of the standard library is now available:
9
- print(f"Current directory: {getcwd()}")
10
- stderr.write("Python version: {version}\n")
11
- ```
12
-
13
- ## Install
14
- ```bash
15
- pip install stdlb
16
- ```
17
-
18
- ## Notes
19
- 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
-
21
- Importing seems to take a few milliseconds (on my Macbook Air):
22
- ```ipython
23
- %%time
24
- from stdlb import *
25
- # CPU times: user 914 µs, sys: 397 µs, total: 1.31 ms
26
- # Wall time: 1.6 ms
27
- ```
28
-
29
- ### Collisions / Aliases
30
- 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
-
32
- ```python
33
- from stdlb import *
34
-
35
- datetime # <module 'datetime' from '$PYTHON_HOME/lib/python3.9/datetime.py'>
36
- shlex # <module 'shlex' from '$PYTHON_HOME/lib/python3.9/shlex.py'>
37
- time # <module 'time' (built-in)>
38
- ```
39
-
40
- A few names are disambiguated with the most sensible-seeming defaults:
41
- ```python
42
- path # resolves to os.path, not sys.path
43
- join # os.path.join, not shlex.join
44
- ```
45
-
46
- For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
47
- ```python
48
- dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
49
- fromtimestamp # datetime.datetime.fromtimestamp
50
- fromisoformat # datetime.datetime.fromisoformat
51
- ```
52
-
53
- ### Custom `cached_property`
54
- 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).
stdlb-0.0.3/setup.cfg DELETED
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
stdlb-0.0.3/setup.py DELETED
@@ -1,14 +0,0 @@
1
- from setuptools import setup
2
-
3
- setup(
4
- name="stdlb",
5
- version="0.0.3",
6
- packages=["stdlb"],
7
- license="MIT",
8
- author="Ryan Williams",
9
- author_email="ryan@runsascoded.com",
10
- author_url="https://github.com/ryan-williams",
11
- description="Wildcard-import the Python standard library",
12
- long_description=open("README.md").read(),
13
- long_description_content_type="text/markdown",
14
- )
@@ -1,84 +0,0 @@
1
- import base64
2
- from base64 import *
3
-
4
- import configparser
5
- from configparser import *
6
-
7
- import contextlib
8
- from contextlib import *
9
-
10
- import dataclasses
11
- from dataclasses import *
12
-
13
- from datetime import *
14
- from datetime import datetime as dt
15
- import datetime
16
- fromtimestamp = dt.fromtimestamp
17
- fromisoformat = dt.fromisoformat
18
-
19
- import functools
20
- from functools import *
21
- from .cached_property import cached_property
22
-
23
- from glob import *
24
- import glob
25
-
26
- import hashlib
27
- from hashlib import *
28
-
29
- import io
30
- from io import *
31
-
32
- import itertools
33
- from itertools import *
34
-
35
- import json
36
-
37
- import math
38
- from math import *
39
-
40
- import os
41
- from os import *
42
- open = __builtins__['open']
43
- from os.path import *
44
-
45
- import pathlib
46
- from pathlib import *
47
-
48
- import re
49
- from re import *
50
-
51
- from shlex import *
52
- import shlex
53
-
54
- import shutil
55
- from shutil import *
56
- join = os.path.join # seems like a better default than shlex.join
57
-
58
- import subprocess
59
- from subprocess import *
60
-
61
- import sys
62
- from sys import *
63
- path = os.path
64
-
65
- import tempfile
66
- from tempfile import *
67
-
68
- from time import *
69
- import time
70
-
71
- import traceback
72
- from traceback import *
73
-
74
- import typing
75
- from typing import *
76
-
77
- import urllib
78
- from urllib import *
79
- from urllib.parse import urlparse
80
-
81
- import uuid
82
- from uuid import *
83
-
84
- import warnings
@@ -1,67 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: stdlb
3
- Version: 0.0.3
4
- Summary: Wildcard-import the Python standard library
5
- Home-page: UNKNOWN
6
- Author: Ryan Williams
7
- Author-email: ryan@runsascoded.com
8
- License: MIT
9
- Platform: UNKNOWN
10
- Description-Content-Type: text/markdown
11
-
12
- # `stdlb`
13
-
14
- Wildcard-import the Python standard library
15
-
16
- ```python
17
- from stdlb import *
18
-
19
- # Most of the standard library is now available:
20
- print(f"Current directory: {getcwd()}")
21
- stderr.write("Python version: {version}\n")
22
- ```
23
-
24
- ## Install
25
- ```bash
26
- pip install stdlb
27
- ```
28
-
29
- ## Notes
30
- 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
-
32
- Importing seems to take a few milliseconds (on my Macbook Air):
33
- ```ipython
34
- %%time
35
- from stdlb import *
36
- # CPU times: user 914 µs, sys: 397 µs, total: 1.31 ms
37
- # Wall time: 1.6 ms
38
- ```
39
-
40
- ### Collisions / Aliases
41
- 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
-
43
- ```python
44
- from stdlb import *
45
-
46
- datetime # <module 'datetime' from '$PYTHON_HOME/lib/python3.9/datetime.py'>
47
- shlex # <module 'shlex' from '$PYTHON_HOME/lib/python3.9/shlex.py'>
48
- time # <module 'time' (built-in)>
49
- ```
50
-
51
- A few names are disambiguated with the most sensible-seeming defaults:
52
- ```python
53
- path # resolves to os.path, not sys.path
54
- join # os.path.join, not shlex.join
55
- ```
56
-
57
- For convenience, `datetime.datetime` is also exposed as `dt`, and a few of its members are exported directly:
58
- ```python
59
- dt.now() # datetime.datetime(2023, 8, 3, 10, 9, 43, 981458)
60
- fromtimestamp # datetime.datetime.fromtimestamp
61
- fromisoformat # datetime.datetime.fromisoformat
62
- ```
63
-
64
- ### Custom `cached_property`
65
- 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
-
67
-
@@ -1,8 +0,0 @@
1
- README.md
2
- setup.py
3
- stdlb/__init__.py
4
- stdlb/cached_property.py
5
- stdlb.egg-info/PKG-INFO
6
- stdlb.egg-info/SOURCES.txt
7
- stdlb.egg-info/dependency_links.txt
8
- stdlb.egg-info/top_level.txt
@@ -1 +0,0 @@
1
- stdlb
File without changes