-
Add the Krux pip repository and python-krux-stdlib to the top of your project's
requirements.pip
file:### Optional - also available on PyPi --extra-index-url https://staticfiles.krxd.net/foss/pypi/ krux-stdlib==2.1.1
-
Code up your app. First, define your class to inherit from krux.cli.Application. In the
__init__()
method, initialize the superclass, passing in whatever parameters you need. Minimally:class TestLoggingApp( krux.cli.Application ): def __init__(self): super(TestLoggingApp, self).__init__(name='testloggingapp', syslog_facility='local0')
-
Now you are ready to define any methods you might need under your Application() subclass:
def foo_things(self): self.logger.debug("just called foo_things()")
-
Finally, call the whole kit from
main()
:def main(): app = TestLoggingApp() app.logger.debug("this is a debug level message") app.foo_things()
- Python 3.6 or above.
- pipenv
-
Clone the repository.
git clone git@github.com:krux/python-krux-stdlib.git && cd python-krux-stdlib
-
Set up a virtual environment.
pipenv install --develop
-
Hack away! Make sure to add unit tests.
-
Run tests.
pipenv run python setup.py test
-
To cut a release, update the VERSION in
krux/__init__.py
and push to GitHub. Jenkins will build and upload the new version to the Krux python repository, as well as tagging the release in git.