Skip to main content

From the same Root.

Project description

======== Cognate

Welcome to Cognate, a package designed with making it easy to create component services. Cognate strives to ease the burden of configuration management and logging configuration, by providing the infrastructure. Cognate fosters component service architectures by making the design, implementation, and testing of services less of a chore.

A sample hello world component:

from cognate.component_core import ComponentCore
import sys

class HelloWorld(ComponentCore):
    def __init__(self, name='World', **kwargs):
        self.name = name

        super().__init__(**kwargs)

    def cognate_options(self, arg_parser):
        arg_parser.add_argument(
            '--name',
            default=self.name,
            help='Whom will receive the salutation.')

    def run(self):
        self.log.info('Hello %s', self.name)


if __name__ == '__main__':
    argv = sys.argv
    service = HelloWorld(argv=argv)
    service.run()

Allows for the executable:

$ python hello_world.py -h
usage: hello_world.py [-h] [--service_name SERVICE_NAME]
                      [--log_level {debug,info,warn,error}]
                      [--log_path LOG_PATH] [--verbose] [--name NAME]

optional arguments:
  -h, --help            show this help message and exit
  --service_name SERVICE_NAME
                        This will set the name for the current instance.
                        This will be reflected in the log output.
                        (default: HelloWorld)
  --log_level {debug,info,warn,error}
                        Set the log level for the log output. (default: error)
  --log_path LOG_PATH   Set the path for log output. The default file created
                        is "<log_path>/<service_name>.log". If the path
                        ends with a ".log" extension, then the path be a
                        target file. (default: None)
  --verbose             Enable verbose log output to console. Useful for
                        debugging. (default: False)
  --name NAME           Whom will receive the salutation. (default: World)

Documentation

For the latest documentation, visit http://neoinsanity.github.io/cognate.

Getting Cognate

Installation

Use pip to install Cognate.

pip install cognate

Source

The latest stable release source of Cognate can be found on the master branch at https://github.com/neoinsanity/cognate/tree/master.

For the latest development code, use the develop branch at https://github.com/neoinsanity/cognate. Please note that the development branch may change without notification.

To install Cognate from source utilize the setup.py:

python setup.py install

Project Development

If you are interested in developing Cognate code, utilize the helper scripts in the cognate/bin directory.

Setup the Development Environment

Prior to running the dev setup scripts, ensure that you have virtualenv installed. All setup commands are assumed to be run from the project root, which is the directory containing the setup.py file.

Prep the development environment with the command:

bin/dev_setup.sh

This command will setup the virtualenv for the project in the directory /venv. It will also install the Cognate in a develop mode, with the creation of a development egg file.

Enable the Development Environment

To make it easy to ensure a correctly configured development session, utilize the command:

. bin/enable_dev.sh

or

source bin/enable_dev.sh

Note that the script must be sourced, as it will enable a virtualenv session and add the bin directory scripts to environment PATH.

Running Tests

To run the unit tests:

run_tests.sh

A BUILD/COVERAGE_REPORT directory will be generated with the test coverage report. To view the report, open index.html in the generated directory in a browser.

Building Documentation

To run the documentation generation:

doc_build.sh

A BUILD//doc/build directory will be generated with the documentation. To view the documentation, open index.html in the generated directory in a browser.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cognate-1.0.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

cognate-1.0.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file cognate-1.0.0.tar.gz.

File metadata

  • Download URL: cognate-1.0.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for cognate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b61e3f00761906d2c4055b17bf455d49a6cca70e5782cab0f4652e563674dba
MD5 4a890ebe27c0dff9c574b66ae3bc9d6b
BLAKE2b-256 3980244ecd6236070b763f75789922771630e91c5050615d1bea2c1f242e7981

See more details on using hashes here.

File details

Details for the file cognate-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cognate-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for cognate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32c25a5086580500e3ecff63de8d9a05b96363c8af828ce309dd4911a628a0ab
MD5 f5005bbb7ad3745ee023770dc7e1ef15
BLAKE2b-256 e328c17b708ca52ea6b45253d48586ed44a0f62cecb7b4ad17e9806d5a104c37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page