Initial commit

This commit is contained in:
Justin C. Miller
2025-05-10 18:22:53 -07:00
commit fe6aa0ff01
6 changed files with 100 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.13

0
README.md Normal file
View File

42
pyinfo.py Normal file
View File

@@ -0,0 +1,42 @@
import sys
import click
def print_list(name, l):
print(f"{name}:")
for v in l: print("\t", v)
print()
def print_dict(name, d):
print(f"{name}:")
for k, v in d.items():
print(f"\t{k:10}: {v}")
print()
sys_vars = (
"path",
"meta_path",
"orig_argv",
"executable",
"version",
#"implementation",
"prefix",
"_is_gil_enabled",
)
@click.command()
def info():
"""Show info about the current python environment."""
for var in sys_vars:
name = f"sys.{var}"
value = getattr(sys, var)
if callable(value):
value = value()
name += "()"
if isinstance(value, list): print_list(name, value)
elif isinstance(value, dict): print_dict(name, value)
else: print(f"{name:25}: {value}")
if __name__ == "__main__":
info()

12
pyproject.toml Normal file
View File

@@ -0,0 +1,12 @@
[project]
name = "pyinfo"
version = "0.1.0"
description = "Display info on the python environment"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"click>=8.1.8",
]
[project.scripts]
pyinfo = "pyinfo:info"

35
uv.lock generated Normal file
View File

@@ -0,0 +1,35 @@
version = 1
revision = 2
requires-python = ">=3.13"
[[package]]
name = "click"
version = "8.1.8"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "colorama", marker = "sys_platform == 'win32'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593, upload-time = "2024-12-21T18:38:44.339Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2", size = 98188, upload-time = "2024-12-21T18:38:41.666Z" },
]
[[package]]
name = "colorama"
version = "0.4.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
]
[[package]]
name = "pyinfo"
version = "0.1.0"
source = { virtual = "." }
dependencies = [
{ name = "click" },
]
[package.metadata]
requires-dist = [{ name = "click", specifier = ">=8.1.8" }]