Skip to content

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dotchetter committed Dec 23, 2023
2 parents 1787bc3 + d93f672 commit 26bb610
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 67 deletions.
4 changes: 0 additions & 4 deletions devtools/create_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
subprocess.run(f"{venv_python} -m pip install multidict".split())
subprocess.run(f"{venv_python} -m pip install {package_file}".split())

clear_sc = "clear" if os.name == "posix" else "cls"
os.system(clear_sc)

os.system("cls")
print("\nFinished! Here's how to get started:",
f"1. Activate the virtual environment:\n\tcd dev_env\n\tvenv/scripts/activate",
f"2. Run the command 'pyttman' to see available commands to the Pyttman CLI",
Expand Down
7 changes: 2 additions & 5 deletions devtools/update_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"Run devtools/create_environment.py first.")

print("Building new Pyttman package...")
os.system("deactivate")
subprocess.check_call("python devtools/build.py".split())
os.chdir(LAB_ENV_PATH.as_posix())
shutil.rmtree("venv")
subprocess.run("python -m virtualenv venv".split())

while not Path("venv").exists():
Expand All @@ -39,11 +41,6 @@
venv_python = (LAB_ENV_PATH / "venv/scripts/python.exe").as_posix()
subprocess.run(f"{venv_python} -m pip install multidict".split())
subprocess.run(f"{venv_python} -m pip install --upgrade {package_file}".split())

clear_sc = "clear" if os.name == "posix" else "cls"
os.system(clear_sc)
os.system("cls")

print("\nFinished! Here's how to get started:",
f"1. Activate the virtual environment:\n\tcd dev_env\n\tvenv/scripts/activate",
f"2. Run the command 'pyttman' to see available commands to the Pyttman CLI",
Expand Down
22 changes: 1 addition & 21 deletions pyttman/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
from datetime import datetime
from pathlib import Path
from typing import Any
import json
from collections import UserDict

import pytz

import pyttman
from pyttman.core.containers import MessageMixin, Reply
Expand Down Expand Up @@ -68,31 +64,15 @@ def __init__(self, dictionary=None, **kwargs):
self.LOG_FORMAT: str | None = None
self.LOG_TO_STDOUT: bool = False
self.STATIC_FILES_DIR: Path | None = None
self.TIME_ZONE: pytz.timezone = None

[self._set_attr(k, v) for k, v in kwargs.items()
[setattr(self, k, v) for k, v in kwargs.items()
if not inspect.ismodule(v)
and not inspect.isfunction(v)]

def __getitem__(self, item):
return self.__dict__[item]

def _set_attr(self, k, v):
tmp = v
if isinstance(v, dict):
tmp = Settings._dict_to_object(v)

setattr(self, k, tmp)

def __repr__(self):
_attrs = {name: value for name, value in self.__dict__.items()}
return f"Settings({_attrs})"

@staticmethod
def _dict_to_object(dictionary):
return json.loads(json.dumps(dictionary), object_hook=Settings)


def _generate_name(name):
"""
Generates a user-friendly name out of
Expand Down
1 change: 1 addition & 0 deletions pyttman/tools/pyttmancli/intents.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def respond(self, message: Message) -> Reply | ReplyStream:
if complaint := self.complain_app_not_found(app_name):
return Reply(complaint)

script_path = Path(script_path)
app = bootstrap_app(devmode=True, module=app_name)
app.hooks.trigger(LifeCycleHookType.before_start)
global_variables = globals().copy()
Expand Down
2 changes: 1 addition & 1 deletion pyttman/tools/pyttmancli/terraforming.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def bootstrap_app(module: str = None, devmode: bool = False,
logging_format = logging.BASIC_FORMAT

logging_handle.setFormatter(logging.Formatter(logging_format))
logger = logging.getLogger("Pyttman logger")
logger = logging.getLogger(f"Pyttman logger on app {app_name}")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging_handle)

Expand Down
2 changes: 1 addition & 1 deletion pyttman/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = "1.3.0.1"
__version__ = "1.3.1"
Binary file modified requirements.txt
Binary file not shown.
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Bug Tracker": "https://github.com/dotchetter/Pyttman/issues",
"Changelog": "https://github.com/dotchetter/Pyttman/blob/main/CHANGELOG.md"
},
author_email="simon@dotchetter.se",
author_email="simon@hashmap.se",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
Expand All @@ -40,7 +40,6 @@
"requests",
"py7zr",
"ordered_set",
"pytz"
],
entry_points={
"console_scripts": [
Expand Down
32 changes: 0 additions & 32 deletions tests/core/test_settings.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/tools/logger/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_logger_as_decorator(self):
def broken():
raise Exception("This is a log message")

@pyttman.logger()
@pyttman.logger
def working():
return "I work"

Expand Down

0 comments on commit 26bb610

Please sign in to comment.