Skip to main content

confluent keeps your language specific configs in sync

Project description

confluent

⚠️ Please don't use confluent anymore! Its development has been stopped in favour of ninja-bear, which follows the same ideology but uses different concepts in the background ⚠️

In times of distributed systems and en vogue micro-architecture it can get quite cumbersome to keep constants that are required by several components up-to-date and in sync. It can get especially hard when these components or services are written in different languages. confluent targets this issue by using a language neutral YAML configuration that lets you generate language specific config files in the style of classes, structs or consts.

Example

Alright, after all this confusing nerd-talk, lets just have a look at a simple example to see what confluent can do for you.

The example YAML file contains a property named opener with the value Hello World. Output files shall be generated for TypeScript, Python and C. In addition, the C-file shall be distributed to a Git server's config-folder (for more information please have a look at test-config.yaml).

Input (readme-config.yaml)

languages:
  - type: typescript
    property_naming: screaming_snake
    export: esm

  - type: python
    file_naming: snake
    property_naming: screaming_snake

  - type: c
    file_naming: snake
    property_naming: pascal
    distributions:
      - type: git
        path: config
        url: https://github.com/idontknow/example.git

properties:
  - type: string
    name: opener
    value: Hello World

Execute confluent

# -d is used to distribute the C-file to Git.
python3 -m confluent -c readme-config.yaml -d

Output (readme-config.ts)

export const ReadmeConfig = {
    OPENER: 'Hello World',
} as const;

Output (readme_config.py)

class ReadmeConfig:
    OPENER = 'Hello World'

Output (readme_config.h)

#ifndef README_CONFIG_H
#define README_CONFIG_H

/* Generated with confluent v0.3.0 (https://pypi.org/project/confluent/). */
const struct {
    char* Opener;
} ReadmeConfig = {
    "Hello World",
};

#endif /* README_CONFIG_H */

Currently supported languages

  • Java
  • JavaScript
  • TypeScript
  • Python
  • C
  • Go

Installation

python3 -m pip install confluent

Configuration

For detailed configuration information, please check example/test-config.yaml. All possible values are described there.

Usage

Commandline

# For more information run "python3 -m confluent -h".
python3 -m confluent -c test-config.yaml -o generated

Script

from confluent import Orchestrator

# Create Orchestrator instance from file.
orchestrator = Orchestrator.read_config('test-config.yaml')

# Write configs to 'generated' directory.
orchestrator.write('generated')

# Distribute configs (if required).
orchestrator.distribute()

How to participate

If you feel that there's a need for another language, feel free to add it. For detailed information how to add support for a new language, please refer to README.md.

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

confluent-0.3.2.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

confluent-0.3.2-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file confluent-0.3.2.tar.gz.

File metadata

  • Download URL: confluent-0.3.2.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for confluent-0.3.2.tar.gz
Algorithm Hash digest
SHA256 6f740ded9d6fc1c30fbd706138803fde5c10c5521245ba7316e99ba44bc50814
MD5 408237ad9d374151f739ddea460b3375
BLAKE2b-256 8be8eebb212ff3ea321d7067a36cc5a8498bca694be155684e812fdcb3156406

See more details on using hashes here.

File details

Details for the file confluent-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: confluent-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for confluent-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58784607d390b65459116e7f301362ced1a4e82627e00cc55ca5b4bb3130b0bc
MD5 717ccc3d67d36eef532b4d7c245a436a
BLAKE2b-256 92ce8db92e2d1594b7597fdeac507ac69cc220f516b76283089fb19bc891a289

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