Pyttman

Latest version: v1.3.2

Safety actively analyzes 638418 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 4

1.2.0.3

This is a hotfix release, fixing an issue with default values in
TextEntityFields, causing a crash if it was combined with `as_list=True`, and
`valid_strings`.


**🐛 Splatted bugs and corrected issues**
* **Fixes [68](https://github.com/dotchetter/Pyttman/issues/68)**

1.2.0.2

This is a hotfix release, fixing an issue with EntityFields with `valid_strings`
configured combined with 'suffixes' and/or 'prefixes',
where the 'prefixes' and/or 'suffixes' were ignored, if an entity matched
a string mentioned in 'valid_strings'.

1.2.0.1

This is a hotfix release, fixing an issue with EntityFields with `as_list`
configured, where it would append an infinite amount of matching strings,
when in fact, it should only add as many as defined in `span`.


**🐛 Splatted bugs and corrected issues**
* **Fixes [66](https://github.com/dotchetter/Pyttman/issues/66)**

1.2.0

This is a minor release, containing new improved features, some changes
and bug fixes, where the first point on the News list is the reason for this release being a minor release.

:star2: News
* **Accessing the `Ability` instance in an `Intent` class**

in Pyttman, the relationship between an Ability and Intent classes have
been parent->child, with no way to access the Ability instance from the Intent.
This is now possible, which allows for accessing methods which Intents may share.
To access the Ability from an Intent, you can do so with `self.ability` in all Intent methods.
This is, however, not a breaking change: backwards compatibility is still supported, meaning
apps with `EntityParser` inner classes will continue to work normally.


* **`BoolEntityField` defaults to False**

Instead of defaulting to `None`, the `BoolEntityField` class now more appropriately
defaults to `False` if the sought pattern isn't found in the message.


* **New mode in Pyttman CLI: `shell`**

The `shell` mode allows you to open your Pyttman app bootstrapped with
dependencies and environment loaded up, in an interactive shell. This is
useful where you want to try your classes using an interactive shell.
This feature is invoked using `pyttman shell <app name>`.


👀 Changes

* **Removed pytz dependency from the library**


* **Internal refactoring and code cleanup**


* **The inner class "EntityParser" is no longer used and is unsupported.**

The inner class `EntityParser` inside `Intent` classes was optional, and
added EntityParser functionality to an intent class. This class proved
to be redundant however, as the EntityParser API continues to evolve.
The need for an inner class is thus removed, and `EntityField` classes
are instead directly declared inside the `Intent` class as class fields,
more resembling other declarative API:s.

python
Old
class SomeIntent(Intent):
class EntityParser:
name = StringEntityField()


New
class SomeIntent(Intent):
name = StringEntityField()




**🐛 Splatted bugs and corrected issues**
* **Fixes [64](https://github.com/dotchetter/Pyttman/issues/63)**

1.1.12

**2022-04-10**

This mini-release contains small changes and bug fixes.

:star2: News
* **Improved behavior control when using the EntityParser Api**

Added the option for developers to state explicitly whether they want to ignore or keep any strings in 'lead' and/or 'trail' from the Intent, as possible strings
in the EntityParser.
👀 Changes

* **Internal cleaning and refactoring of our Parser code.**

Removed redundant class `AbstractParserBase`, making the `Parser` class
the base parser class in Pyttman.


* **BoolEntityField now defaults to `False`**

The `BoolEntityField` class defaults to `False` if it can't find the
sought value in a message, in comparison to the previous default `None`
as default value.

**🐛 Splatted bugs and corrected issues**
* **Fixes [63](https://github.com/dotchetter/Pyttman/issues/63)**

1.1.11

**2022-04-7**

This release improves the **EntityParser** API, packs the new `create
ability` command for the `pyttman` cli tool, and introduces a
few new other features and bugfixes.

:star2: News
* New EntityField classes

* The `TextEntityField` can now also be used as `StringEntityField` and
`StrEntityField`

* The `IntegerEntityField` can now also be used as `IntEntityField`


* New command for `pyttman` cli: `create ability`

You can now create new ability modules with the Pyttman cli tool
`pyttman` from your terminal shell. A new module is created with
`ability.py`, `intents.py` and `__init__.py` file inside. Our ambition is
that this further improves the simplicity of developing apps with Pyttman,
by streamlining the way applications grow.


* `pyttman.app`

In Pyttman, you now have access to your application represented as the
`app` object, which you can import from pyttman as: `from pyttman import
app` in any file inside your project. On this object you have access to
`settings`, `abilities` and `hooks` (mentioned further down) - which
empowers you to inspect and modify the state of your app down the road.


* **Project templates**

The project template, used when creating new projects, is no longer shipped
with the project through PyPi, but
rather downloaded from an official GitHub repository, lowering the
payload when installing the package and ensures distributions always use
the latest templates.


* **Lifecycle Hooks**

Lifecycle hooks allows you as a developer to have code executed in
certain timepoints in the lifecycle of your application.
* **Ability** lifecycle hook: 'before_create' allows you to execute code
before a certain Ability is loaded. This is useful to pre-populate the
`storage` object as `self.storage['foo'] = 'bar'` before the ability is
loaded.

* `app` lifecycle hooks allows you to import the app you've developed as:
`from pyttman import app`, and then decorating any function in the
application as `app.hooks.run('before_start')` allows you to run a
function before the entire app starts. This is useful for connecting to
databases or performing other tasks necessary to the application.
> **You can only decorate functions as app-lifecycle hooks from a
special module in your app: `app.py`. This module is automatically
imported at the start of the runtime, by Pyttman, if present in the app
root directory.**


* **Introducing support for params in `EntityField` classes to be callable**

A select set of arguments provided to EntityField classes such as
`StringEntityField` and others, can now be callables. This allows you as
a developer to have rules for EntityField classes evaluated at runtime,
and not when the app starts. This is useful for scenarios where you'd
want data from a dynamic source to control the behavior of an EntityField,
say the available users in your app.

**Example**: `username =
StringEntityField(valid_strings=get_enrolled_usernames)`


👀 Changes

> Note! This is a breaking change.
* **Further expansion of the Pyttman Middleware epic**

In applications, the `settings.py` setting called `MESSAGE_ROUTER`
changes name to `MIDDLEWARE`. This is a part of the movement toward
supporting more flexible and powerful plugins in Pyttman, where the
MessageRouter belongs as a part of this Midde-ware ecosystem.
In new apps, this setting has the updated name automatically. In apps
from previous versions of Pyttman, you must change this name in `settings.py.`


* **Refactored the `Message`, `Reply` and `ReplyStream` classes import path**

This update moves the above mentioned classes. Change imports

**from:**

`from pyttman.core.communication.models.containers import Reply, ReplyStream, Message`

**to:**

`from pyttman.core.containers import Reply, ReplyStream, Message`
*

**🐛 Splatted bugs and corrected issues**
* **Fixes [58](https://github.com/dotchetter/Pyttman/issues/58)**
* **Fixes [62](https://github.com/dotchetter/Pyttman/issues/62)**

Page 2 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.