Skip to main content

Official Python Package for creation of disy Cadenza analytics extensions

Project description

Cadenza Analytics Python

cadenzaanalytics is the official package for fast and easy creation of disy Cadenza analytics extensions with Python. It enables the extension of disy Cadenza for advanced analytics purposes with the usage of python code.

Currently, this package is in beta status: it can be used for testing, but there may be breaking changes before a full release.

Find the docs at https://disyinformationssysteme.github.io/cadenza-analytics-python

CI Pylint

Dependencies:

  • Python 3
  • Flask
  • Pandas
  • requests-toolbelt

Example:

An example extension can be found in examples/extension/example_extensions.py.

To test the example extension, clone this repository, install the dependencies, navigate to the folder examples/extension. Run the example file in your python environment e.g.:

python example_extensions.py

A development server will be started on localhost http://127.0.0.1:5005. The analytics extension can now be registered and used in disy Cadenza.

It is not recommended to use the development server in a production environment.

Development of Cadenza Analytics Python

Development Environment

Development is possible via most common IDEs such as Visual Studio Code or PyCharm. Make sure to mark the src directory as "Sources Root" to make sure cross imports from the examples directory work as expected and that imports within cadenzaanalytics can get resolved by the IDE.

Python version

We aim to support older python versions and dependencies, but best experience and most features will be available for newer versions, currently this is Python 9.12.

Versioning

Versioning of cadenzaanalytics will happen via poetry-bumpversion. On release, this will bump the version depending on the chosen release type. The project uses semantic versioning with a major, minor and patch version.

Documentation

On release, all "Unreleased" changes in the Changelog will be automatically tagged with the released version. So make sure to add relevant changelog notes for every change you make and follow the style described in the changelog file.

Pylint

Pylint is used for making sure that cadenzaanalytics follows some common styles. If necessary some rules can be disabled globally in the .pylintrc file or in the corresponding python file. There is a GitHub workflow to validate this. For some IDEs like PyCharm there are also plugins for Pylint so that linting can happen within the IDE and errors in the pipeline can be avoided.

Releasing:

Make sure to check the following

  • Does the Changelog contain all relevant information?
  • Are all relevant workflows green?
  • Do you want to make a test release to https://test.pypi.org? This is helpful to test cadenzaanalytics with existing extensions. To get the latest version immediately it might be good to disable caches, e.g. via pip install --upgrade cadenzaanalytics --extra-index-url https://test.pypi.org/simple --no-cache-dir. For a first installation in a new (virtual) environment, you can use pip install cadenzaanalytics --extra-index-url https://test.pypi.org/simple
  • To make a non-test release, choose the pypi.org deployment environment in the release dialog.

Dockerized Example Extension

To run the example (and your production application) in a docker container you will need to define the wsgi server that will run the flask app.
The provided Dockerfile in the examples uses gunicorn with some example options, for more details consult the documentation. Important is that gunicorn has access to a function creating or providing the flask app object, which for cadenzanalytics is the CadenzaAnalyticsExtensionService. The requirements file can use test releases when adding --extra-index-url https://test.pypi.org/simple in the first line. It can (re)define versions of its own or transient dependencies, but most importantly needs the cadenzaanalytics dependency.

cd /examples
docker build . -t cadenza-analytics-example
docker image list
docker run -p 8080:8080 YOUR_CREATED_IMAGE_ID 

Technical notes

The release process uses PyPi's trusted publishing, so is based on OIDC id token and uses no API token from PyPi. The relevant permission id-token: write must be given to the release-job.

The test environment test.pypi.org makes no guarantee on availability of the package or even on the account. So it might be necessary to recreate an account at some point in time.

To test and play around with poetry-bumpversion locally, you can use it as follows, see documentation of poetry and poetry-bumpversion

pipx install poetry
pipx run poetry self add poetry-bumpversion
pipx run poetry version minor -s

License:

License

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

cadenzaanalytics-0.1.22.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

cadenzaanalytics-0.1.22-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file cadenzaanalytics-0.1.22.tar.gz.

File metadata

  • Download URL: cadenzaanalytics-0.1.22.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for cadenzaanalytics-0.1.22.tar.gz
Algorithm Hash digest
SHA256 27fc7e1c65ceb979fbad318ad072edd4aaf51ad8233d7c084b2e509be569aa99
MD5 986e60df618691a55ad1930e4f33cf00
BLAKE2b-256 08bc9d208d62667732e7317697260ae967a5f8684f0745c6b1c843fe7536d5b9

See more details on using hashes here.

File details

Details for the file cadenzaanalytics-0.1.22-py3-none-any.whl.

File metadata

File hashes

Hashes for cadenzaanalytics-0.1.22-py3-none-any.whl
Algorithm Hash digest
SHA256 6fbede185268323b4e07bca9d5ffcd4560f4a5f94ca5e3432e3819cb9e50976d
MD5 862e72bb4c9e9c9efeb1569dda99f907
BLAKE2b-256 9fb4a363c19eb9b57f8186fffb3b0fc990ba7902625faf651a8927ace5c45acb

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