### Install confiGOAT from source Source: https://github.com/aag13/configoat/blob/main/docs/installation.rst Installs confiGOAT after downloading the source code (either by cloning or downloading a tarball). This command runs the setup script. ```shell python setup.py install ``` -------------------------------- ### Set up Virtual Environment and Install Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst Steps to create a virtual environment and install the local copy of configoat for development. ```shell mkvirtualenv configoat cd configoat/ python setup.py develop ``` -------------------------------- ### Install confiGOAT from Source Source: https://github.com/aag13/configoat/blob/main/README.md Installs confiGOAT by cloning the repository from GitHub and then installing it locally. This is useful for developers who want to use the latest unreleased code or contribute to the project. ```bash git clone https://github.com/aag13/configoat cd configoat pip install . ``` -------------------------------- ### Clone confiGOAT repository Source: https://github.com/aag13/configoat/blob/main/docs/installation.rst Clones the confiGOAT GitHub repository to install from source. This allows for development or installation of the latest unreleased code. ```console $ git clone git://github.com/aag13/configoat ``` -------------------------------- ### Initialize confiGOAT Project Setup Source: https://github.com/aag13/configoat/blob/main/README.md Initializes the configuration setup for a new or existing project. This command creates necessary directories and files for confiGOAT to manage configurations. ```bash configoat init ``` -------------------------------- ### Install confiGOAT with pip Source: https://github.com/aag13/configoat/blob/main/README.md Installs the confiGOAT package using pip, the Python package installer. This is the recommended method for most users. ```bash pip install configoat ``` -------------------------------- ### Package Management and Installation Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Commands for installing project dependencies using pip. This includes installing specific packages and potentially managing virtual environments. ```shell pip install bump2version wheel watchdog flake8 tox coverage Sphinx twine Click pyyaml pytest ``` -------------------------------- ### Install confiGOAT using pip Source: https://github.com/aag13/configoat/blob/main/docs/installation.rst Installs the latest stable release of confiGOAT using pip, the Python package installer. This is the recommended installation method. ```console $ pip install configoat ``` -------------------------------- ### Download confiGOAT tarball Source: https://github.com/aag13/configoat/blob/main/docs/installation.rst Downloads the confiGOAT source code as a tarball from GitHub for installation from source. This is an alternative to cloning the repository. ```console $ curl -OJL https://github.com/aag13/configoat/tarball/master ``` -------------------------------- ### Code Quality and Linting Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Tools for ensuring code quality and adherence to style guides. Flake8 checks for style guide violations and potential errors, while coverage measures test execution. ```shell flake8 . coverage run -m pytest coverage report ``` -------------------------------- ### Access Configuration via Dot Notation Source: https://github.com/aag13/configoat/blob/main/README.md Demonstrates accessing configuration variables using dot notation with the `conf` object. The '@' symbol refers to the root of the configuration. The `get` method can also be used, optionally with default values and casting functions. ```python print(conf("@.VARIABLE_NAME")) print(conf("@.NESTED.VARIABLE_NAME")) print(conf.get("@.VARIABLE_NAME")) print(conf.get("@.NESTED.VARIABLE_NAME")) ``` ```python print(conf("@.VARIABLE_NAME", default=10, cast=int)) print(conf.get("@.VARIABLE_NAME", default=10, cast=int)) ``` -------------------------------- ### Nested Variable Reference Source: https://github.com/aag13/configoat/blob/main/README.md Reference a variable located in a different configuration file or nested within another variable. Use '$ref(@.nested1.varAA)' where '@.nested1.varAA' is the dot notation path to the variable, starting from the root file. ```yaml target_var: type: 'common' value: "$ref(@.nested1.varAA)" ``` -------------------------------- ### Initialize Configoat with YAML and Environment Source: https://github.com/aag13/configoat/blob/main/README.md Initializes Configoat by loading configurations from a YAML file and specifying the environment. It also sets a namespace for dynamic module access. It's recommended to fetch the environment dynamically from runtime sources like environment variables. ```python from configoat import conf conf.initialize(config="configs/main.yaml", env="dev", module="all_config") ``` ```python import os from configoat import conf current_env = os.getenv("YOUR_ENVIRONMENT_VARIABLE") conf.initialize(config="configs/main.yaml", env=current_env, module="all_config") ``` -------------------------------- ### Clone configoat Repository Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst Instructions for cloning the configoat repository locally after forking it on GitHub. ```shell git clone git@github.com:your_name_here/configoat.git ``` -------------------------------- ### Command-Line Interface Development Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Click is a framework for creating beautiful command-line interfaces in Python. It simplifies argument parsing and command creation. ```python import click @click.command() @click.option('--count', default=1, help='Number of greetings.') @click.option('--name', prompt='Your name', help='The person to greet.') def hello(count, name): """Simple program that greets NAME for a total of COUNT times.""" for _ in range(count): click.echo(f"Hello {name}!") if __name__ == '__main__': hello() ``` -------------------------------- ### Package Distribution Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Tools for building and distributing Python packages. Wheel creates built distributions, and twine uploads packages to PyPI. ```shell python setup.py sdist bdist_wheel twine upload dist/* ``` -------------------------------- ### Run Tests and Linting Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst Commands to check code quality and run tests using flake8 and tox, ensuring compatibility with multiple Python versions. ```shell flake8 configoat tests python setup.py test or pytest tox ``` -------------------------------- ### Documentation Generation Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Sphinx is employed for generating project documentation. It processes reStructuredText files to create HTML and other formats. ```shell sphinx-build -b html sourcedir builddir ``` -------------------------------- ### Commit and Push Changes Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst Steps to stage, commit, and push local changes to a feature branch on GitHub. ```shell git add . git commit -m "Your detailed description of your changes." git push origin name-of-your-bugfix-or-feature ``` -------------------------------- ### Testing and Continuous Integration Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Pytest is used for writing and running tests. Tox automates the testing process across different Python environments, ensuring compatibility. ```shell pytest tox ``` -------------------------------- ### Deploying Changes Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst Commands for maintainers to version, commit, and push changes for deployment, including updating the history file. ```shell bump2version patch # possible: major / minor / patch git push git push --tags ``` -------------------------------- ### File System Monitoring Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Watchdog provides an API for monitoring file system events. It can be used to trigger actions when files change. ```python import time from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler class MyHandler(FileSystemEventHandler): def on_modified(self, event): print(f'Event type: {event.event_type} path : {event.src_path}') if __name__ == '__main__': event_handler = MyHandler() observer = Observer() observer.schedule(event_handler, path='.', recursive=True) observer.start() try: while True: time.sleep(1) except KeyboardInterrupt: observer.stop() observer.join() ``` -------------------------------- ### Main YAML Structure Source: https://github.com/aag13/configoat/blob/main/README.md The root structure of a main YAML configuration file in Configoat, containing a 'doc' for descriptions and 'resources' for variables. ```yaml doc: 'This is the main config file where the processing starts from' resources: ... ``` -------------------------------- ### Import confiGOAT Source: https://github.com/aag13/configoat/blob/main/docs/usage.rst Shows the standard Python import statement for using the confiGOAT library. This is the first step to access its functionalities for managing project configurations. ```python import configoat ``` -------------------------------- ### Configuration Management Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt PyYAML is used for parsing YAML files, commonly used for project configuration. ```python import yaml with open('config.yaml', 'r') as file: config = yaml.safe_load(file) print(config['database']['host']) ``` -------------------------------- ### Version Bumping Source: https://github.com/aag13/configoat/blob/main/requirements_dev.txt Utilizes bump2version to manage project versioning. This tool helps in automating the process of updating version numbers in configuration files. ```shell bump2version patch bump2version minor bump2version major ``` -------------------------------- ### Configoat Variable Referencing: Same File Source: https://github.com/aag13/configoat/blob/main/README.md Demonstrates referencing a variable ('SIBLING') located in the same configuration file. The '$ref(SIBLING)' syntax is used in the target variable's value. ```yaml target_var: type: 'common' value: "$ref(SIBLING)" ``` -------------------------------- ### Configoat Resource Type: Script Source: https://github.com/aag13/configoat/blob/main/README.md Integrates variables from a Python script. The 'path' property points to the script, and 'variable_list' specifies which variables from the script will be accessible. ```yaml var9: type: 'script' variable_list: ['a', 'b', 'c', 'd', 'e'] path: 'path/from/project/root/to/script.py' ``` -------------------------------- ### Run Specific Tests Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst How to execute a subset of tests using pytest, targeting a specific test file. ```shell pytest tests.test_configoat ``` -------------------------------- ### Access Configuration via Dynamic Module Source: https://github.com/aag13/configoat/blob/main/README.md Shows how to access configuration variables through dynamically created Python modules based on the configuration's nested structure. This allows importing and accessing variables as attributes of these modules. ```python # accessing variables from the root module name, i.e. all_config import all_config print(all_config.var3) print(all_config.var2.var4) ``` ```python # importing all variables using * from the root module name, i.e. all_config from all_config import * print(var3) print(var2.var4) ``` ```python from all_config import var2 as current print(current.var4) ``` -------------------------------- ### Sibling Variable Reference Source: https://github.com/aag13/configoat/blob/main/README.md Reference a variable located in the same configuration file. This is achieved by using '$ref(SIBLING)' where SIBLING is the name of the variable in the same file. ```yaml target_var: type: 'common' value: "$ref(SIBLING)" ``` -------------------------------- ### Create a New Branch Source: https://github.com/aag13/configoat/blob/main/CONTRIBUTING.rst Command to create a new branch for local development of a bug fix or new feature. ```shell git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Configoat Resource Type: Normal Source: https://github.com/aag13/configoat/blob/main/README.md Defines a configuration variable whose value differs across environments. Supports various data types like string, integer, float, boolean, list, and dictionary. ```yaml var1: type: 'normal' value: dev: 'value of var1 for dev' stage: 'value of var1 for stage' uat: 'value of var1 for uat' production: 'value of var1 for production' qa: 'value of var1 for qa' ``` -------------------------------- ### Configoat Resource Type: Common Source: https://github.com/aag13/configoat/blob/main/README.md Defines a configuration variable with a value that is the same across all environments. Supports string, integer, float, boolean, list, and dictionary data types. ```yaml var2: type: 'common' value: "value of var2" var3: type: 'common' value: False var4: type: 'common' value: 100 var5: type: 'common' value: [ "Banana", "Mango", "Apple" ] var6: type: 'common' value: { "name": "Raihan The Boss", "age": 66, "address": { "city": "Dhaka", "country": "Bangladesh" } } ``` -------------------------------- ### Configoat Resource Type: Nested YAML Source: https://github.com/aag13/configoat/blob/main/README.md Includes variables from another YAML file. The 'path' property specifies the relative path to the nested YAML file. Variables from the nested file are available under the namespace of this variable. ```yaml var7: type: 'nested' path: 'path/from/project/root/to/nested.yaml' ``` -------------------------------- ### Configoat Variable Referencing: Nested File Source: https://github.com/aag13/configoat/blob/main/README.md Shows how to reference a variable ('varAA') within a nested YAML file ('nested1'). The reference uses dot notation: '$ref(nested1.varAA)'. ```yaml target_var: type: 'common' value: "$ref(nested1.varAA)" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.