From 454349ea23f8d492cfffe2600d988525e7ed71b3 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 15 Mar 2023 16:15:06 -0500 Subject: [PATCH] chore: cleanup some types on standalone functions --- README.md | 11 +++++++---- examples/standalone.py | 6 +++--- src/viv/viv.py | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9803fd9..47e38f0 100644 --- a/README.md +++ b/README.md @@ -91,11 +91,12 @@ It can be auto-generated with for example: `viv freeze --standalone`. The only part necessary to modify if copied verbatim from below is the call to `_viv_use`. -output of `viv freeze rich --standalone`: +Output of `viv freeze rich --standalone`: + ```python -# <<<<< auto-generated by daylinmorgan/viv (v.22.12a3) +# <<<<< auto-generated by daylinmorgan/viv (v22.12a3-35-g0d0c66d-dev) # fmt: off -def _viv_use(*pkgs: str, track_exe: bool = False, name: str = "") -> None: # noqa +def _viv_use(*pkgs: str, track_exe: bool = False, name: str = "") -> None: # noqa i,s,m,e,spec=__import__,str,map,lambda x: True if x else False,[*pkgs] # noqa if not {*m(type,pkgs)}=={s}: raise ValueError(f"spec: {pkgs} is invalid") # noqa ge,sys,P,ew=i("os").getenv,i("sys"),i("pathlib").Path,i("sys").stderr.write # noqa @@ -113,9 +114,11 @@ def _viv_use(*pkgs: str, track_exe: bool = False, name: str = "") -> None: with (env/"viv-info.json").open("w") as f: # noqa i("json").dump({"created":s(i("datetime").datetime.today()),"id":_id,"spec":spec,"exe":exe},f) # noqa sys.path = [p for p in (*sys.path,s(*(env/"lib").glob("py*/si*"))) if p!=i("site").USER_SITE] # noqa -_viv_use("markdown-it-py==2.2.0", "mdurl==0.1.2", "Pygments==2.14.0", "rich==13.3.2") # noqa +_viv_use("markdown-it-py==2.2.0", "mdurl==0.1.2", "Pygments==2.14.0", "rich==13.3.2") # noqa # fmt: on # >>>>> code golfed with <3 + + ``` ## Alternatives diff --git a/examples/standalone.py b/examples/standalone.py index 3adb88f..b8ed33a 100644 --- a/examples/standalone.py +++ b/examples/standalone.py @@ -5,9 +5,9 @@ With this function it's not necessary for `viv` to exist anywhere on the system. """ -# <<<<< auto-generated by daylinmorgan/viv (v.22.12a3) +# <<<<< auto-generated by daylinmorgan/viv (v22.12a3-35-g0d0c66d-dev) # fmt: off -def _viv_use(*pkgs: str, track_exe: bool = False, name: str = "") -> None: # noqa +def _viv_use(*pkgs: str, track_exe: bool = False, name: str = "") -> None: # noqa i,s,m,e,spec=__import__,str,map,lambda x: True if x else False,[*pkgs] # noqa if not {*m(type,pkgs)}=={s}: raise ValueError(f"spec: {pkgs} is invalid") # noqa ge,sys,P,ew=i("os").getenv,i("sys"),i("pathlib").Path,i("sys").stderr.write # noqa @@ -25,7 +25,7 @@ def _viv_use(*pkgs: str, track_exe: bool = False, name: str = "") -> None: with (env/"viv-info.json").open("w") as f: # noqa i("json").dump({"created":s(i("datetime").datetime.today()),"id":_id,"spec":spec,"exe":exe},f) # noqa sys.path = [p for p in (*sys.path,s(*(env/"lib").glob("py*/si*"))) if p!=i("site").USER_SITE] # noqa -_viv_use("pyfiglet==0.8.post1") # noqa +_viv_use("pyfiglet==0.8.post1") # noqa # fmt: on # >>>>> code golfed with <3 diff --git a/src/viv/viv.py b/src/viv/viv.py index 5d40735..fb5b44c 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -30,7 +30,7 @@ from pathlib import Path from textwrap import dedent, wrap from typing import Dict, List, Tuple -__version__ = "22.12a3-35-g0d0c66d-dev" +__version__ = "22.12a3-37-gbfc2592-dev" @dataclass @@ -477,7 +477,7 @@ REL_SYS_PATH_TEMPLATE = ( IMPORT_TEMPLATE = """__import__("viv").use({spec}) # noqa""" STANDALONE_TEMPLATE = r""" -# <<<<< auto-generated by daylinmorgan/viv (v.22.12a3) +# <<<<< auto-generated by daylinmorgan/viv v{version} # fmt: off {use} # fmt: on