fgr


Namefgr JSON
Version 0.4.5 PyPI version JSON
download
home_pageNone
SummaryZero-dependency Python framework for object oriented development.
upload_time2024-03-24 00:07:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords fgr framework rest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # [![banner](https://1howardcapital.s3.amazonaws.com/images/fgr/banner.png)](https://fgr.readthedocs.io)

[![MinVersion](https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/dan1hc/fgr/main/pyproject.toml&color=gold)](https://pypi.org/project/fgr)
[![PyVersions](https://img.shields.io/pypi/pyversions/fgr?color=brightgreen)](https://pypi.org/project/fgr)
[![OpenSSF](https://www.bestpractices.dev/projects/8565/badge)](https://www.bestpractices.dev/projects/8565)
[![readthedocs](https://readthedocs.org/projects/fgr/badge)](https://fgr.readthedocs.io)
[![CI](https://github.com/dan1hc/fgr/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/dan1hc/fgr/actions)
[![codeql](https://github.com/dan1hc/fgr/workflows/codeql/badge.svg)](https://github.com/dan1hc/fgr/actions/workflows/codeql.yml)
[![coverage](https://img.shields.io/badge/dynamic/toml?url=https://raw.githubusercontent.com/dan1hc/fgr/main/pyproject.toml&query=tool.coverage.report.fail_under&label=coverage&suffix=%25&color=brightgreen)](https://github.com/dan1hc/fgr/actions)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![PyPI](https://img.shields.io/pypi/v/fgr?color=blue)](https://pypi.org/project/fgr)
[![License](https://img.shields.io/pypi/l/fgr?color=blue)](https://www.gnu.org/licenses/lgpl-3.0)

# Overview

**Author:** dan@1howardcapital.com | daniel.dube@annalect.com

**Pronunciation:** _ˈfiɡər `>` ˈfiɡyər `==` "figure"_

**Summary:** Zero-dependency python framework for object oriented development.
Implement _once_, document _once_, in _one_ place.

> With fgr, you will quickly learn established best practice...
> or face the consequences of runtime errors that will break your code
> if you deviate from it.
>
> Experienced python engineers will find a framework
> that expects and rewards intuitive magic method usage,
> consistent type annotations, and robust docstrings.
>
> Implement _pythonically_ with fgr and you will only ever need to:
> implement _once_, document _once_, in _one_ place.

---

## Mission Statement

Ultimately, fgr seeks to capture and abstract all recurring patterns in
application development with known, optimal implementations, so engineers
can focus more on clever implementation of application-specific logic and good
documentation than on things like how to query X database most efficiently,
whether or not everything important is being logged correctly, where to
put what documentation, and how to implement an effective change management
scheme with git in the first place.

## Getting Started

### Installation

```bash
pip install fgr
```

### Basic Usage

```py
import fgr


class Pet(fgr.Object):
    """A pet."""

    id_: fgr.Field[int]
    name: fgr.Field[str]
    type_: fgr.Field[str] = {
        'default': 'dog',
        'enum': ['cat', 'dog'],
        'nullable': False,
        'required': True,
        }
    is_tail_wagging: fgr.Field[bool] = fgr.Field(
        default=True,
        enum=[True, False],
        nullable=False,
        required=True,
        )

```

## Best Practice - Guard Rails at a Bowling Alley

fgr has been designed from the outset to teach best practice to less
experienced python engineers, without compromising their ability to
make effective and timely contributions.

> To fgr, it is more important developers are able to make
> effective contributions while learning, rather than sacrifice
> any contribution at all until the developer fully understands
> why something that could be done many ways should only ever
> be done one way.

#### Exceptions

This is achieved primarily through the raising of exceptions.
In many cases, if a developer inadvertently deviaties from a known
best practice, fgr will raise a code-breaking error (informing
the developer of the violation) until the developer implements
the optimal solution.

#### Logging

fgr will commandeer your application's log.

* It will automatically redact sensitive data inadvertently introduced
to your log stream that would have made your application fail audits.
* It will intercept, warn once, and subsequently silence print statements,
debug statements, and other errant attempts at logging information in ways
certain to introduce a known anti-pattern, vulnerability, or otherwise
pollute your log stream.

> In short, if fgr raises an error or otherwise does not support
> the thing you are trying to do: it is because the way in which you
> are trying to do it contains at least one anti-pattern to a known,
> optimal solution.

## Advanced Usage

```py
import fgr


class Flea(fgr.Object):
    """A nuisance."""

    name: fgr.Field[str] = 'FLEA'


class Pet(fgr.Object):
    """A pet."""

    id_: fgr.Field[str]
    _alternate_id: fgr.Field[int]

    name: fgr.Field[str]
    type_: fgr.Field[str] = {
        'default': 'dog',
        'enum': ['cat', 'dog'],
        'nullable': False,
        'required': True,
        }

    in_: fgr.Field[str]
    is_tail_wagging: fgr.Field[bool] = fgr.Field(
        default=True,
        enum=[True, False],
        nullable=False,
        required=True,
        )

    fleas: fgr.Field[list[Flea]] = [
        Flea(name='flea1'),
        Flea(name='flea2')
        ]


# Automatic case handling.
request_body = {
    'id': 'abc123',
    'alternateId': 123,
    'name': 'Bob',
    'type': 'dog',
    'in': 'timeout',
    'isTailWagging': False
    }
pet = Pet(request_body)

assert pet.is_snake_case == Pet.is_snake_case is True
assert pet.isCamelCase == Pet.isCamelCase is False
assert pet['alternate_id'] == pet._alternate_id == request_body['alternateId']
assert dict(pet) == {k: v for k, v in pet.items()} == pet.to_dict()

# Automatic, mutation-safe "default factory".
dog = Pet(id='abc321', alternate_id=321, name='Fido')
assert pet.fleas[0] is not dog.fleas[0]

# Automatic memory optimization.
assert Flea().__sizeof__() == (len(Flea.__slots__) * 8) + 16 == 24

class Flet(Flea, Pet):
    ...

class Pea(Pet, Flea):
    ...

assert Flet().__sizeof__() == (len(Flet.__base__.__slots__) * 8) + 16 == 72
assert Pea().__sizeof__() == (len(Pea.__base__.__slots__) * 8) + 16 == 72
assert Flet().name == 'FLEA' != Pea().name

# Intuitive, database agnostic query generation.
assert isinstance(Pet.is_tail_wagging, fgr.Field)
assert isinstance(Pet.type_, fgr.Field)

assert dog.type_ == Pet.type_.default == 'dog'

query = (
    (
        (Pet.type_ == 'dog')
        & (Pet.name == 'Fido')
        )
    | Pet.name % ('fido', 0.75)
    )
query += 'name'
assert dict(query) == {
    'limit': None,
    'or': [
        {
            'and': [
                {
                    'eq': 'dog',
                    'field': 'type',
                    'limit': None,
                    'sorting': []
                    },
                {
                    'eq': 'Fido',
                    'field': 'name',
                    'limit': None,
                    'sorting': []
                    }
                ],
            'limit': None,
            'sorting': []
            },
        {
            'field': 'name',
            'like': 'fido',
            'limit': None,
            'sorting': [],
            'threshold': 0.75
            }
        ],
    'sorting': [
        {
            'direction': 'asc',
            'field': 'name'
            }
        ]
    }

```

### Local Logging
```py
import fgr


class AgentFlea(fgr.Object):
    """Still a nuisance."""

    name: fgr.Field[str] = 'FLEA'
    apiKey: fgr.Field[str] = '9ac868264f004600bdff50b7f5b3e8ad'
    awsAccessKeyId: fgr.Field[str] = 'falsePositive'
    sneaky: fgr.Field[str] = 'AKIARJFBAG3EGHFG2FPN'


# Automatic log configuration, cleansing, and redaction.

print(AgentFlea())
# >>>
# {
#   "level": WARNING,
#   "time": 2024-02-26 18:50:20.317 UTC,
#   "log": fgr.core.log,
#   "data":   {
#     "message": "Calls to print() will be silenced by fgr."
#   }
# }
# {
#   "apiKey": "[ REDACTED :: API KEY ]",
#   "awsAccessKeyId": "falsePositive",
#   "name": "FLEA",
#   "sneaky": "[ REDACTED :: AWS ACCESS KEY ID ]"
# }

print(AgentFlea())
# >>>
# {
#   "apiKey": "[ REDACTED :: API KEY ]",
#   "awsAccessKeyId": "falsePositive",
#   "name": "FLEA",
#   "sneaky": "[ REDACTED :: AWS ACCESS KEY ID ]"
# }

```

### Deployed Logging

```py
import os
os.environ['ENV'] = 'DEV'

import fgr

assert (
    fgr.core.constants.PackageConstants.ENV
    in {
        'dev', 'develop',
        'qa', 'test', 'testing',
        'uat', 'stg', 'stage', 'staging',
        'prod', 'production',
        }
    )


class AgentFlea(fgr.Object):
    """Still a nuisance."""

    name: fgr.Field[str] = 'FLEA'
    apiKey: fgr.Field[str] = '9ac868264f004600bdff50b7f5b3e8ad'
    awsAccessKeyId: fgr.Field[str] = 'falsePositive'
    sneaky: fgr.Field[str] = 'AKIARJFBAG3EGHFG2FPN'


print(AgentFlea())
# >>>
# {
#   "level": WARNING,
#   "time": 2024-02-26 19:02:29.020 UTC,
#   "log": fgr.core.log,
#   "data":   {
#     "message": "Call to print() silenced by fgr.",
#     "printed": "{\n  \"apiKey\": \"[ REDACTED :: API KEY ]\",\n  \"awsAccessKeyId\": \"falsePositive\",\n  \"name\": \"FLEA\",\n  \"sneaky\": \"[ REDACTED :: AWS ACCESS KEY ID ]\"\n}"
#   }
# }

print(AgentFlea())
# >>>

fgr.log.info(AgentFlea())
# >>>
# {
#   "level": INFO,
#   "time": 2024-02-26 19:13:21.726 UTC,
#   "log": fgr.core.log,
#   "data":   {
#     "AgentFlea": {
#       "apiKey": "[ REDACTED :: API KEY ]",
#       "awsAccessKeyId": "falsePositive",
#       "name": "FLEA",
#       "sneaky": "[ REDACTED :: AWS ACCESS KEY ID ]"
#     }
#   }
# }

```

## Planned Features

* #### ~~Wiki / Sphinx Documentation Support~~ Done!
    * fgr should support a simple interface for generating wiki / sphinx
    style documentation for packages.
* #### RESTful Framework / OpenAPI Support
    * fgr should support all aspects of an OpenAPI specification and
    provide corresponding framework functionality for HTTP request
    handling.
* #### Template Packages
    * fgr should include a Pet shop style demo API and python package
    as a template for developers to copy / paste from.
* #### Database Parse & Sync
    * fgr should be able to generate a python package with fully enumerated
    and optimized `Objects` (and a corresponding fgr API package) when
    supplied with access to a database for which at least one schema may be
    inferred.
        * CLI commands like `$ fgr-api-from-sql ${api_name} ${sql_conn_string} .`
        should instantly output two ideally structured package repositories for a
        RESTful python API and corresponding object management package.
        * The package could use any supplied credentials to either query a database
        directly or make requests to a deployed API. This means the same package
        used to power the API can be distributed and pip installed across an
        organization so business intelligence, data science, and other technical
        team members can manipulate data for their needs, while leaning on
        the package to optimize queries and stay informed around permission
        boundaries and request limits.
* #### Repo Generation
    * fgr should be expanded to optionally wrap any generated packages
    in a repository pre-configured with essentials and CI that should:
        * implement an ideal [trunk-based branch strategy](https://trunkbaseddevelopment.com/),
        inline with current best practices for change management and
        developer collaboration
        * enforce python code style best practices through automated
        [linting and formatting](https://docs.astral.sh/ruff)
        * type-check python code and generate a report with [mypy](https://mypy.readthedocs.io/en/stable/index.html)
        * run tests automatically, generate reports, and prevent commits that break tests
        * automatically prevent commits that do not adhere to standardized commit
        message [conventions](https://www.conventionalcommits.org/en/v1.0.0/)
        * using those conventions, automatically [semantically version](https://python-semantic-release.readthedocs.io/en/stable/#getting-started)
        each successful PR and automatically generate and update a
        CHANGELOG.md file
        * automatically generate and publish secure wiki documentation
    * Generated repos may contain up to all of the following:
        * CHANGELOG.md
        * CODEOWNERS
        * CONTRIBUTING.md
        * .git
            * .git/hooks/
        * .github/workflows/
            * Support planned for gitlab and bamboo.
        * .gitignore
        * LICENSE
        * [.pre-commit-config.yaml](https://pre-commit.com/#intro)
        * pyproject.toml
        * README.md
        * /src
            * /package
            * /tests
* #### Async
    * Everything should be runnable as coroutines.

## Credits

* #### @sol.courtney
    * Teaching me the difference between chicken-scratch, duct tape, and bubble
    gum versus actual engineering, and why it matters.
* #### pydantic
    * A portion of whose code for dealing with aggravating things like
    handling ForwardRefs I shamelessly copy, pasted, and re-purposed.
* #### python-semantic-release
    * Much of whose CI I shamelessly copy, pasted, and re-purposed.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fgr",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Dan <dan@1howardcapital.com>",
    "keywords": "fgr, framework, rest",
    "author": null,
    "author_email": "Dan <dan@1howardcapital.com>",
    "download_url": "https://files.pythonhosted.org/packages/62/94/5bd5ae3d960c461ffc3c78201a619b643ed62c7cdb924025f6d96722fb04/fgr-0.4.5.tar.gz",
    "platform": null,
    "description": "# [![banner](https://1howardcapital.s3.amazonaws.com/images/fgr/banner.png)](https://fgr.readthedocs.io)\n\n[![MinVersion](https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/dan1hc/fgr/main/pyproject.toml&color=gold)](https://pypi.org/project/fgr)\n[![PyVersions](https://img.shields.io/pypi/pyversions/fgr?color=brightgreen)](https://pypi.org/project/fgr)\n[![OpenSSF](https://www.bestpractices.dev/projects/8565/badge)](https://www.bestpractices.dev/projects/8565)\n[![readthedocs](https://readthedocs.org/projects/fgr/badge)](https://fgr.readthedocs.io)\n[![CI](https://github.com/dan1hc/fgr/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/dan1hc/fgr/actions)\n[![codeql](https://github.com/dan1hc/fgr/workflows/codeql/badge.svg)](https://github.com/dan1hc/fgr/actions/workflows/codeql.yml)\n[![coverage](https://img.shields.io/badge/dynamic/toml?url=https://raw.githubusercontent.com/dan1hc/fgr/main/pyproject.toml&query=tool.coverage.report.fail_under&label=coverage&suffix=%25&color=brightgreen)](https://github.com/dan1hc/fgr/actions)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![PyPI](https://img.shields.io/pypi/v/fgr?color=blue)](https://pypi.org/project/fgr)\n[![License](https://img.shields.io/pypi/l/fgr?color=blue)](https://www.gnu.org/licenses/lgpl-3.0)\n\n# Overview\n\n**Author:** dan@1howardcapital.com | daniel.dube@annalect.com\n\n**Pronunciation:** _\u02c8fi\u0261\u0259r `>` \u02c8fi\u0261y\u0259r `==` \"figure\"_\n\n**Summary:** Zero-dependency python framework for object oriented development.\nImplement _once_, document _once_, in _one_ place.\n\n> With fgr, you will quickly learn established best practice...\n> or face the consequences of runtime errors that will break your code\n> if you deviate from it.\n>\n> Experienced python engineers will find a framework\n> that expects and rewards intuitive magic method usage,\n> consistent type annotations, and robust docstrings.\n>\n> Implement _pythonically_ with fgr and you will only ever need to:\n> implement _once_, document _once_, in _one_ place.\n\n---\n\n## Mission Statement\n\nUltimately, fgr seeks to capture and abstract all recurring patterns in\napplication development with known, optimal implementations, so engineers\ncan focus more on clever implementation of application-specific logic and good\ndocumentation than on things like how to query X database most efficiently,\nwhether or not everything important is being logged correctly, where to\nput what documentation, and how to implement an effective change management\nscheme with git in the first place.\n\n## Getting Started\n\n### Installation\n\n```bash\npip install fgr\n```\n\n### Basic Usage\n\n```py\nimport fgr\n\n\nclass Pet(fgr.Object):\n    \"\"\"A pet.\"\"\"\n\n    id_: fgr.Field[int]\n    name: fgr.Field[str]\n    type_: fgr.Field[str] = {\n        'default': 'dog',\n        'enum': ['cat', 'dog'],\n        'nullable': False,\n        'required': True,\n        }\n    is_tail_wagging: fgr.Field[bool] = fgr.Field(\n        default=True,\n        enum=[True, False],\n        nullable=False,\n        required=True,\n        )\n\n```\n\n## Best Practice - Guard Rails at a Bowling Alley\n\nfgr has been designed from the outset to teach best practice to less\nexperienced python engineers, without compromising their ability to\nmake effective and timely contributions.\n\n> To fgr, it is more important developers are able to make\n> effective contributions while learning, rather than sacrifice\n> any contribution at all until the developer fully understands\n> why something that could be done many ways should only ever\n> be done one way.\n\n#### Exceptions\n\nThis is achieved primarily through the raising of exceptions.\nIn many cases, if a developer inadvertently deviaties from a known\nbest practice, fgr will raise a code-breaking error (informing\nthe developer of the violation) until the developer implements\nthe optimal solution.\n\n#### Logging\n\nfgr will commandeer your application's log.\n\n* It will automatically redact sensitive data inadvertently introduced\nto your log stream that would have made your application fail audits.\n* It will intercept, warn once, and subsequently silence print statements,\ndebug statements, and other errant attempts at logging information in ways\ncertain to introduce a known anti-pattern, vulnerability, or otherwise\npollute your log stream.\n\n> In short, if fgr raises an error or otherwise does not support\n> the thing you are trying to do: it is because the way in which you\n> are trying to do it contains at least one anti-pattern to a known,\n> optimal solution.\n\n## Advanced Usage\n\n```py\nimport fgr\n\n\nclass Flea(fgr.Object):\n    \"\"\"A nuisance.\"\"\"\n\n    name: fgr.Field[str] = 'FLEA'\n\n\nclass Pet(fgr.Object):\n    \"\"\"A pet.\"\"\"\n\n    id_: fgr.Field[str]\n    _alternate_id: fgr.Field[int]\n\n    name: fgr.Field[str]\n    type_: fgr.Field[str] = {\n        'default': 'dog',\n        'enum': ['cat', 'dog'],\n        'nullable': False,\n        'required': True,\n        }\n\n    in_: fgr.Field[str]\n    is_tail_wagging: fgr.Field[bool] = fgr.Field(\n        default=True,\n        enum=[True, False],\n        nullable=False,\n        required=True,\n        )\n\n    fleas: fgr.Field[list[Flea]] = [\n        Flea(name='flea1'),\n        Flea(name='flea2')\n        ]\n\n\n# Automatic case handling.\nrequest_body = {\n    'id': 'abc123',\n    'alternateId': 123,\n    'name': 'Bob',\n    'type': 'dog',\n    'in': 'timeout',\n    'isTailWagging': False\n    }\npet = Pet(request_body)\n\nassert pet.is_snake_case == Pet.is_snake_case is True\nassert pet.isCamelCase == Pet.isCamelCase is False\nassert pet['alternate_id'] == pet._alternate_id == request_body['alternateId']\nassert dict(pet) == {k: v for k, v in pet.items()} == pet.to_dict()\n\n# Automatic, mutation-safe \"default factory\".\ndog = Pet(id='abc321', alternate_id=321, name='Fido')\nassert pet.fleas[0] is not dog.fleas[0]\n\n# Automatic memory optimization.\nassert Flea().__sizeof__() == (len(Flea.__slots__) * 8) + 16 == 24\n\nclass Flet(Flea, Pet):\n    ...\n\nclass Pea(Pet, Flea):\n    ...\n\nassert Flet().__sizeof__() == (len(Flet.__base__.__slots__) * 8) + 16 == 72\nassert Pea().__sizeof__() == (len(Pea.__base__.__slots__) * 8) + 16 == 72\nassert Flet().name == 'FLEA' != Pea().name\n\n# Intuitive, database agnostic query generation.\nassert isinstance(Pet.is_tail_wagging, fgr.Field)\nassert isinstance(Pet.type_, fgr.Field)\n\nassert dog.type_ == Pet.type_.default == 'dog'\n\nquery = (\n    (\n        (Pet.type_ == 'dog')\n        & (Pet.name == 'Fido')\n        )\n    | Pet.name % ('fido', 0.75)\n    )\nquery += 'name'\nassert dict(query) == {\n    'limit': None,\n    'or': [\n        {\n            'and': [\n                {\n                    'eq': 'dog',\n                    'field': 'type',\n                    'limit': None,\n                    'sorting': []\n                    },\n                {\n                    'eq': 'Fido',\n                    'field': 'name',\n                    'limit': None,\n                    'sorting': []\n                    }\n                ],\n            'limit': None,\n            'sorting': []\n            },\n        {\n            'field': 'name',\n            'like': 'fido',\n            'limit': None,\n            'sorting': [],\n            'threshold': 0.75\n            }\n        ],\n    'sorting': [\n        {\n            'direction': 'asc',\n            'field': 'name'\n            }\n        ]\n    }\n\n```\n\n### Local Logging\n```py\nimport fgr\n\n\nclass AgentFlea(fgr.Object):\n    \"\"\"Still a nuisance.\"\"\"\n\n    name: fgr.Field[str] = 'FLEA'\n    apiKey: fgr.Field[str] = '9ac868264f004600bdff50b7f5b3e8ad'\n    awsAccessKeyId: fgr.Field[str] = 'falsePositive'\n    sneaky: fgr.Field[str] = 'AKIARJFBAG3EGHFG2FPN'\n\n\n# Automatic log configuration, cleansing, and redaction.\n\nprint(AgentFlea())\n# >>>\n# {\n#   \"level\": WARNING,\n#   \"time\": 2024-02-26 18:50:20.317 UTC,\n#   \"log\": fgr.core.log,\n#   \"data\":   {\n#     \"message\": \"Calls to print() will be silenced by fgr.\"\n#   }\n# }\n# {\n#   \"apiKey\": \"[ REDACTED :: API KEY ]\",\n#   \"awsAccessKeyId\": \"falsePositive\",\n#   \"name\": \"FLEA\",\n#   \"sneaky\": \"[ REDACTED :: AWS ACCESS KEY ID ]\"\n# }\n\nprint(AgentFlea())\n# >>>\n# {\n#   \"apiKey\": \"[ REDACTED :: API KEY ]\",\n#   \"awsAccessKeyId\": \"falsePositive\",\n#   \"name\": \"FLEA\",\n#   \"sneaky\": \"[ REDACTED :: AWS ACCESS KEY ID ]\"\n# }\n\n```\n\n### Deployed Logging\n\n```py\nimport os\nos.environ['ENV'] = 'DEV'\n\nimport fgr\n\nassert (\n    fgr.core.constants.PackageConstants.ENV\n    in {\n        'dev', 'develop',\n        'qa', 'test', 'testing',\n        'uat', 'stg', 'stage', 'staging',\n        'prod', 'production',\n        }\n    )\n\n\nclass AgentFlea(fgr.Object):\n    \"\"\"Still a nuisance.\"\"\"\n\n    name: fgr.Field[str] = 'FLEA'\n    apiKey: fgr.Field[str] = '9ac868264f004600bdff50b7f5b3e8ad'\n    awsAccessKeyId: fgr.Field[str] = 'falsePositive'\n    sneaky: fgr.Field[str] = 'AKIARJFBAG3EGHFG2FPN'\n\n\nprint(AgentFlea())\n# >>>\n# {\n#   \"level\": WARNING,\n#   \"time\": 2024-02-26 19:02:29.020 UTC,\n#   \"log\": fgr.core.log,\n#   \"data\":   {\n#     \"message\": \"Call to print() silenced by fgr.\",\n#     \"printed\": \"{\\n  \\\"apiKey\\\": \\\"[ REDACTED :: API KEY ]\\\",\\n  \\\"awsAccessKeyId\\\": \\\"falsePositive\\\",\\n  \\\"name\\\": \\\"FLEA\\\",\\n  \\\"sneaky\\\": \\\"[ REDACTED :: AWS ACCESS KEY ID ]\\\"\\n}\"\n#   }\n# }\n\nprint(AgentFlea())\n# >>>\n\nfgr.log.info(AgentFlea())\n# >>>\n# {\n#   \"level\": INFO,\n#   \"time\": 2024-02-26 19:13:21.726 UTC,\n#   \"log\": fgr.core.log,\n#   \"data\":   {\n#     \"AgentFlea\": {\n#       \"apiKey\": \"[ REDACTED :: API KEY ]\",\n#       \"awsAccessKeyId\": \"falsePositive\",\n#       \"name\": \"FLEA\",\n#       \"sneaky\": \"[ REDACTED :: AWS ACCESS KEY ID ]\"\n#     }\n#   }\n# }\n\n```\n\n## Planned Features\n\n* #### ~~Wiki / Sphinx Documentation Support~~ Done!\n    * fgr should support a simple interface for generating wiki / sphinx\n    style documentation for packages.\n* #### RESTful Framework / OpenAPI Support\n    * fgr should support all aspects of an OpenAPI specification and\n    provide corresponding framework functionality for HTTP request\n    handling.\n* #### Template Packages\n    * fgr should include a Pet shop style demo API and python package\n    as a template for developers to copy / paste from.\n* #### Database Parse & Sync\n    * fgr should be able to generate a python package with fully enumerated\n    and optimized `Objects` (and a corresponding fgr API package) when\n    supplied with access to a database for which at least one schema may be\n    inferred.\n        * CLI commands like `$ fgr-api-from-sql ${api_name} ${sql_conn_string} .`\n        should instantly output two ideally structured package repositories for a\n        RESTful python API and corresponding object management package.\n        * The package could use any supplied credentials to either query a database\n        directly or make requests to a deployed API. This means the same package\n        used to power the API can be distributed and pip installed across an\n        organization so business intelligence, data science, and other technical\n        team members can manipulate data for their needs, while leaning on\n        the package to optimize queries and stay informed around permission\n        boundaries and request limits.\n* #### Repo Generation\n    * fgr should be expanded to optionally wrap any generated packages\n    in a repository pre-configured with essentials and CI that should:\n        * implement an ideal [trunk-based branch strategy](https://trunkbaseddevelopment.com/),\n        inline with current best practices for change management and\n        developer collaboration\n        * enforce python code style best practices through automated\n        [linting and formatting](https://docs.astral.sh/ruff)\n        * type-check python code and generate a report with [mypy](https://mypy.readthedocs.io/en/stable/index.html)\n        * run tests automatically, generate reports, and prevent commits that break tests\n        * automatically prevent commits that do not adhere to standardized commit\n        message [conventions](https://www.conventionalcommits.org/en/v1.0.0/)\n        * using those conventions, automatically [semantically version](https://python-semantic-release.readthedocs.io/en/stable/#getting-started)\n        each successful PR and automatically generate and update a\n        CHANGELOG.md file\n        * automatically generate and publish secure wiki documentation\n    * Generated repos may contain up to all of the following:\n        * CHANGELOG.md\n        * CODEOWNERS\n        * CONTRIBUTING.md\n        * .git\n            * .git/hooks/\n        * .github/workflows/\n            * Support planned for gitlab and bamboo.\n        * .gitignore\n        * LICENSE\n        * [.pre-commit-config.yaml](https://pre-commit.com/#intro)\n        * pyproject.toml\n        * README.md\n        * /src\n            * /package\n            * /tests\n* #### Async\n    * Everything should be runnable as coroutines.\n\n## Credits\n\n* #### @sol.courtney\n    * Teaching me the difference between chicken-scratch, duct tape, and bubble\n    gum versus actual engineering, and why it matters.\n* #### pydantic\n    * A portion of whose code for dealing with aggravating things like\n    handling ForwardRefs I shamelessly copy, pasted, and re-purposed.\n* #### python-semantic-release\n    * Much of whose CI I shamelessly copy, pasted, and re-purposed.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Zero-dependency Python framework for object oriented development.",
    "version": "0.4.5",
    "project_urls": {
        "Changelog": "https://github.com/dan1hc/fgr/blob/main/CHANGELOG.md",
        "Documentation": "https://fgr.readthedocs.io/en/stable/fgr.html",
        "Homepage": "https://fgr.readthedocs.io/en/stable/",
        "Issues": "https://github.com/dan1hc/fgr/issues",
        "Repository": "https://github.com/dan1hc/fgr.git"
    },
    "split_keywords": [
        "fgr",
        " framework",
        " rest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5f41b7195d43d7e62d3f78572f329f611ed9ca62f47bfde2f4a379cbb062d96",
                "md5": "3ee234d0f2608d9f22f3b8662ce3e612",
                "sha256": "88d54801ae0fdfcf5f1ca0d9085da56cb6c3e107ca1986657e4775c8edb1e233"
            },
            "downloads": -1,
            "filename": "fgr-0.4.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3ee234d0f2608d9f22f3b8662ce3e612",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 279689,
            "upload_time": "2024-03-24T00:07:38",
            "upload_time_iso_8601": "2024-03-24T00:07:38.574522Z",
            "url": "https://files.pythonhosted.org/packages/d5/f4/1b7195d43d7e62d3f78572f329f611ed9ca62f47bfde2f4a379cbb062d96/fgr-0.4.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62945bd5ae3d960c461ffc3c78201a619b643ed62c7cdb924025f6d96722fb04",
                "md5": "807e68053d7efefc18bc604e808a93de",
                "sha256": "738d6c28fab0aded01fdffa92e023f641ae450e711e0a78463cad1129595b1cc"
            },
            "downloads": -1,
            "filename": "fgr-0.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "807e68053d7efefc18bc604e808a93de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 276301,
            "upload_time": "2024-03-24T00:07:40",
            "upload_time_iso_8601": "2024-03-24T00:07:40.578549Z",
            "url": "https://files.pythonhosted.org/packages/62/94/5bd5ae3d960c461ffc3c78201a619b643ed62c7cdb924025f6d96722fb04/fgr-0.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 00:07:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dan1hc",
    "github_project": "fgr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fgr"
}
        
Elapsed time: 0.22223s