big updates to a package

This commit is contained in:
Tyler Starr 2024-07-14 11:20:37 -07:00
parent 7c6c85cdfd
commit 2005b46c77
11 changed files with 52 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
__pycache__/
.venv/
*.egg-info/
build/

0
config.toml Normal file
View File

15
default.nix Normal file
View File

@ -0,0 +1,15 @@
with (import <nixpkgs> {});
mkShell {
buildInputs = with pkgs.python3Packages; [
python
venvShellHook
];
venvDir = "./.venv";
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
'';
postShellHook = ''
unset SOURCE_DATE_EPOCH
'';
}

24
pyproject.toml Normal file
View File

@ -0,0 +1,24 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "z-py"
version = "0.0.1"
authors = [
{name = "Tyler Starr", email= "starrtyler88@gmail.com"}
]
description = "Personal note taking framework."
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent"
]
dependencies = [
]
[project.urls]
"Homepage" = "https://github.com/starr-dusT/z-py"
"Repository" = "https://github.com/starr-dusT/z-py"
[project.scripts]
z = "z.z:main"

2
src/z/__init__.py Normal file
View File

@ -0,0 +1,2 @@
from .z import *
from .create import *

5
src/z/__main__.py Normal file
View File

@ -0,0 +1,5 @@
from z.z import main
import sys
if __name__ == "__main__":
sys.exit(main())

View File

@ -1,5 +1,5 @@
from argparse import ArgumentTypeError
from template import apply_template
from z.template import apply_template
from pathlib import Path
from typing import List
import datetime

View File

@ -1,4 +1,4 @@
import template_funcs as tf
from z import template_funcs
from pathlib import Path
from typing import List
import re
@ -14,4 +14,4 @@ def split_template(s: str) -> (List[str], str):
def apply_template(path: Path, name: str):
fns, s = split_template(read_file(path, name))
return s.format(*[eval("tf." + fn)() for fn in fns])
return s.format(*[eval("template_funcs." + fn)() for fn in fns])

View File

@ -1,10 +1,8 @@
from pathlib import Path
import argparse
import create
from z import create
import sys
folder = "dude2"
def init_parser():
parser = argparse.ArgumentParser(prog="z.py", description="top level prog")
sub_parsers = parser.add_subparsers(help="subcommand help")
@ -19,7 +17,6 @@ def main():
z_file = Path("./.z")
if not z_file.is_file():
raise Exception("You aren't in a z.py folder. Re-run in a z.py folder")
parser = init_parser()
args = parser.parse_args()
args.func(args)