diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000..9b17570 --- /dev/null +++ b/.cspell.json @@ -0,0 +1,62 @@ +{ + "language": "en", + "dictionaries": ["companies", "filetypes", "fullstack", "softwareTerms"], + "words": [ + "authelia", + "aquasecurity", + "dotenv", + "excepthook", + "gaudin", + "isoformat", + "iubp", + "jetstream", + "lfx", + "lfprojects", + "linuxfoundation", + "meltano", + "mockdata", + "searchpath", + "subproject", + "representer", + "timestamper", + "timedelta", + "uuidgen" + ], + "flagWords": [ + "abort: cancel, end, fail, halt, stop, terminate", + "abortion: cancelation, ending, failure, halting, stopping, termination", + "blackhat: attacker, malicious", + "black-hat: attacker, malicious", + "whitehat: ethical, security, researcher", + "white-hat: ethical, security, researcher", + "cripple: disable, degrade, impact", + "crippled: disabled, degraded, impacted", + "grandfathered: legacy, exempted, preauthorized", + "master: controller, primary, main, leader, parent", + "slave: agent, replica, secondary, follower, child", + "tribe: squad, team, group", + "sanity-check: test, verify, validate", + "whitelist: allowlist", + "white-list: allow-list", + "blacklist: denylist", + "black-list: deny-list" + ], + "ignorePaths": [ + ".cspell.json", + ".gitignore", + ".mega-linter.yml", + ".yamllint.yml", + "CODEOWNERS", + "LICENSE", + "LICENSE-docs", + "megalinter-reports", + "pyproject.toml", + "styles" + ], + "languageSettings": [ + { + "languageId": "markdown", + "ignoreRegExpList": ["/^\\s*```\\s*(mermaid)[\\s\\S]*?^\\s*```/gm"] + } + ] +} diff --git a/.github/workflows/license-header-check.yml b/.github/workflows/license-header-check.yml new file mode 100644 index 0000000..ed0ad81 --- /dev/null +++ b/.github/workflows/license-header-check.yml @@ -0,0 +1,26 @@ +--- +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +name: License Header Check + +"on": [pull_request] + +permissions: + contents: read + pull-requests: write + +jobs: + license-header-check: + name: License Header Check + uses: linuxfoundation/lfx-public-workflows/.github/workflows/license-header-check.yml@main + with: + copyright_line: "Copyright The Linux Foundation and each contributor to LFX." + include_files: | + [ + "*.tpl", + "*.txt", + "*.yaml", + "*.yml", + ".gitignore" + ] diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml new file mode 100644 index 0000000..a22f7e3 --- /dev/null +++ b/.github/workflows/mega-linter.yml @@ -0,0 +1,39 @@ +--- +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +name: MegaLinter + +"on": + pull_request: null + +permissions: + contents: read + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + megalinter: + name: MegaLinter + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + # Git Checkout + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 0 + + # MegaLinter + - name: MegaLinter + id: ml + # Use the Python flavor. + uses: oxsecurity/megalinter/flavors/python@62c799d895af9bcbca5eacfebca29d527f125a57 # 9.1.0 + env: + # Pass token for better rate limits. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63f3689 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +# Local and temporary files +.DS_Store +.idea/ +.vscode/ +*.swp +*~ +.env +*.env + +# MegaLinter reports +/megalinter-reports/ + +# Python environment +.venv/ +.env* +__pycache__/ +.mypy_cache/ +.ruff_cache/ diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 0000000..d6bbadf --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,2 @@ +# Ignore local Kubernetes paths. +^https?://[a-zA-Z0-9.-]+\.svc\.cluster\.local diff --git a/.mega-linter.yml b/.mega-linter.yml new file mode 100644 index 0000000..ad93907 --- /dev/null +++ b/.mega-linter.yml @@ -0,0 +1,17 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +GITHUB_COMMENT_REPORTER: false +DISABLE_LINTERS: + # Pylint errors on missing dependencies, and is redundant with ruff. + - PYTHON_PYLINT + # Pyright errors on missing dependencies. + - PYTHON_PYRIGHT + # yamllint is sufficient for us. + - YAML_PRETTIER +DISABLE_ERRORS_LINTERS: + # This may be informative but doesn't need to break the build. + - COPYPASTE_JSCPD + # Making optional to not block builds, even though it's still important! + - SPELL_CSPELL +PYTHON_ISORT_ARGUMENTS: "--src src" diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..e4fba21 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12 diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..bbee649 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,13 @@ +--- +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +extends: default +ignore: | + .git + __pycache__ + megalinter-reports + playbooks +rules: + line-length: + max: 120 + level: warning diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..32bf07f --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +Copyright The Linux Foundation and each contributor to LFX. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/LICENSE-docs b/LICENSE-docs new file mode 100644 index 0000000..4ea99c2 --- /dev/null +++ b/LICENSE-docs @@ -0,0 +1,395 @@ +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/README.md b/README.md index a8b9422..34f36db 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,97 @@ -# lfx-v2-mockdata -LFX v2 Mock Data Tooling +# LFX v2 platform mock data loader + +## Overview + +This tool generates mock data for the LFX v2 platform by running playbooks that populate projects, committees, and other resources through API calls, NATS requests, and direct NATS KV operations. + +## Prerequisites + +- Python 3.12 (managed automatically by uv) +- Local LFX v2 platform running [via Helm](https://github.com/linuxfoundation/lfx-v2-helm/tree/main/charts/lfx-platform#readme) +- `uv` package manager installed +- `jwt` CLI from [jwt-cli](https://github.com/mike-engel/jwt-cli) Rust crate available in your $PATH + +These instructions and playbooks assume the script's execution environment has access to `*.*.svc.cluster.local` Kubernetes service URLs. These URLs in the playbooks can be overridden with environmental variables as needed. + +## Setup + +### 1. Set Environment Variables + +#### NATS Configuration + +```bash +export NATS_URL="lfx-platform-nats.lfx.svc.cluster.local:4222" +``` + +#### OpenFGA Configuration + +First, confirm the OpenFGA Store ID: + +```bash +curl -sSi "http://lfx-platform-openfga.lfx.svc.cluster.local:8080/stores" +``` + +Then export the Store ID: + +```bash +export OPENFGA_STORE_ID="your-store-id-here" +``` + +#### Authentication Tokens + +Generate impersonated Heimdall JWTs for service calls using the provided helper script: + +```bash +PROJECTS_TOKEN="$(./scripts/mock-heimdall-jwt.sh lfx-v2-project-service "clients@m2m_helper")" +COMMITTEES_TOKEN="$(./scripts/mock-heimdall-jwt.sh lfx-v2-committee-service "clients@m2m_helper")" +export PROJECTS_TOKEN COMMITTEES_TOKEN +``` + +*Note: in the future we may replace this with a YAML `!jwt` macro, and pass in the just the signing key as an environment variable.* + +## Usage + +### Running Mock Data Generation + +Use uv to run the mock data tool (uv will automatically manage Python versions and virtual environments): + +```bash +# Test the script (uv will create the virtual environment automatically). +uv run lfx-v2-mockdata --help +# Load some data! +uv run lfx-v2-mockdata -t playbooks/projects/{root_project_access,base_projects,extra_projects} playbooks/committees/base_committees +``` + +**Important Notes:** +- **Order matters!** Playbook directories run in the order specified on the command line. +- Within each directory, playbooks execute in alphabetical order. +- Dependencies between playbooks should be considered when organizing execution order. Multiple passes are made to allow `!ref` calls to be resolved, but the right order will improve performance and help avoid max-retry errors. + +### Wiping Existing Data + +If you need to start fresh, wipe the NATS KV buckets: + +```bash +for bucket in projects project-settings committees committee-settings committee-members; do + nats kv rm -f $bucket + nats kv add $bucket +done +``` + +*Consider updating this documentation to also provide steps for recreating the OpenSearch index. Stale OpenFGA tuples may also be deleted, but unlike OpenSearch data, it won't impact the refreshed data to keep them.* + +### Running After Data Wipe + +When running after wiping data, you need to recreate the ROOT project first: + +```bash +uv run lfx-v2-mockdata -t playbooks/projects/recreate_root_project playbooks/projects/{root_project_access,base_projects,extra_projects} playbooks/committees/base_committees +``` + +The `recreate_root_project` playbook bypasses the API and directly creates a new ROOT project in the NATS KV bucket. + +## Playbook Structure + +The playbooks are organized by service type, to allow only loading data for the services you have in your environment. + +Please refer to the comments in the YAML files for more information on each playbook's role and purpose. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..5b2bddd --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,9 @@ +# Security policy + +## Reporting a security vulnerability + +To report a security vulnerability, please use GitHub's feature for private +security reporting. + +For more information, please read: [How to report vulnerabilities to LF projects +and foundations](https://www.linuxfoundation.org/security). diff --git a/playbooks/committees/base_committees/buf_committees.yaml b/playbooks/committees/base_committees/buf_committees.yaml new file mode 100644 index 0000000..3ef2f29 --- /dev/null +++ b/playbooks/committees/base_committees/buf_committees.yaml @@ -0,0 +1,94 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +buf_committee_project_lookup: + type: nats-request + params: + subject: lfx.projects-api.slug_to_uid + steps: + - raw: buf + +buf_committees: + type: http-request + params: + url: {{ environ.COMMITTEES_URL | default("http://lfx-v2-committee-service.lfx.svc.cluster.local:8080/committees") }} + method: POST + headers: + Authorization: Bearer {{ environ.COMMITTEES_TOKEN | default("-") }} + steps: + - json: + name: Governing Board + description: >- + The Governing Board for the Big Umbrella Foundation (BUF). + category: Board + public: true + enable_voting: true + business_email_required: true + project_uid: !ref "buf_committee_project_lookup.steps[0]._response" + requires_review: true + - json: + name: Finance Committee + description: >- + The Finance Committee for the Big Umbrella Foundation (BUF). + category: Finance Committee + public: true + enable_voting: true + business_email_required: true + parent_uid: !ref "buf_committees.steps[?json.name == 'Governing Board']._response.uid | [0]" + project_uid: !ref "buf_committee_project_lookup.steps[0]._response" + - json: + name: Marketing Committee + description: >- + The Marketing Committee for the Big Umbrella Foundation (BUF). + category: Marketing Oversight Committee/Marketing Advisory Committee + public: false + enable_voting: false + project_uid: !ref "buf_committee_project_lookup.steps[0]._response" + - json: + name: Technical Oversight Committee + description: >- + The Technical Oversight Committee for the Big Umbrella Foundation (BUF). + category: Technical Oversight Committee/Technical Advisory Committee + public: true + enable_voting: true + business_email_required: true + project_uid: !ref "buf_committee_project_lookup.steps[0]._response" + +buf_board_members: + type: http-request + params: + url: !sub "{{ environ.COMMITTEES_URL | default('http://lfx-v2-committee-service.lfx.svc.cluster.local:8080/committees') }}/${ buf_committees.steps[?json.name == 'Governing Board']._response.uid | [0] }/members?v=1" + method: POST + headers: + Authorization: Bearer {{ environ.COMMITTEES_TOKEN | default("-") }} + steps: + {% for i in range(1) %} + - json: + appointed_by: Membership Entitlement + email: {{ fake.ascii_company_email() }} + first_name: {{ fake.first_name() }} + last_name: {{ fake.last_name() }} + organization: + name: {{ fake.company() }} + website: {{ fake.url() }} + {% if i == 0 %} + role: + name: Chair + {% endif %} + status: Active + voting: + {% set start_date = fake.date_this_year() %} + # 365 days later + {% set end_date = start_date + timedelta(days=365) %} + start_date: "{{ start_date.isoformat().replace('+00:00', 'Z') }}" + end_date: "{{ end_date.isoformat().replace('+00:00', 'Z') }}" + status: {{ [ + "Alternate Voting Rep", + "Voting Rep", + "Voting Rep", + "Voting Rep", + "Observer", + "Observer", + "Emeritus", + ] | random }} + {% endfor %} diff --git a/playbooks/projects/base_projects/0_root.yaml b/playbooks/projects/base_projects/0_root.yaml new file mode 100644 index 0000000..f0ee33e --- /dev/null +++ b/playbooks/projects/base_projects/0_root.yaml @@ -0,0 +1,11 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +# This playbook uses NATS to find the project_uid of the ROOT project created +# by the projects-service init container. +root_project: + type: nats-request + params: + subject: lfx.projects-api.slug_to_uid + steps: + - raw: ROOT diff --git a/playbooks/projects/base_projects/1_tlf.yaml b/playbooks/projects/base_projects/1_tlf.yaml new file mode 100644 index 0000000..22c7e2a --- /dev/null +++ b/playbooks/projects/base_projects/1_tlf.yaml @@ -0,0 +1,69 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +base_projects: + type: http-request + params: + url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }} + method: POST + headers: + Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }} + steps: + - json: + slug: tlf + name: The Linux Foundation + description: >- + The Linux Foundation is dedicated to building sustainable ecosystems + around open source projects to accelerate technology development and + industry adoption. Founded in 2000, the Linux Foundation provides + unparalleled support for open source communities through financial + and intellectual resources, infrastructure, services, events, and + training. Working together, the Linux Foundation and its projects + form the most ambitious and successful investment in the creation of + shared technology. + public: true + formation_date: "2002-10-02" + legal_entity_name: The Linux Foundation + legal_entity_type: Incorporated Entity + logo_url: https://lf-master-project-logos-prod.s3.us-east-2.amazonaws.com/thelinuxfoundation-color.svg + parent_uid: !ref "root_project.steps[0]._response" + repository_url: https://github.com/linuxfoundation + stage: Active + website_url: https://www.linuxfoundation.org/ + - json: + slug: jdf + name: Joint Development Foundation + description: >- + The Joint Development Foundation provides the corporate and legal + infrastructure to enable groups to quickly establish and operate + lightweight collaborations to develop technical specifications, + standards, and source code. Joint Development Foundation Projects are + ideal for specification development projects or as a place to do + incubation projects before taking those projects to a larger + standards organization. + public: true + formation_date: "2014-06-06" + legal_entity_name: Joint Development Foundation + legal_entity_type: Incorporated Entity + legal_parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + repository_url: https://github.com/Joint-Development-Foundation + stage: Active + website_url: https://www.jointdevelopment.org/ + - json: + slug: lfprojects + name: LF Projects, LLC + # Yes, this really is missing a trailing period. + description: >- + LF Projects, LLC is a Delaware series limited liability company (“LF + Projects”). Projects of LF Projects (“Projects”) are established as + separate ‘series’ of LF Projects + public: true + formation_date: "2017-07-12" + parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + legal_entity_name: LF Projects, LLC + legal_entity_type: Incorporated Entity + legal_parent_uid: !ref "base_projects.steps[?json.slug == 'jdf']._response.uid | [0]" + repository_url: https://example.com/lf-projects + stage: Active + website_url: https://lfprojects.org/ diff --git a/playbooks/projects/base_projects/2_incorporated.yaml b/playbooks/projects/base_projects/2_incorporated.yaml new file mode 100644 index 0000000..6606c58 --- /dev/null +++ b/playbooks/projects/base_projects/2_incorporated.yaml @@ -0,0 +1,49 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +extra_incorporated: + # These projects are not under the `tlf` tree to make it clear they are not + # any kind of subsidiary of the Linux Foundation. These are typically + # distinct incorporated entities with an operations agreement with the LF. + type: http-request + params: + url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }} + method: POST + headers: + Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }} + steps: + {% for outer in range(12) %} + {% set project_name = generate_name(style='capital') %} + {% set outer_stage = ["Active", "Formation - Engaged"] | random %} + - json: + slug: extra_inc_{{ outer }} + name: &extra_inc_{{ outer }}_name + {{ project_name + ([" Foundation", " Project", ""] | random) }} + description: >- + {{ project_name }} + {{ lorem.get_sentence().lower() }} + {{ lorem.get_sentence() }} + public: {{ outer_stage == "Active" }} + parent_uid: !ref "root_project.steps[0]._response" + legal_entity_name: *extra_inc_{{ outer }}_name + legal_entity_type: Incorporated Entity + repository_url: https://example.com/extra_inc_{{ outer }} + stage: {{ outer_stage }} + {% for inner in range([0, 0, 1, 2] | random) %} + {% set inner_project_name = generate_name(style='capital') %} + {% set inner_stage = ["Active", "Formation - Engaged"] | random %} + - json: + slug: extra_inc_{{ outer }}_{{ inner }} + name: {{ inner_project_name + ([" Working Group", " Binary", " Project"] | random) }} + description: >- + {{ inner_project_name }} is a child project of {{ project_name }}. + # Public requires both the parent and child to be public. + public: {{ inner_stage == "Active" and outer_stage == "Active" }} + parent_uid: !ref "extra_incorporated.steps[?json.slug == 'extra_inc_{{ outer }}']._response.uid | [0]" + # Children of incorporated entities use that entity, not the LF. + # TODO: Binary projects should actually use their own name and a Series LLC type. + legal_parent_uid: !ref "extra_incorporated.steps[?json.slug == 'extra_inc_{{ outer }}']._response.uid | [0]" + repository_url: https://example.com/extra_inc_{{ outer }}/repo_{{ inner }} + stage: {{ inner_stage }} + {% endfor %} + {% endfor %} diff --git a/playbooks/projects/base_projects/3_umbrellas.yaml b/playbooks/projects/base_projects/3_umbrellas.yaml new file mode 100644 index 0000000..02572a2 --- /dev/null +++ b/playbooks/projects/base_projects/3_umbrellas.yaml @@ -0,0 +1,90 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +sample_umbrella_buf: + type: http-request + params: + url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }} + method: POST + headers: + Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }} + steps: + - json: + slug: buf + name: Big Umbrella Foundation (BUF) + description: >- + The Big Umbrella Foundation is a highly-visible project with a board and + several technical projects underneath which does not use Series LLC + projects. + public: true + formation_date: "2015-01-01" + legal_entity_name: Big Umbrella Project (BUP) + # LF is both the parent and legal parent. + parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + legal_parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + repository_url: https://example.com/buf-foundation + stage: Active + website_url: https://buf-foundation.example/ + {% for buf_child in range(25) %} + {% set buf_child_name = generate_name(style='capital') %} + - json: + slug: {{ buf_child_name | lower | replace(" ", "-") }} + name: {{ buf_child_name }} Project + description: >- + {{ buf_child_name }} + {{ lorem.get_sentence().lower() }} + {{ lorem.get_sentence() }} + public: true + # Children's parent is the umbrella; legal parent is Linux Foundation. + parent_uid: !ref "sample_umbrella_buf.steps[0]._response.uid" + legal_entity_name: {{ buf_child_name }} Project + legal_entity_type: Subproject + repository_url: https://example.com/{{ buf_child_name | lower | replace(" ", "-") }} + website_url: https://{{ buf_child_name | lower | replace(" ", "-") }}.example/ + {% endfor %} + +sample_umbrella_iubp: + type: http-request + params: + url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }} + method: POST + headers: + Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }} + steps: + - json: + slug: industry-umbrella-branded-projects-iubp + name: Industry Umbrella of Branded Projects (IUBP) + description: >- + The Industry Umbrella of Branded Projects is a highly-visible project + with a board and several distinctly-operating technical projects with + their own brands, websites, GitHub orgs. It also uses a Series LLC + structure. + public: true + formation_date: "2018-08-01" + legal_entity_name: Industry Umbrella of Branded Projects (IUBP) + # LF is both the parent and legal parent of the umbrella. + parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + legal_parent_uid: !ref "base_projects.steps[?json.slug == 'tlf']._response.uid | [0]" + stage: Active + repository_url: https://example.com/iubp-consortium + website_url: https://iubp.example/ + {% for iubp_child in range(15) %} + {% set iubp_child_name = generate_name(style='capital') %} + - json: + slug: {{ iubp_child_name | lower | replace(" ", "-") }} + name: {{ iubp_child_name }} Project + description: >- + {{ iubp_child_name }} + {{ lorem.get_sentence().lower() }} + {{ lorem.get_sentence() }} + public: true + # Of course, despite looking like valid Series LLC names, these are of + # course FAKE and for testing only. + legal_entity_name: {{ iubp_child_name }} a Series of LF Projects, LLC + legal_entity_type: Series LLC + # Children's parent is the umbrella; legal parent is LF Projects, LLC. + parent_uid: !ref "sample_umbrella_iubp.steps[0]._response.uid" + legal_parent_uid: !ref "base_projects.steps[?json.slug == 'lfprojects']._response.uid | [0]" + repository_url: https://example.com/{{ iubp_child_name | lower | replace(" ", "-") }} + website_url: https://{{ iubp_child_name | lower | replace(" ", "-") }}.example/ + {% endfor %} diff --git a/playbooks/projects/extra_projects/n_depth.yaml b/playbooks/projects/extra_projects/n_depth.yaml new file mode 100644 index 0000000..03063d0 --- /dev/null +++ b/playbooks/projects/extra_projects/n_depth.yaml @@ -0,0 +1,45 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +n_depth_tlf_lookup: + type: nats-request + params: + subject: lfx.projects-api.slug_to_uid + steps: + - raw: tlf +n_depth: + # Create a tree of projects under the LF to represent a larger-than-normal + # project depth for testing. + type: http-request + params: + url: {{ environ.PROJECTS_URL | default("http://lfx-v2-project-service.lfx.svc.cluster.local:8080/projects") }} + method: POST + headers: + Authorization: Bearer {{ environ.PROJECTS_TOKEN | default("-") }} + steps: + {% set project_name = generate_name(style='capital') %} + - json: + slug: depth_test_0 + name: {{ project_name + " Foundation" }} + description: >- + {{ project_name }} + {{ lorem.get_sentence().lower() }} + {{ lorem.get_sentence() }} + public: true + parent_uid: !ref "n_depth_tlf_lookup.steps[0]._response" + legal_parent_uid: !ref "n_depth_tlf_lookup.steps[0]._response" + stage: Active + {% for depth in range(1, 15) %} + {% set project_name = generate_name(style='capital') %} + - json: + slug: depth_test_{{ depth }} + name: {{ project_name + " Project" }} + description: >- + {{ project_name }} + {{ lorem.get_sentence().lower() }} + {{ lorem.get_sentence() }} + public: true + parent_uid: !ref "n_depth.steps[?json.slug == 'depth_test_{{ depth - 1 }}']._response.uid | [0]" + legal_parent_uid: !ref "n_depth_tlf_lookup.steps[0]._response" + stage: Active + {% endfor %} diff --git a/playbooks/projects/recreate_root_project/root.yaml b/playbooks/projects/recreate_root_project/root.yaml new file mode 100644 index 0000000..e8f4eac --- /dev/null +++ b/playbooks/projects/recreate_root_project/root.yaml @@ -0,0 +1,37 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +# Recreate the ROOT project if needed. This is also created by the +# project-service init container, but we may need to recreate it if purging +# data. At the moment, this must be done via NATS KV, because the +# projects-service model requires a parent_uid. +recreate_root_project_slug: + type: nats-kv-put + params: + bucket: projects + key: slug/ROOT + steps: + - raw: &root_project_uid + "{{ environ.PROJECTS_ROOT_UID | default(uuid()) }}" + +recreate_root_project: + type: nats-kv-put + params: + bucket: projects + key: *root_project_uid + steps: + - json: + uid: *root_project_uid + slug: ROOT + name: ROOT + description: >- + A root project for teams permissions assignment, ordinarily hidden + from users. + public: false + parent_uid: "" + stage: "" + {% set created_at = now_z() %} + # Wrap in quotes to ensure YAML doesn't interpret it as a timestamp and + # loose our preferred formatting on output. + created_at: "{{ created_at }}" + updated_at: "{{ created_at }}" diff --git a/playbooks/projects/root_project_access/global_groups.yaml b/playbooks/projects/root_project_access/global_groups.yaml new file mode 100644 index 0000000..32367ae --- /dev/null +++ b/playbooks/projects/root_project_access/global_groups.yaml @@ -0,0 +1,40 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT +--- +global_groups_root_lookup: + type: nats-request + params: + subject: lfx.projects-api.slug_to_uid + steps: + - raw: ROOT +global_groups: + # Creates OpenFGA tuples for global-group access to ROOT. + type: http-request + params: + url: '{{ + environ.OPENFGA_API_URL + | default("http://lfx-platform-openfga.lfx.svc.cluster.local:8080") + }}/stores/{{ + environ.OPENFGA_STORE_ID | default("-") + }}/write' + method: POST + steps: + - json: + writes: + tuple_keys: + # A user principal from lfx-v2-helm's values.yaml + # (authelia.authelia_user_generation.users). + - user: "user:project_super_admin" + relation: member + object: "team:project_super_admins" + # A M2M principal from lfx-v2-helm's values.yaml + # (authelia.authelia_client_generation.clients). + - user: "user:clients@m2m_test" + relation: member + object: "team:project_super_admins" + # Attach the global group with the above members to the ROOT + # project. + - user: "team:project_super_admins#member" + relation: owner + object: !sub "project:${global_groups_root_lookup.steps[0]._response || `-`}" + on_duplicate: ignore diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c5ded48 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +[project] +name = "lfx-v2-mockdata" +version = "0.1.0" +requires-python = "~=3.12.5" +dependencies = [ + "faker>=37.12.0", + "jinja2>=3.1.6", + "jmespath>=1.0.1", + "names-generator>=0.2.0", + "nats-py>=2.9.0", + "pydantic>=2.10.5", + "python-dotenv>=1.0.1", + "python-lorem>=1.3.0.post3", + "pyyaml>=6.0.2", + "requests>=2.32.4", + "structlog>=24.4.0", + "urllib3>=2.5.0", +] + +[project.scripts] +lfx-v2-mockdata = "lfx_v2_mockdata:main" + +[build-system] +requires = ["uv_build>=0.7.6,<0.8.0"] +build-backend = "uv_build" + +[tool.isort] +profile = "black" + +[tool.ruff] +target-version = "py312" +# For linting only; not intended for `ruff format`. +line-length = 100 + +[tool.ruff.lint] +select = ["E", "F", "UP", "B", "G", "I"] + +[dependency-groups] +dev = [ + "isort>=7.0.0", + "mypy>=1.17.1", + "ruff>=0.6.2", + "types-jmespath>=1.0.2.20250809", + "types-pyyaml>=6.0.12.20250822", + "types-requests>=2.32.4.20250809", +] diff --git a/scripts/mock-heimdall-jwt.sh b/scripts/mock-heimdall-jwt.sh new file mode 100755 index 0000000..00b1dd3 --- /dev/null +++ b/scripts/mock-heimdall-jwt.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +# This script requires jwt-client to be installed. See +# for instructions. + +# Ensure we were passed at least 2 arguments. +if [ "$#" -lt 2 ]; then + echo "Usage: $0 []" + exit 1 +fi + +aud=$1 +principal=$2 +email=$3 + +if [ -n "$email" ]; then + payload="{\"email\": \"$email\"}" +else + payload='{}' +fi + +key_id="$(curl -s http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks | jq -r '.keys.[0].kid')" + +if [ -z "$key_id" ]; then + echo "Failed to retrieve key ID from Heimdall" + exit 1 +fi + +pem_temp_dir=$(mktemp -d) +kubectl get secret/heimdall-signer-cert -n lfx -o json | jq -r '.data["signer.pem"]' | base64 --decode >"${pem_temp_dir}"/signer.pem + +jwt encode \ + --alg PS256 \ + --kid "$key_id" \ + --exp=+300s \ + --nbf +0s \ + --jti "$(uuidgen)" \ + --payload "aud=$aud" \ + --payload "iss=heimdall" \ + --payload "sub=${principal#clients@}" \ + --payload "principal=$principal" \ + --secret "@${pem_temp_dir}/signer.pem" \ + "${payload}" + +jwt_result=$? + +rm -rf "${pem_temp_dir}" + +exit $jwt_result diff --git a/src/custom_logging/__init__.py b/src/custom_logging/__init__.py new file mode 100644 index 0000000..ef016c8 --- /dev/null +++ b/src/custom_logging/__init__.py @@ -0,0 +1,127 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +# Special thanks to +# Copyright (c) 2023 Thomas GAUDIN +# SPDX-License-Identifier: MIT + +import logging +import sys +from types import TracebackType + +import structlog +from structlog.types import EventDict, Processor, WrappedLogger + +# Log message attribute for JSON logging. +MESSAGE_LOG_ATTRIBUTE = "message" + +# https://gist.github.com/nymous/f138c7f06062b7c43c060bf03759c29e +# Distributed under the MIT License + + +def rename_event_key(_: WrappedLogger, __: str, event_dict: EventDict) -> EventDict: + """Rename "event" key to "message" for JSON ingest compatibility.""" + event_dict[MESSAGE_LOG_ATTRIBUTE] = event_dict.pop("event") + return event_dict + + +def setup_logging(log_level: str = "INFO") -> None: + """Set up JSON or pretty logging based on whether or not this is a TTY.""" + console_timestamper = structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S") + iso_timestamper = structlog.processors.TimeStamper(fmt="iso") + # Shared processors will be used by logging entries that originate from + # either `logging` or `structlog`. + shared_processors: list[Processor] = [ + # Add log level to event dict. + structlog.stdlib.add_log_level, + # Perform %-style formatting. + structlog.stdlib.PositionalArgumentsFormatter(), + # Add extra attributes of LogRecord objects to the event dictionary + # so that values passed in the extra parameter of log methods pass + # through to log output. + structlog.stdlib.ExtraAdder(), + ] + if sys.__stdout__ is not None and sys.__stdout__.isatty(): + # Set our renderer for ProcessorFormatter. + log_renderer: Processor = structlog.dev.ConsoleRenderer() + # Add TTY processors. + shared_processors.append(console_timestamper) + else: + # Set our renderer for ProcessorFormatter. + log_renderer = structlog.processors.JSONRenderer() + # Add JSON processors. + shared_processors.append(iso_timestamper) + # Only rename the message key for JSON, because "event" is expected by + # ConsoleRenderer. + shared_processors.append(rename_event_key) + # If the "stack_info" key in the event dict is true, remove it and + # render the current stack trace in the "stack" key. + shared_processors.append(structlog.processors.StackInfoRenderer()) + # If the "exc_info" key in the event dict is either true or a + # sys.exc_info() tuple, remove "exc_info" and render the exception + # with traceback into the "exception" key. + shared_processors.append(structlog.processors.format_exc_info) + # If some value is in bytes, decode it to a Unicode str. + shared_processors.append(structlog.processors.UnicodeDecoder()) + + structlog.configure( + processors=shared_processors + + [ + # If log level is too low, halt the pipeline and throw away the log + # entry. + structlog.stdlib.filter_by_level, + # Prepare event dict for `ProcessorFormatter`. + structlog.stdlib.ProcessorFormatter.wrap_for_formatter, + ], + # `wrapper_class` is the bound logger that you get back from + # get_logger(). This one imitates the API of `logging.Logger`. + wrapper_class=structlog.stdlib.BoundLogger, + # `logger_factory` is used to create wrapped loggers that are used for + # OUTPUT. This one returns a `logging.Logger`. The final value (a JSON + # string) from the final processor (`JSONRenderer`) will be passed to + # the method of the same name as that you've called on the bound + # logger. + logger_factory=structlog.stdlib.LoggerFactory(), + # Effectively freeze configuration after creating the first bound + # logger. + cache_logger_on_first_use=True, + ) + + formatter = structlog.stdlib.ProcessorFormatter( + # These run ONLY on `logging` entries that do NOT originate within + # structlog. + foreign_pre_chain=shared_processors, + # These run on ALL entries after the pre_chain is done. + processors=[ + # Remove _record & _from_structlog. + structlog.stdlib.ProcessorFormatter.remove_processors_meta, + log_renderer, + ], + ) + + handler = logging.StreamHandler() + # Use OUR `ProcessorFormatter` to format all `logging` entries. + handler.setFormatter(formatter) + root_logger = logging.getLogger() + root_logger.addHandler(handler) + root_logger.setLevel(log_level.upper()) + + def handle_exception( + exc_type: type[BaseException], + exc_value: BaseException, + exc_traceback: TracebackType | None, + ) -> None: + """Log uncaught exceptions to the root logger. + + Log any uncaught exception instead of letting it be printed by Python + (but leave KeyboardInterrupt untouched to allow users to Ctrl+C to + stop). + """ + if issubclass(exc_type, KeyboardInterrupt): + sys.__excepthook__(exc_type, exc_value, exc_traceback) + return + root_logger.error( + "Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback) + ) + + sys.excepthook = handle_exception diff --git a/src/lfx_v2_mockdata/__init__.py b/src/lfx_v2_mockdata/__init__.py new file mode 100644 index 0000000..17700e8 --- /dev/null +++ b/src/lfx_v2_mockdata/__init__.py @@ -0,0 +1,998 @@ +# Copyright The Linux Foundation and each contributor to LFX. +# SPDX-License-Identifier: MIT + +""" +Upload mock data script with YAML playbook support. + +This script supports multiple workflow step types: +- 'http-request': HTTP requests with response handling +- 'nats-publish': NATS publish messages (fire-and-forget) +- 'nats-kv-put': NATS key-value store operations +- 'nats-request': NATS request-reply pattern with response storage + +All step types support !ref JMESPath expressions for referencing previous +step responses and dynamic data binding. + +Payload formats: +- For HTTP requests: use 'json' for JSON data, 'form' for multipart form, + 'raw' for raw bytes, or no body attribute for GET/HEAD requests +- For NATS steps: use 'json' for JSON data, 'raw' for raw UTF8 strings, + or omit both to send an empty payload + +""" + +import argparse +import asyncio +import contextvars +import datetime +import glob +import json +import os +import re +import sys +import uuid +from collections import OrderedDict +from http import HTTPMethod +from typing import Any + +import jmespath +import lorem +import nats +import requests +import structlog +import yaml +from dotenv import load_dotenv +from faker import Faker +from jinja2 import Environment, FileSystemLoader, select_autoescape +from names_generator import generate_name +from nats.aio.client import Client as NatsClient +from nats.errors import TimeoutError +from nats.js import JetStreamContext +from pydantic import BaseModel + +from custom_logging import setup_logging + +load_dotenv() + +fake = Faker() + +# Number of iterations *per playbook* to re-attempt the entire run (in order to +# resolve !ref dependencies) before giving up. +RETRIES_PER_PLAYBOOK = 3 + + +class UploadMockDataArgs(BaseModel): + """Arguments for upload_mock_data CLI.""" + + template_dirs: list[str] + dump: bool = False + dump_json: bool = False + dry_run: bool = False + upload: bool = False + force: bool = False + + +jmespath_context: contextvars.ContextVar[dict[str, Any]] = contextvars.ContextVar( + "jmespath_context" +) +jinja_env: contextvars.ContextVar[Environment] = contextvars.ContextVar("jinja_env") +args: contextvars.ContextVar[UploadMockDataArgs] = contextvars.ContextVar("args") +retries_remaining: contextvars.ContextVar[int] = contextvars.ContextVar( + "retries_remaining" +) + +# NATS connection variables. +nats_client: None | NatsClient = None +jetstream_client: None | JetStreamContext = None + +# NATS configuration. +NATS_URL = os.getenv("NATS_URL", "nats://nats:4222") +WAIT_TIMEOUT = 10 # seconds + +setup_logging() +logger = structlog.get_logger() + + +class JMESPath(yaml.YAMLObject): + """JMESPath represents a parsed !ref YAML tag. + + The !ref tag is a JMESPath expression which is late-evaluated only when the + object is serialized to JSON. This allows the expression to point to output + values that don't exist in the source YAML. + """ + + def __init__(self, expression): + self.expression = expression + + def __repr__(self): + return f"JMESPath({repr(self.expression)})" + + # All the following methods evaluate the path and then pass through the + # same, allowing the object to typically masquerade as the correct type + # when evaluated. + def __str__(self): + return str(self.evaluate()) + + def __int__(self): + return int(self.evaluate()) + + def __float__(self): + return float(self.evaluate()) + + def __iter__(self): + return iter(self.evaluate()) + + def __getitem__(self, name): + return self.evaluate()[name] + + def __len__(self): + return len(self.evaluate()) + + def keys(self, *args): + return self.evaluate().keys(*args) + + def evaluate(self): + """Return the node that the JMESPath expression evaluates to. + + This allows us to late-bind the JMESPath expression during JSON + serialization or value casting, rather than during the YAML parsing, + because the entire document will not have been built yet. This must be + run from within a Context that has a reference to the entire data tree. + + This does not explicitly check for circular references, but json.dumps + will raise "ValueError: Circular reference detected" if one is created. + """ + data_context = jmespath_context.get() + # Attempt to evaluate expression against data context. + value = jmespath.search(self.expression, data_context) + if value is None: + raise AttributeError( + f"JMESPath expression '{self.expression}' not found in data" + ) + return value + + +class JMESPathSubstitution(yaml.YAMLObject): + """JMESPathSubstitution represents a parsed !sub YAML tag. + + The !sub tag is a template string with ${...} placeholders that contain + JMESPath expressions. These are late-evaluated during JSON serialization, + allowing interpolation of values that don't exist during YAML parsing. + + Example: + !sub "project:${global_groups_root_lookup.steps[0]._response}" + """ + + def __init__(self, template): + self.template = template + + def __repr__(self): + return f"JMESPathSubstitution({repr(self.template)})" + + # All the following methods evaluate the template and then pass through the + # same, allowing the object to typically masquerade as the correct type + # when evaluated. + def __str__(self): + return str(self.evaluate()) + + def __int__(self): + return int(self.evaluate()) + + def __float__(self): + return float(self.evaluate()) + + def __iter__(self): + return iter(self.evaluate()) + + def __getitem__(self, name): + return self.evaluate()[name] + + def __len__(self): + return len(self.evaluate()) + + def keys(self, *args): + return self.evaluate().keys(*args) + + def evaluate(self): + """Return the template string with ${...} placeholders substituted. + + This allows us to late-bind JMESPath expressions within string templates + during JSON serialization or value casting, rather than during the YAML + parsing, because the entire document will not have been built yet. This + must be run from within a Context that has a reference to the entire + data tree. + + This does not explicitly check for circular references, but json.dumps + will raise "ValueError: Circular reference detected" if one is created. + """ + data_context = jmespath_context.get() + + def replace_placeholder(match): + expression = match.group(1) + # Attempt to evaluate expression against data context. + value = jmespath.search(expression, data_context) + if value is None: + raise AttributeError( + f"JMESPath expression '{expression}' not found in data" + ) + return str(value) + + # Find and replace all ${...} patterns with their evaluated values. + result = re.sub(r"\$\{([^}]+)\}", replace_placeholder, self.template) + return result + + +class JMESPathEncoder(json.JSONEncoder): + """Extend the default JSON encoder for JMESPath macros. + + Supports both the JMESPath (!ref) and JMESPathSubstitution (!sub) + macros. + """ + + def default(self, obj): + if isinstance(obj, JMESPath): + return obj.evaluate() + if isinstance(obj, JMESPathSubstitution): + return obj.evaluate() + # Handle all other types (or raise a TypeError). + return super().default(obj) + + +class HttpRequestPlaybookParams(BaseModel): + """Parameters for a playbook of type 'http-request'.""" + + url: str + method: HTTPMethod + headers: dict[str, str] = {} + params: dict[str, str] = {} + + +class NatsPublishPlaybookParams(BaseModel): + """Parameters for a playbook of type 'nats-publish'.""" + + subject: str + + +class NatsKvPutPlaybookParams(BaseModel): + """Parameters for a playbook of type 'nats-kv-put'.""" + + bucket: str + key: str + + +class NatsRequestPlaybookParams(BaseModel): + """Parameters for a playbook of type 'nats-request'.""" + + subject: str + timeout: int = WAIT_TIMEOUT + + +def yaml_ref(loader, node): + """Convert !ref YAML tag to JMESPath object. + + This function is registered with the YAML loader via add_constructor(). + """ + return JMESPath(node.value) + + +def ref_yaml(dumper, data): + """Represent JMESPath object as a !ref YAML tag. + + This function is registered with the YAML dumper via add_representer(). + """ + return dumper.represent_scalar("!ref", data.expression) + + +def yaml_sub(loader, node): + """Convert !sub YAML tag to JMESPathSubstitution object. + + This function is registered with the YAML loader via add_constructor(). + """ + return JMESPathSubstitution(node.value) + + +def sub_yaml(dumper, data): + """Represent JMESPathSubstitution object as a !sub YAML tag. + + This function is registered with the YAML dumper via add_representer(). + """ + return dumper.represent_scalar("!sub", data.template) + + +def yaml_include(loader, node): + """Convert !include YAML tag to Jinja2 render and YAML parse. + + This function is registered with the YAML loader via add_constructor(). + """ + env = jinja_env.get() + logger.info( + "Loading included template", + template_dir=env.loader.searchpath[0], + yaml_file=node.value, + ) + template = env.get_template(node.value) + out_data = template.render() + return yaml.safe_load(out_data) + + +def yaml_render(template_dir, yaml_file): + """Setup Jinja2 and render and parse a YAML file.""" + logger.info("Loading template", template_dir=template_dir, yaml_file=yaml_file) + # Check if we have already created a sandbox Jinja2 environment for this + # context/directory. + env = jinja_env.get(None) + if env is None: + # Create an environment restricted to the passed template directory. + env = Environment( + loader=FileSystemLoader(searchpath=template_dir), + autoescape=select_autoescape( + default_for_string=True, + default=True, + ), + ) + # Add helper functions to the Jinja2 environment. + env.globals["environ"] = dict(os.environ) + env.globals["fake"] = fake + env.globals["generate_name"] = generate_name + env.globals["lorem"] = lorem + env.globals["timedelta"] = datetime.timedelta + env.globals["now_z"] = ( + lambda: datetime.datetime.now(datetime.UTC) + .isoformat("T") + .replace("+00:00", "Z") + ) + env.globals["uuid"] = lambda: str(uuid.uuid4()) + # Store the environment in the context for use by the !include + # constructor/macro and remaining YAML files in this context/directory. + jinja_env.set(env) + template = env.get_template(yaml_file) + out_data = template.render() + return yaml.safe_load(out_data) + + +def main() -> None: + """Implement command-line interface.""" + # Parse CLI arguments. + cli_args = parse_args() + # Store the argparse namespace into the context for use in nested + # functions. + args.set(cli_args) + # Load and parse the requested template directories. + data = merge_and_preprocess_yaml_dirs(cli_args.template_dirs) + # Set the context for JMESPath expression evaluation to the data returned + # from merge_and_preprocess_yaml_dirs. + jmespath_context.set(data) + # Conditionally dump data to stdout. + if cli_args.dump: + # PyYAML outputs OrderedDicts as arrays, but casting to a dict and + # disabling sort_keys seems to work as expected (outputs as a map and + # retains order). Note that the YAML dump evaluates `!import` but does + # NOT evaluate the `!ref` JMESPath expressions. + sys.stdout.write(yaml.dump(dict(data), sort_keys=False)) + if cli_args.dump_json: + try: + # json.dumps preserves order while outputting an OrderedDict as an + # ordinary map. The JSON dump evaluates all `!ref` JMESPath + # expressions, unlike the YAML dump. + print(json.dumps(data, cls=JMESPathEncoder, separators=(",", ":"))) + except AttributeError as e: + logger.error("Error dumping JSON", error=str(e)) + # Return early if we are only dumping data. + if (cli_args.dump or cli_args.dump_json) and not cli_args.upload: + return + # Run playbooks to upload mock data. + try: + asyncio.run(run_playbooks_async(data)) + except json.decoder.JSONDecodeError as e: + logger.error("Failed to parse response as JSON", error=str(e)) + except requests.exceptions.RequestException as e: + logger.error("Request failed", error=str(e)) + except AttributeError as e: + logger.error("Error processing playbook", error=str(e)) + + +def merge_and_preprocess_yaml_dirs(template_dirs: list[str]) -> OrderedDict: + """Step over each template directory that is part of this run. + + This function scans for YAML files and loads them individually. + """ + data: OrderedDict[str, Any] = OrderedDict() + for template_dir in template_dirs: + # Create a subcontext for this template_dir, which is used as a sandbox + # for the `!include` constructor's Jinja environment. + ctx = contextvars.copy_context() + + # Find all YAML files in the template directory. + yaml_patterns = [ + os.path.join(template_dir, "*.yaml"), + os.path.join(template_dir, "*.yml"), + ] + + yaml_files = [] + for pattern in yaml_patterns: + yaml_files.extend(glob.glob(pattern)) + + # Process each YAML file in Unix order (numerals, then uppercase, then + # lowercase). + for yaml_file in sorted(yaml_files): + # Run the template evaluation in the context. + new_data = ctx.run(yaml_render, template_dir, os.path.basename(yaml_file)) + # Warn if new_data is not a dictionary. + if not isinstance(new_data, dict): + logger.warning( + "YAML file did not parse to a dictionary", + template_dir=template_dir, + yaml_file=yaml_file, + ) + continue + # Warn if any playbook names (keys in the dictionary) would collide. + # (use set intersection to find any duplicates) + duplicate_keys = set(data.keys()).intersection(new_data.keys()) + if duplicate_keys: + # Log a warning and skip the entire file. + logger.warning( + "Duplicate playbook names found; skipping file", + template_dir=template_dir, + yaml_file=yaml_file, + duplicate_playbooks=list(duplicate_keys), + ) + continue + # Increment our global retry counter for this playbook. + retries_remaining.set(retries_remaining.get() + RETRIES_PER_PLAYBOOK) + # Merge the new data into the overall data dictionary. + data.update(new_data) + return data + + +async def run_playbooks_async(data: dict) -> None: + """Async wrapper for running playbooks with NATS support.""" + try: + await run_playbooks(data) + finally: + # Only cleanup if NATS was actually connected. + if nats_client is not None: + await cleanup_nats_connection() + + +async def initialize_nats_connection() -> None: + """Initialize NATS client connection if not already connected.""" + global nats_client, jetstream_client + if nats_client is None: + try: + nats_client = await nats.connect(NATS_URL, max_reconnect_attempts=3) + jetstream_client = nats_client.jetstream() + logger.info("Connected to NATS", url=NATS_URL) + except Exception as e: + logger.error("Failed to connect to NATS", error=str(e)) + raise + + +async def cleanup_nats_connection() -> None: + """Clean up NATS client connection.""" + global nats_client, jetstream_client + if nats_client is not None: + await nats_client.close() + nats_client = None + jetstream_client = None + logger.info("Disconnected from NATS") + + +async def run_playbooks(data: dict) -> None: + cli_args = args.get() + while retries_remaining.get() >= 0: + for name, playbook in data.items(): + if "type" not in playbook: + if cli_args.force: + logger.error("Playbook missing type", playbook=name) + continue + raise AttributeError(f"Playbook '{name}' missing type") + if playbook["type"] == "http-request": + run_http_request_playbook(name, playbook) + elif playbook["type"] == "nats-publish": + await run_nats_publish_playbook(name, playbook) + elif playbook["type"] == "nats-kv-put": + await run_nats_kv_put_playbook(name, playbook) + elif playbook["type"] == "nats-request": + await run_nats_request_playbook(name, playbook) + else: + if cli_args.force: + logger.error("Playbook has unknown type", playbook=name) + continue + raise AttributeError(f"Playbook '{name}' has unknown type") + retries_remaining.set(retries_remaining.get() - 1) + + +def run_http_request_playbook(name: str, playbook: dict) -> None: + """Run a playbook of type 'http-request'.""" + cli_args = args.get() + if "params" not in playbook: + if cli_args.force: + logger.error("Playbook missing params", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing params") + params = HttpRequestPlaybookParams.model_validate_json( + json.dumps( + playbook["params"], + cls=JMESPathEncoder, + separators=(",", ":"), + ) + ) + if "steps" not in playbook: + if cli_args.force: + logger.error("Playbook missing steps", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing steps") + for step_payload in playbook["steps"]: + if "_response" in step_payload: + # Skip steps that have already been run. + continue + + # Determine payload type and prepare data. + request_data = None + if params.method in [HTTPMethod.POST, HTTPMethod.PUT, HTTPMethod.PATCH]: + try: + if "json" in step_payload: + params.headers["content-type"] = "application/json" + request_data = json.dumps( + step_payload["json"], + cls=JMESPathEncoder, + separators=(",", ":"), + ) + elif "form" in step_payload: + processed_data = json.dumps( + step_payload["form"], + cls=JMESPathEncoder, + separators=(",", ":"), + ) + # Convert back to a dict; requests will handle multipart + # encoding. + request_data = json.loads(processed_data) + except AttributeError as e: + if cli_args.dry_run: + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + step_payload["_response"] = {} + continue + else: + raise + else: + if retries_remaining.get() > 0: + continue + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + continue + raise + if request_data is None and "raw" in step_payload: + if isinstance(step_payload["raw"], str): + request_data = step_payload["raw"] + else: + request_data = str(step_payload["raw"]) + + if cli_args.dry_run: + # If we're in a dry-run, don't actually run the request. + return + + logger.info( + "Running step", + playbook=name, + method=params.method, + url=params.url, + data=request_data, + ) + + try: + response = requests.request( + **params.model_dump(), + data=request_data, + ) + response.raise_for_status() + # Store the response in the playbook for future reference. + except requests.exceptions.RequestException as e: + if cli_args.force: + logger.error("Request failed", error=str(e), playbook=name) + # Add a placeholder response to prevent re-running. + step_payload["_response"] = {} + continue + raise + try: + r_dict = response.json() + step_payload["_response"] = r_dict + except json.decoder.JSONDecodeError as e: + if cli_args.force: + logger.error( + "Failed to parse response as JSON", error=str(e), playbook=name + ) + # Add a placeholder response to prevent re-running. + step_payload["_response"] = {} + continue + raise + + +async def run_nats_publish_playbook(name: str, playbook: dict) -> None: + """Run a playbook of type 'nats-publish'.""" + cli_args = args.get() + + # Initialize NATS connection if needed. + await initialize_nats_connection() + + if nats_client is None: + if cli_args.force: + logger.error("NATS client not connected", playbook=name) + return + raise AttributeError("NATS client not connected") + + if "params" not in playbook: + if cli_args.force: + logger.error("Playbook missing params", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing params") + + params = NatsPublishPlaybookParams.model_validate_json( + json.dumps( + playbook["params"], + cls=JMESPathEncoder, + separators=(",", ":"), + ) + ) + + if "steps" not in playbook: + if cli_args.force: + logger.error("Playbook missing steps", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing steps") + + for step_payload in playbook["steps"]: + if "_response" in step_payload: + # Skip steps that have already been run. + continue + + # Determine payload type and prepare data. + if "json" in step_payload: + try: + data = json.dumps( + step_payload["json"], + cls=JMESPathEncoder, + separators=(",", ":"), + ).encode() + except AttributeError as e: + if cli_args.dry_run: + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + step_payload["_response"] = {} + continue + else: + raise + else: + if retries_remaining.get() > 0: + continue + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + continue + raise + elif "raw" in step_payload: + if isinstance(step_payload["raw"], str): + data = step_payload["raw"].encode("utf-8") + else: + data = str(step_payload["raw"]).encode("utf-8") + else: + # Send empty payload if neither json nor raw specified + data = b"" + + if cli_args.dry_run: + # If we're in a dry-run, don't actually run the request. + step_payload["_response"] = {} + continue + + logger.info( + "Publishing NATS message", + playbook=name, + subject=params.subject, + data_length=len(data), + ) + + try: + await nats_client.publish(params.subject, data) + # NATS publish doesn't return a response, so we create an empty one. + step_payload["_response"] = {} + except Exception as e: + if cli_args.force: + logger.error("NATS publish failed", error=str(e), playbook=name) + step_payload["_response"] = {} + continue + raise + + +async def run_nats_kv_put_playbook(name: str, playbook: dict) -> None: + """Run a playbook of type 'nats-kv-put'.""" + cli_args = args.get() + + # Initialize NATS connection if needed. + await initialize_nats_connection() + + if jetstream_client is None: + if cli_args.force: + logger.error("NATS JetStream client not connected", playbook=name) + return + raise AttributeError("NATS JetStream client not connected") + + if "params" not in playbook: + if cli_args.force: + logger.error("Playbook missing params", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing params") + + params = NatsKvPutPlaybookParams.model_validate_json( + json.dumps( + playbook["params"], + cls=JMESPathEncoder, + separators=(",", ":"), + ) + ) + + # Get or create the KV bucket. + try: + kv_client = await jetstream_client.key_value(params.bucket) + except Exception as e: + if cli_args.force: + logger.error( + "Failed to access KV bucket", + bucket=params.bucket, + error=str(e), + playbook=name, + ) + return + raise + + if "steps" not in playbook: + if cli_args.force: + logger.error("Playbook missing steps", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing steps") + + for step_payload in playbook["steps"]: + if "_response" in step_payload: + # Skip steps that have already been run. + continue + + # Determine payload type and prepare data. + if "json" in step_payload: + try: + data = json.dumps( + step_payload["json"], + cls=JMESPathEncoder, + separators=(",", ":"), + ).encode() + except AttributeError as e: + if cli_args.dry_run: + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + step_payload["_response"] = {} + continue + else: + raise + else: + if retries_remaining.get() > 0: + continue + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + continue + raise + elif "raw" in step_payload: + if isinstance(step_payload["raw"], str): + data = step_payload["raw"].encode("utf-8") + else: + data = str(step_payload["raw"]).encode("utf-8") + else: + # Send empty payload if neither json nor raw specified + data = b"" + + if cli_args.dry_run: + # If we're in a dry-run, don't actually run the request. + step_payload["_response"] = {} + continue + + logger.info( + "Putting NATS KV entry", + playbook=name, + key=params.key, + data_length=len(data), + ) + + try: + await kv_client.put(params.key, data) + # NATS KV put doesn't return a response, so we create an empty one. + step_payload["_response"] = {} + except Exception as e: + if cli_args.force: + logger.error("NATS KV put failed", error=str(e), playbook=name) + step_payload["_response"] = {} + continue + raise + + +async def run_nats_request_playbook(name: str, playbook: dict) -> None: + """Run a playbook of type 'nats-request'.""" + cli_args = args.get() + + # Initialize NATS connection if needed. + await initialize_nats_connection() + + if nats_client is None: + if cli_args.force: + logger.error("NATS client not connected", playbook=name) + return + raise AttributeError("NATS client not connected") + + if "params" not in playbook: + if cli_args.force: + logger.error("Playbook missing params", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing params") + + params = NatsRequestPlaybookParams.model_validate_json( + json.dumps( + playbook["params"], + cls=JMESPathEncoder, + separators=(",", ":"), + ) + ) + + if "steps" not in playbook: + if cli_args.force: + logger.error("Playbook missing steps", playbook=name) + return + raise AttributeError(f"Playbook '{name}' missing steps") + + for step_payload in playbook["steps"]: + if "_response" in step_payload: + # Skip steps that have already been run. + continue + + # Determine payload type and prepare data. + if "json" in step_payload: + try: + data = json.dumps( + step_payload["json"], + cls=JMESPathEncoder, + separators=(",", ":"), + ).encode() + except AttributeError as e: + if cli_args.dry_run: + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + step_payload["_response"] = {} + continue + else: + raise + else: + if retries_remaining.get() > 0: + continue + if cli_args.force: + logger.error( + "Error processing playbook", error=str(e), playbook=name + ) + continue + raise + elif "raw" in step_payload: + if isinstance(step_payload["raw"], str): + data = step_payload["raw"].encode("utf-8") + else: + data = str(step_payload["raw"]).encode("utf-8") + else: + # Send empty payload if neither json nor raw specified + data = b"" + + if cli_args.dry_run: + # If we're in a dry-run, don't actually run the request. + step_payload["_response"] = {} + continue + + logger.info( + "Sending NATS request", + playbook=name, + subject=params.subject, + data_length=len(data), + timeout=params.timeout, + ) + + try: + response = await nats_client.request( + params.subject, data, timeout=params.timeout + ) + # Parse the response data and store it. + try: + response_data = json.loads(response.data.decode()) + step_payload["_response"] = response_data + except json.JSONDecodeError: + # If response is not JSON, store it as a string. + step_payload["_response"] = response.data.decode() + except TimeoutError as e: + if cli_args.force: + logger.error("NATS request timeout", error=str(e), playbook=name) + step_payload["_response"] = {} + continue + raise + except Exception as e: + if cli_args.force: + logger.error("NATS request failed", error=str(e), playbook=name) + step_payload["_response"] = {} + continue + raise + + +def parse_args() -> UploadMockDataArgs: + """Handle argument parsing for CLI invocations.""" + parser = argparse.ArgumentParser(description="Upload mock data to endpoints") + parser.add_argument( + "-t", + "--template-dir", + dest="template_dirs", + nargs="+", + required=True, + help="path(s) to directory of YAML playbooks", + ) + dumper_group = parser.add_mutually_exclusive_group() + dumper_group.add_argument( + "--dump", + action="store_true", + help="dump the parsed templates as YAML to stdout (no !ref expansion)", + ) + dumper_group.add_argument( + "--dump-json", + action="store_true", + help="dump the parsed templates as JSON to stdout (with !ref expansion)", + ) + dry_run_group = parser.add_mutually_exclusive_group() + dry_run_group.add_argument( + "--dry-run", + action="store_true", + help="do not upload any data to endpoints", + ) + dry_run_group.add_argument( + "--upload", + action="store_true", + help="upload to endpoints even when dumping", + ) + parser.add_argument( + "--force", + action="store_true", + help="keep running steps after a failure", + ) + # Parse arguments and convert to Pydantic model. + parsed_args = parser.parse_args() + return UploadMockDataArgs( + template_dirs=parsed_args.template_dirs, + dump=parsed_args.dump, + dump_json=parsed_args.dump_json, + dry_run=parsed_args.dry_run, + upload=parsed_args.upload, + force=parsed_args.force, + ) + + +yaml.SafeLoader.add_constructor("!include", yaml_include) +yaml.SafeLoader.add_constructor("!ref", yaml_ref) +yaml.SafeLoader.add_constructor("!sub", yaml_sub) +yaml.add_representer(JMESPath, ref_yaml) +yaml.add_representer(JMESPathSubstitution, sub_yaml) + +jmespath_context.set({}) +args.set(UploadMockDataArgs(template_dirs=[])) +retries_remaining.set(0) + +if __name__ == "__main__": + main() diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..0f744d0 --- /dev/null +++ b/uv.lock @@ -0,0 +1,412 @@ +version = 1 +revision = 3 +requires-python = ">=3.12.5, <3.13" + +[[package]] +name = "annotated-types" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" }, +] + +[[package]] +name = "certifi" +version = "2024.12.14" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/0f/bd/1d41ee578ce09523c81a15426705dd20969f5abf006d1afe8aeff0dd776a/certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db", size = 166010, upload-time = "2024-12-14T13:52:38.02Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a5/32/8f6669fc4798494966bf446c8c4a162e0b5d893dff088afddf76414f70e1/certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56", size = 164927, upload-time = "2024-12-14T13:52:36.114Z" }, +] + +[[package]] +name = "charset-normalizer" +version = "3.4.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/16/b0/572805e227f01586461c80e0fd25d65a2115599cc9dad142fee4b747c357/charset_normalizer-3.4.1.tar.gz", hash = "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3", size = 123188, upload-time = "2024-12-24T18:12:35.43Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0a/9a/dd1e1cdceb841925b7798369a09279bd1cf183cef0f9ddf15a3a6502ee45/charset_normalizer-3.4.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545", size = 196105, upload-time = "2024-12-24T18:10:38.83Z" }, + { url = "https://files.pythonhosted.org/packages/d3/8c/90bfabf8c4809ecb648f39794cf2a84ff2e7d2a6cf159fe68d9a26160467/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7", size = 140404, upload-time = "2024-12-24T18:10:44.272Z" }, + { url = "https://files.pythonhosted.org/packages/ad/8f/e410d57c721945ea3b4f1a04b74f70ce8fa800d393d72899f0a40526401f/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757", size = 150423, upload-time = "2024-12-24T18:10:45.492Z" }, + { url = "https://files.pythonhosted.org/packages/f0/b8/e6825e25deb691ff98cf5c9072ee0605dc2acfca98af70c2d1b1bc75190d/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa", size = 143184, upload-time = "2024-12-24T18:10:47.898Z" }, + { url = "https://files.pythonhosted.org/packages/3e/a2/513f6cbe752421f16d969e32f3583762bfd583848b763913ddab8d9bfd4f/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d", size = 145268, upload-time = "2024-12-24T18:10:50.589Z" }, + { url = "https://files.pythonhosted.org/packages/74/94/8a5277664f27c3c438546f3eb53b33f5b19568eb7424736bdc440a88a31f/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616", size = 147601, upload-time = "2024-12-24T18:10:52.541Z" }, + { url = "https://files.pythonhosted.org/packages/7c/5f/6d352c51ee763623a98e31194823518e09bfa48be2a7e8383cf691bbb3d0/charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b", size = 141098, upload-time = "2024-12-24T18:10:53.789Z" }, + { url = "https://files.pythonhosted.org/packages/78/d4/f5704cb629ba5ab16d1d3d741396aec6dc3ca2b67757c45b0599bb010478/charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d", size = 149520, upload-time = "2024-12-24T18:10:55.048Z" }, + { url = "https://files.pythonhosted.org/packages/c5/96/64120b1d02b81785f222b976c0fb79a35875457fa9bb40827678e54d1bc8/charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a", size = 152852, upload-time = "2024-12-24T18:10:57.647Z" }, + { url = "https://files.pythonhosted.org/packages/84/c9/98e3732278a99f47d487fd3468bc60b882920cef29d1fa6ca460a1fdf4e6/charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9", size = 150488, upload-time = "2024-12-24T18:10:59.43Z" }, + { url = "https://files.pythonhosted.org/packages/13/0e/9c8d4cb99c98c1007cc11eda969ebfe837bbbd0acdb4736d228ccaabcd22/charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1", size = 146192, upload-time = "2024-12-24T18:11:00.676Z" }, + { url = "https://files.pythonhosted.org/packages/b2/21/2b6b5b860781a0b49427309cb8670785aa543fb2178de875b87b9cc97746/charset_normalizer-3.4.1-cp312-cp312-win32.whl", hash = "sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35", size = 95550, upload-time = "2024-12-24T18:11:01.952Z" }, + { url = "https://files.pythonhosted.org/packages/21/5b/1b390b03b1d16c7e382b561c5329f83cc06623916aab983e8ab9239c7d5c/charset_normalizer-3.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f", size = 102785, upload-time = "2024-12-24T18:11:03.142Z" }, + { url = "https://files.pythonhosted.org/packages/0e/f6/65ecc6878a89bb1c23a086ea335ad4bf21a588990c3f535a227b9eea9108/charset_normalizer-3.4.1-py3-none-any.whl", hash = "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85", size = 49767, upload-time = "2024-12-24T18:12:32.852Z" }, +] + +[[package]] +name = "cmdkit" +version = "2.7.7" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a9/8d/0483d6018a5293ef74889ee132b243d34c324be19378acb93341bbefb43b/cmdkit-2.7.7.tar.gz", hash = "sha256:afe20b60ee60658e299dba465248b74c1801bfe24f891ef745b3a6810251c280", size = 23225, upload-time = "2024-12-28T21:21:57.08Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/23/62/c82680c31dc2dcfa55918a28720d2e5695cbb4e778b621416d12883203cd/cmdkit-2.7.7-py3-none-any.whl", hash = "sha256:9dfb1ae63329d0ce1970886206ef14a9773d5ebcc15608c96df119bc82abf023", size = 26819, upload-time = "2024-12-28T21:21:54.931Z" }, +] + +[[package]] +name = "faker" +version = "37.12.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "tzdata" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3d/84/e95acaa848b855e15c83331d0401ee5f84b2f60889255c2e055cb4fb6bdf/faker-37.12.0.tar.gz", hash = "sha256:7505e59a7e02fa9010f06c3e1e92f8250d4cfbb30632296140c2d6dbef09b0fa", size = 1935741, upload-time = "2025-10-24T15:19:58.764Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8e/98/2c050dec90e295a524c9b65c4cb9e7c302386a296b2938710448cbd267d5/faker-37.12.0-py3-none-any.whl", hash = "sha256:afe7ccc038da92f2fbae30d8e16d19d91e92e242f8401ce9caf44de892bab4c4", size = 1975461, upload-time = "2025-10-24T15:19:55.739Z" }, +] + +[[package]] +name = "idna" +version = "3.10" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490, upload-time = "2024-09-15T18:07:39.745Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" }, +] + +[[package]] +name = "isort" +version = "7.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/63/53/4f3c058e3bace40282876f9b553343376ee687f3c35a525dc79dbd450f88/isort-7.0.0.tar.gz", hash = "sha256:5513527951aadb3ac4292a41a16cbc50dd1642432f5e8c20057d414bdafb4187", size = 805049, upload-time = "2025-10-11T13:30:59.107Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7f/ed/e3705d6d02b4f7aea715a353c8ce193efd0b5db13e204df895d38734c244/isort-7.0.0-py3-none-any.whl", hash = "sha256:1bcabac8bc3c36c7fb7b98a76c8abb18e0f841a3ba81decac7691008592499c1", size = 94672, upload-time = "2025-10-11T13:30:57.665Z" }, +] + +[[package]] +name = "jinja2" +version = "3.1.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" }, +] + +[[package]] +name = "jmespath" +version = "1.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/00/2a/e867e8531cf3e36b41201936b7fa7ba7b5702dbef42922193f05c8976cd6/jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe", size = 25843, upload-time = "2022-06-17T18:00:12.224Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/31/b4/b9b800c45527aadd64d5b442f9b932b00648617eb5d63d2c7a6587b7cafc/jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980", size = 20256, upload-time = "2022-06-17T18:00:10.251Z" }, +] + +[[package]] +name = "lfx-v2-mockdata" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "faker" }, + { name = "jinja2" }, + { name = "jmespath" }, + { name = "names-generator" }, + { name = "nats-py" }, + { name = "pydantic" }, + { name = "python-dotenv" }, + { name = "python-lorem" }, + { name = "pyyaml" }, + { name = "requests" }, + { name = "structlog" }, + { name = "urllib3" }, +] + +[package.dev-dependencies] +dev = [ + { name = "isort" }, + { name = "mypy" }, + { name = "ruff" }, + { name = "types-jmespath" }, + { name = "types-pyyaml" }, + { name = "types-requests" }, +] + +[package.metadata] +requires-dist = [ + { name = "faker", specifier = ">=37.12.0" }, + { name = "jinja2", specifier = ">=3.1.6" }, + { name = "jmespath", specifier = ">=1.0.1" }, + { name = "names-generator", specifier = ">=0.2.0" }, + { name = "nats-py", specifier = ">=2.9.0" }, + { name = "pydantic", specifier = ">=2.10.5" }, + { name = "python-dotenv", specifier = ">=1.0.1" }, + { name = "python-lorem", specifier = ">=1.3.0.post3" }, + { name = "pyyaml", specifier = ">=6.0.2" }, + { name = "requests", specifier = ">=2.32.4" }, + { name = "structlog", specifier = ">=24.4.0" }, + { name = "urllib3", specifier = ">=2.5.0" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "isort", specifier = ">=7.0.0" }, + { name = "mypy", specifier = ">=1.17.1" }, + { name = "ruff", specifier = ">=0.6.2" }, + { name = "types-jmespath", specifier = ">=1.0.2.20250809" }, + { name = "types-pyyaml", specifier = ">=6.0.12.20250822" }, + { name = "types-requests", specifier = ">=2.32.4.20250809" }, +] + +[[package]] +name = "markupsafe" +version = "3.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", size = 20537, upload-time = "2024-10-18T15:21:54.129Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/22/09/d1f21434c97fc42f09d290cbb6350d44eb12f09cc62c9476effdb33a18aa/MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf", size = 14274, upload-time = "2024-10-18T15:21:13.777Z" }, + { url = "https://files.pythonhosted.org/packages/6b/b0/18f76bba336fa5aecf79d45dcd6c806c280ec44538b3c13671d49099fdd0/MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225", size = 12348, upload-time = "2024-10-18T15:21:14.822Z" }, + { url = "https://files.pythonhosted.org/packages/e0/25/dd5c0f6ac1311e9b40f4af06c78efde0f3b5cbf02502f8ef9501294c425b/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028", size = 24149, upload-time = "2024-10-18T15:21:15.642Z" }, + { url = "https://files.pythonhosted.org/packages/f3/f0/89e7aadfb3749d0f52234a0c8c7867877876e0a20b60e2188e9850794c17/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8", size = 23118, upload-time = "2024-10-18T15:21:17.133Z" }, + { url = "https://files.pythonhosted.org/packages/d5/da/f2eeb64c723f5e3777bc081da884b414671982008c47dcc1873d81f625b6/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c", size = 22993, upload-time = "2024-10-18T15:21:18.064Z" }, + { url = "https://files.pythonhosted.org/packages/da/0e/1f32af846df486dce7c227fe0f2398dc7e2e51d4a370508281f3c1c5cddc/MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557", size = 24178, upload-time = "2024-10-18T15:21:18.859Z" }, + { url = "https://files.pythonhosted.org/packages/c4/f6/bb3ca0532de8086cbff5f06d137064c8410d10779c4c127e0e47d17c0b71/MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22", size = 23319, upload-time = "2024-10-18T15:21:19.671Z" }, + { url = "https://files.pythonhosted.org/packages/a2/82/8be4c96ffee03c5b4a034e60a31294daf481e12c7c43ab8e34a1453ee48b/MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48", size = 23352, upload-time = "2024-10-18T15:21:20.971Z" }, + { url = "https://files.pythonhosted.org/packages/51/ae/97827349d3fcffee7e184bdf7f41cd6b88d9919c80f0263ba7acd1bbcb18/MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30", size = 15097, upload-time = "2024-10-18T15:21:22.646Z" }, + { url = "https://files.pythonhosted.org/packages/c1/80/a61f99dc3a936413c3ee4e1eecac96c0da5ed07ad56fd975f1a9da5bc630/MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87", size = 15601, upload-time = "2024-10-18T15:21:23.499Z" }, +] + +[[package]] +name = "mypy" +version = "1.17.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mypy-extensions" }, + { name = "pathspec" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8e/22/ea637422dedf0bf36f3ef238eab4e455e2a0dcc3082b5cc067615347ab8e/mypy-1.17.1.tar.gz", hash = "sha256:25e01ec741ab5bb3eec8ba9cdb0f769230368a22c959c4937360efb89b7e9f01", size = 3352570, upload-time = "2025-07-31T07:54:19.204Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/17/a2/7034d0d61af8098ec47902108553122baa0f438df8a713be860f7407c9e6/mypy-1.17.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:69e83ea6553a3ba79c08c6e15dbd9bfa912ec1e493bf75489ef93beb65209aeb", size = 11086295, upload-time = "2025-07-31T07:53:28.124Z" }, + { url = "https://files.pythonhosted.org/packages/14/1f/19e7e44b594d4b12f6ba8064dbe136505cec813549ca3e5191e40b1d3cc2/mypy-1.17.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1b16708a66d38abb1e6b5702f5c2c87e133289da36f6a1d15f6a5221085c6403", size = 10112355, upload-time = "2025-07-31T07:53:21.121Z" }, + { url = "https://files.pythonhosted.org/packages/5b/69/baa33927e29e6b4c55d798a9d44db5d394072eef2bdc18c3e2048c9ed1e9/mypy-1.17.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:89e972c0035e9e05823907ad5398c5a73b9f47a002b22359b177d40bdaee7056", size = 11875285, upload-time = "2025-07-31T07:53:55.293Z" }, + { url = "https://files.pythonhosted.org/packages/90/13/f3a89c76b0a41e19490b01e7069713a30949d9a6c147289ee1521bcea245/mypy-1.17.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:03b6d0ed2b188e35ee6d5c36b5580cffd6da23319991c49ab5556c023ccf1341", size = 12737895, upload-time = "2025-07-31T07:53:43.623Z" }, + { url = "https://files.pythonhosted.org/packages/23/a1/c4ee79ac484241301564072e6476c5a5be2590bc2e7bfd28220033d2ef8f/mypy-1.17.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c837b896b37cd103570d776bda106eabb8737aa6dd4f248451aecf53030cdbeb", size = 12931025, upload-time = "2025-07-31T07:54:17.125Z" }, + { url = "https://files.pythonhosted.org/packages/89/b8/7409477be7919a0608900e6320b155c72caab4fef46427c5cc75f85edadd/mypy-1.17.1-cp312-cp312-win_amd64.whl", hash = "sha256:665afab0963a4b39dff7c1fa563cc8b11ecff7910206db4b2e64dd1ba25aed19", size = 9584664, upload-time = "2025-07-31T07:54:12.842Z" }, + { url = "https://files.pythonhosted.org/packages/1d/f3/8fcd2af0f5b806f6cf463efaffd3c9548a28f84220493ecd38d127b6b66d/mypy-1.17.1-py3-none-any.whl", hash = "sha256:a9f52c0351c21fe24c21d8c0eb1f62967b262d6729393397b6f443c3b773c3b9", size = 2283411, upload-time = "2025-07-31T07:53:24.664Z" }, +] + +[[package]] +name = "mypy-extensions" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a2/6e/371856a3fb9d31ca8dac321cda606860fa4548858c0cc45d9d1d4ca2628b/mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558", size = 6343, upload-time = "2025-04-22T14:54:24.164Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/79/7b/2c79738432f5c924bef5071f933bcc9efd0473bac3b4aa584a6f7c1c8df8/mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505", size = 4963, upload-time = "2025-04-22T14:54:22.983Z" }, +] + +[[package]] +name = "names-generator" +version = "0.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cmdkit" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/fd/de/60c26d1488db2ffdb050d2c0e6007998c2afd90760a4d7b23d32cde5b446/names_generator-0.2.0.tar.gz", hash = "sha256:de60e354b8ca8f2d1ce0816079d3ba569417371867b94328021f03c9dd47a5be", size = 27106, upload-time = "2024-04-16T03:38:58.399Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bf/3d/7210fc4b1999771b875d96ffa30cf4384c7fe8f0a7d9874df4b753b7703e/names_generator-0.2.0-py3-none-any.whl", hash = "sha256:693e8e48e9a54a2a8f714b01d1bd70945743a15d4587059e7e4e16efc361be11", size = 26699, upload-time = "2024-04-16T03:38:54.288Z" }, +] + +[[package]] +name = "nats-py" +version = "2.11.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/65/be/757c8af63596453daaa42cc21be51aa42fc6b23cc9d4347784f99c8357b5/nats_py-2.11.0.tar.gz", hash = "sha256:fb1097db8b520bb4c8f5ad51340ca54d9fa54dbfc4ecc81c3625ef80994b6100", size = 114186, upload-time = "2025-07-22T08:41:08.589Z" } + +[[package]] +name = "pathspec" +version = "0.12.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ca/bc/f35b8446f4531a7cb215605d100cd88b7ac6f44ab3fc94870c120ab3adbf/pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712", size = 51043, upload-time = "2023-12-10T22:30:45Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", size = 31191, upload-time = "2023-12-10T22:30:43.14Z" }, +] + +[[package]] +name = "pydantic" +version = "2.10.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-types" }, + { name = "pydantic-core" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/6a/c7/ca334c2ef6f2e046b1144fe4bb2a5da8a4c574e7f2ebf7e16b34a6a2fa92/pydantic-2.10.5.tar.gz", hash = "sha256:278b38dbbaec562011d659ee05f63346951b3a248a6f3642e1bc68894ea2b4ff", size = 761287, upload-time = "2025-01-09T13:33:25.929Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/26/82663c79010b28eddf29dcdd0ea723439535fa917fce5905885c0e9ba562/pydantic-2.10.5-py3-none-any.whl", hash = "sha256:4dd4e322dbe55472cb7ca7e73f4b63574eecccf2835ffa2af9021ce113c83c53", size = 431426, upload-time = "2025-01-09T13:33:22.312Z" }, +] + +[[package]] +name = "pydantic-core" +version = "2.27.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/fc/01/f3e5ac5e7c25833db5eb555f7b7ab24cd6f8c322d3a3ad2d67a952dc0abc/pydantic_core-2.27.2.tar.gz", hash = "sha256:eb026e5a4c1fee05726072337ff51d1efb6f59090b7da90d30ea58625b1ffb39", size = 413443, upload-time = "2024-12-18T11:31:54.917Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d6/74/51c8a5482ca447871c93e142d9d4a92ead74de6c8dc5e66733e22c9bba89/pydantic_core-2.27.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9e0c8cfefa0ef83b4da9588448b6d8d2a2bf1a53c3f1ae5fca39eb3061e2f0b0", size = 1893127, upload-time = "2024-12-18T11:28:30.346Z" }, + { url = "https://files.pythonhosted.org/packages/d3/f3/c97e80721735868313c58b89d2de85fa80fe8dfeeed84dc51598b92a135e/pydantic_core-2.27.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:83097677b8e3bd7eaa6775720ec8e0405f1575015a463285a92bfdfe254529ef", size = 1811340, upload-time = "2024-12-18T11:28:32.521Z" }, + { url = "https://files.pythonhosted.org/packages/9e/91/840ec1375e686dbae1bd80a9e46c26a1e0083e1186abc610efa3d9a36180/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:172fce187655fece0c90d90a678424b013f8fbb0ca8b036ac266749c09438cb7", size = 1822900, upload-time = "2024-12-18T11:28:34.507Z" }, + { url = "https://files.pythonhosted.org/packages/f6/31/4240bc96025035500c18adc149aa6ffdf1a0062a4b525c932065ceb4d868/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:519f29f5213271eeeeb3093f662ba2fd512b91c5f188f3bb7b27bc5973816934", size = 1869177, upload-time = "2024-12-18T11:28:36.488Z" }, + { url = "https://files.pythonhosted.org/packages/fa/20/02fbaadb7808be578317015c462655c317a77a7c8f0ef274bc016a784c54/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05e3a55d124407fffba0dd6b0c0cd056d10e983ceb4e5dbd10dda135c31071d6", size = 2038046, upload-time = "2024-12-18T11:28:39.409Z" }, + { url = "https://files.pythonhosted.org/packages/06/86/7f306b904e6c9eccf0668248b3f272090e49c275bc488a7b88b0823444a4/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c3ed807c7b91de05e63930188f19e921d1fe90de6b4f5cd43ee7fcc3525cb8c", size = 2685386, upload-time = "2024-12-18T11:28:41.221Z" }, + { url = "https://files.pythonhosted.org/packages/8d/f0/49129b27c43396581a635d8710dae54a791b17dfc50c70164866bbf865e3/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fb4aadc0b9a0c063206846d603b92030eb6f03069151a625667f982887153e2", size = 1997060, upload-time = "2024-12-18T11:28:44.709Z" }, + { url = "https://files.pythonhosted.org/packages/0d/0f/943b4af7cd416c477fd40b187036c4f89b416a33d3cc0ab7b82708a667aa/pydantic_core-2.27.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:28ccb213807e037460326424ceb8b5245acb88f32f3d2777427476e1b32c48c4", size = 2004870, upload-time = "2024-12-18T11:28:46.839Z" }, + { url = "https://files.pythonhosted.org/packages/35/40/aea70b5b1a63911c53a4c8117c0a828d6790483f858041f47bab0b779f44/pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:de3cd1899e2c279b140adde9357c4495ed9d47131b4a4eaff9052f23398076b3", size = 1999822, upload-time = "2024-12-18T11:28:48.896Z" }, + { url = "https://files.pythonhosted.org/packages/f2/b3/807b94fd337d58effc5498fd1a7a4d9d59af4133e83e32ae39a96fddec9d/pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:220f892729375e2d736b97d0e51466252ad84c51857d4d15f5e9692f9ef12be4", size = 2130364, upload-time = "2024-12-18T11:28:50.755Z" }, + { url = "https://files.pythonhosted.org/packages/fc/df/791c827cd4ee6efd59248dca9369fb35e80a9484462c33c6649a8d02b565/pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a0fcd29cd6b4e74fe8ddd2c90330fd8edf2e30cb52acda47f06dd615ae72da57", size = 2158303, upload-time = "2024-12-18T11:28:54.122Z" }, + { url = "https://files.pythonhosted.org/packages/9b/67/4e197c300976af185b7cef4c02203e175fb127e414125916bf1128b639a9/pydantic_core-2.27.2-cp312-cp312-win32.whl", hash = "sha256:1e2cb691ed9834cd6a8be61228471d0a503731abfb42f82458ff27be7b2186fc", size = 1834064, upload-time = "2024-12-18T11:28:56.074Z" }, + { url = "https://files.pythonhosted.org/packages/1f/ea/cd7209a889163b8dcca139fe32b9687dd05249161a3edda62860430457a5/pydantic_core-2.27.2-cp312-cp312-win_amd64.whl", hash = "sha256:cc3f1a99a4f4f9dd1de4fe0312c114e740b5ddead65bb4102884b384c15d8bc9", size = 1989046, upload-time = "2024-12-18T11:28:58.107Z" }, + { url = "https://files.pythonhosted.org/packages/bc/49/c54baab2f4658c26ac633d798dab66b4c3a9bbf47cff5284e9c182f4137a/pydantic_core-2.27.2-cp312-cp312-win_arm64.whl", hash = "sha256:3911ac9284cd8a1792d3cb26a2da18f3ca26c6908cc434a18f730dc0db7bfa3b", size = 1885092, upload-time = "2024-12-18T11:29:01.335Z" }, +] + +[[package]] +name = "python-dotenv" +version = "1.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bc/57/e84d88dfe0aec03b7a2d4327012c1627ab5f03652216c63d49846d7a6c58/python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca", size = 39115, upload-time = "2024-01-23T06:33:00.505Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6a/3e/b68c118422ec867fa7ab88444e1274aa40681c606d59ac27de5a5588f082/python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a", size = 19863, upload-time = "2024-01-23T06:32:58.246Z" }, +] + +[[package]] +name = "python-lorem" +version = "1.3.0.post3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a5/ff/da026761ffdd68f5c9415ff54c4adaefaa409c422b41d18ed8fa6a59bff5/python_lorem-1.3.0.post3.tar.gz", hash = "sha256:570d532a179783e024864b2799651f748a3e26ded7ee6d694b67f429f7bca6fd", size = 11664, upload-time = "2024-06-26T03:28:57.137Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b4/10/e1533d7aa598cdf73772929ea7e1ef3d62af2260c88b616862b2b2dac974/python_lorem-1.3.0.post3-cp312-none-any.whl", hash = "sha256:6df337cc3c5fe2869f328df669164ce3633cf5347d6a7b92c86a96ac4295b30d", size = 9111, upload-time = "2024-06-26T03:28:55.192Z" }, +] + +[[package]] +name = "pyyaml" +version = "6.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/54/ed/79a089b6be93607fa5cdaedf301d7dfb23af5f25c398d5ead2525b063e17/pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e", size = 130631, upload-time = "2024-08-06T20:33:50.674Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/86/0c/c581167fc46d6d6d7ddcfb8c843a4de25bdd27e4466938109ca68492292c/PyYAML-6.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c70c95198c015b85feafc136515252a261a84561b7b1d51e3384e0655ddf25ab", size = 183873, upload-time = "2024-08-06T20:32:25.131Z" }, + { url = "https://files.pythonhosted.org/packages/a8/0c/38374f5bb272c051e2a69281d71cba6fdb983413e6758b84482905e29a5d/PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce826d6ef20b1bc864f0a68340c8b3287705cae2f8b4b1d932177dcc76721725", size = 173302, upload-time = "2024-08-06T20:32:26.511Z" }, + { url = "https://files.pythonhosted.org/packages/c3/93/9916574aa8c00aa06bbac729972eb1071d002b8e158bd0e83a3b9a20a1f7/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f71ea527786de97d1a0cc0eacd1defc0985dcf6b3f17bb77dcfc8c34bec4dc5", size = 739154, upload-time = "2024-08-06T20:32:28.363Z" }, + { url = "https://files.pythonhosted.org/packages/95/0f/b8938f1cbd09739c6da569d172531567dbcc9789e0029aa070856f123984/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b22676e8097e9e22e36d6b7bda33190d0d400f345f23d4065d48f4ca7ae0425", size = 766223, upload-time = "2024-08-06T20:32:30.058Z" }, + { url = "https://files.pythonhosted.org/packages/b9/2b/614b4752f2e127db5cc206abc23a8c19678e92b23c3db30fc86ab731d3bd/PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80bab7bfc629882493af4aa31a4cfa43a4c57c83813253626916b8c7ada83476", size = 767542, upload-time = "2024-08-06T20:32:31.881Z" }, + { url = "https://files.pythonhosted.org/packages/d4/00/dd137d5bcc7efea1836d6264f049359861cf548469d18da90cd8216cf05f/PyYAML-6.0.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48", size = 731164, upload-time = "2024-08-06T20:32:37.083Z" }, + { url = "https://files.pythonhosted.org/packages/c9/1f/4f998c900485e5c0ef43838363ba4a9723ac0ad73a9dc42068b12aaba4e4/PyYAML-6.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8b9c7197f7cb2738065c481a0461e50ad02f18c78cd75775628afb4d7137fb3b", size = 756611, upload-time = "2024-08-06T20:32:38.898Z" }, + { url = "https://files.pythonhosted.org/packages/df/d1/f5a275fdb252768b7a11ec63585bc38d0e87c9e05668a139fea92b80634c/PyYAML-6.0.2-cp312-cp312-win32.whl", hash = "sha256:ef6107725bd54b262d6dedcc2af448a266975032bc85ef0172c5f059da6325b4", size = 140591, upload-time = "2024-08-06T20:32:40.241Z" }, + { url = "https://files.pythonhosted.org/packages/0c/e8/4f648c598b17c3d06e8753d7d13d57542b30d56e6c2dedf9c331ae56312e/PyYAML-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:7e7401d0de89a9a855c839bc697c079a4af81cf878373abd7dc625847d25cbd8", size = 156338, upload-time = "2024-08-06T20:32:41.93Z" }, +] + +[[package]] +name = "requests" +version = "2.32.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "charset-normalizer" }, + { name = "idna" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf", size = 134517, upload-time = "2025-08-18T20:46:02.573Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/db/4254e3eabe8020b458f1a747140d32277ec7a271daf1d235b70dc0b4e6e3/requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6", size = 64738, upload-time = "2025-08-18T20:46:00.542Z" }, +] + +[[package]] +name = "ruff" +version = "0.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/75/48/385f276f41e89623a5ea8e4eb9c619a44fdfc2a64849916b3584eca6cb9f/ruff-0.9.0.tar.gz", hash = "sha256:143f68fa5560ecf10fc49878b73cee3eab98b777fcf43b0e62d43d42f5ef9d8b", size = 3489167, upload-time = "2025-01-09T14:07:10.387Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e9/01/e0885e5519212efc7ab9d868bc39cb9781931c4c6f9b17becafa81193ec4/ruff-0.9.0-py3-none-linux_armv6l.whl", hash = "sha256:949b3513f931741e006cf267bf89611edff04e1f012013424022add3ce78f319", size = 10647069, upload-time = "2025-01-09T14:06:07.62Z" }, + { url = "https://files.pythonhosted.org/packages/dd/69/510a9a5781dcf84c2ad513c2003936fefc802f39c745d5f2355d77fa45fd/ruff-0.9.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:99fbcb8c7fe94ae1e462ab2a1ef17cb20b25fb6438b9f198b1bcf5207a0a7916", size = 10401936, upload-time = "2025-01-09T14:06:11.54Z" }, + { url = "https://files.pythonhosted.org/packages/07/9f/37fb86bfdf28c4cbfe94cbcc01fb9ab0cb8128548f243f34d5298b212562/ruff-0.9.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:0b022afd8eb0fcfce1e0adec84322abf4d6ce3cd285b3b99c4f17aae7decf749", size = 10010347, upload-time = "2025-01-09T14:06:15.682Z" }, + { url = "https://files.pythonhosted.org/packages/30/0d/b95121f53c7f7bfb7ba427a35d25f983ed3b476620c5cd69f45caa5b294e/ruff-0.9.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:336567ce92c9ca8ec62780d07b5fa11fbc881dc7bb40958f93a7d621e7ab4589", size = 10882152, upload-time = "2025-01-09T14:06:19.319Z" }, + { url = "https://files.pythonhosted.org/packages/d4/0b/a955cb6b19eb900c4c594707ab72132ce2d5cd8b5565137fb8fed21b8f08/ruff-0.9.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d338336c44bda602dc8e8766836ac0441e5b0dfeac3af1bd311a97ebaf087a75", size = 10405502, upload-time = "2025-01-09T14:06:23.182Z" }, + { url = "https://files.pythonhosted.org/packages/1e/fa/9a6c70af74f20edd2519b89eb3322f4bfa399315cf306383443700f2d6b6/ruff-0.9.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d9b3ececf523d733e90b540e7afcc0494189e8999847f8855747acd5a9a8c45f", size = 11465069, upload-time = "2025-01-09T14:06:26.115Z" }, + { url = "https://files.pythonhosted.org/packages/ee/8b/7effac8915470da496be009fe861060baff2692f92801976b2c01cdc8c54/ruff-0.9.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:a11c0872a31232e473e2e0e2107f3d294dbadd2f83fb281c3eb1c22a24866924", size = 12176850, upload-time = "2025-01-09T14:06:29.076Z" }, + { url = "https://files.pythonhosted.org/packages/bd/ed/626179786889eca47b1e821c1582622ac0c1c8f01d60ac974f8b96867a57/ruff-0.9.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b5fd06220c17a9cc0dc7fc6552f2ac4db74e8e8bff9c401d160ac59d00566f54", size = 11700963, upload-time = "2025-01-09T14:06:32.524Z" }, + { url = "https://files.pythonhosted.org/packages/75/79/094c34ddec47fd3c61a0bc5e83ca164344c592949cff91f05961fd40922e/ruff-0.9.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0457e775c74bf3976243f910805242b7dcd389e1d440deccbd1194ca17a5728c", size = 13096560, upload-time = "2025-01-09T14:06:35.289Z" }, + { url = "https://files.pythonhosted.org/packages/e7/23/ec85dca0dcb329835197401734501bfa1d39e72343df64628c67b72bcbf5/ruff-0.9.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05415599bbcb318f730ea1b46a39e4fbf71f6a63fdbfa1dda92efb55f19d7ecf", size = 11278658, upload-time = "2025-01-09T14:06:39.397Z" }, + { url = "https://files.pythonhosted.org/packages/6c/17/1b3ea5f06578ea1daa08ac35f9de099d1827eea6e116a8cabbf11235c925/ruff-0.9.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fbf9864b009e43cfc1c8bed1a6a4c529156913105780af4141ca4342148517f5", size = 10879847, upload-time = "2025-01-09T14:06:42.687Z" }, + { url = "https://files.pythonhosted.org/packages/a6/e5/00bc97d6f419da03c0d898e95cca77311494e7274dc7cc17d94976e32e52/ruff-0.9.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:37b3da222b12e2bb2ce628e02586ab4846b1ed7f31f42a5a0683b213453b2d49", size = 10494220, upload-time = "2025-01-09T14:06:45.719Z" }, + { url = "https://files.pythonhosted.org/packages/cc/70/d0a23d94f3e40b7ffac0e5506f33bb504672569173781a6c7cab0db6a4ba/ruff-0.9.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:733c0fcf2eb0c90055100b4ed1af9c9d87305b901a8feb6a0451fa53ed88199d", size = 11004182, upload-time = "2025-01-09T14:06:49.074Z" }, + { url = "https://files.pythonhosted.org/packages/20/8e/367cf8e401890f823d0e4eb33635d0113719d5660b6522b7295376dd95fd/ruff-0.9.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8221a454bfe5ccdf8017512fd6bb60e6ec30f9ea252b8a80e5b73619f6c3cefd", size = 11345761, upload-time = "2025-01-09T14:06:52.92Z" }, + { url = "https://files.pythonhosted.org/packages/fe/08/4b54e02da73060ebc29368ab15868613f7d2496bde3b01d284d5423646bc/ruff-0.9.0-py3-none-win32.whl", hash = "sha256:d345f2178afd192c7991ddee59155c58145e12ad81310b509bd2e25c5b0247b3", size = 8807005, upload-time = "2025-01-09T14:06:56.316Z" }, + { url = "https://files.pythonhosted.org/packages/a1/a7/0b422971e897c51bf805f998d75bcfe5d4d858f5002203832875fc91b733/ruff-0.9.0-py3-none-win_amd64.whl", hash = "sha256:0cbc0905d94d21305872f7f8224e30f4bbcd532bc21b2225b2446d8fc7220d19", size = 9689974, upload-time = "2025-01-09T14:07:03.511Z" }, + { url = "https://files.pythonhosted.org/packages/73/0e/c00f66731e514be3299801b1d9d54efae0abfe8f00a5c14155f2ab9e2920/ruff-0.9.0-py3-none-win_arm64.whl", hash = "sha256:7b1148771c6ca88f820d761350a053a5794bc58e0867739ea93eb5e41ad978cd", size = 9147729, upload-time = "2025-01-09T14:07:06.718Z" }, +] + +[[package]] +name = "structlog" +version = "24.4.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/78/a3/e811a94ac3853826805253c906faa99219b79951c7d58605e89c79e65768/structlog-24.4.0.tar.gz", hash = "sha256:b27bfecede327a6d2da5fbc96bd859f114ecc398a6389d664f62085ee7ae6fc4", size = 1348634, upload-time = "2024-07-17T12:38:43.483Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bf/65/813fc133609ebcb1299be6a42e5aea99d6344afb35ccb43f67e7daaa3b92/structlog-24.4.0-py3-none-any.whl", hash = "sha256:597f61e80a91cc0749a9fd2a098ed76715a1c8a01f73e336b746504d1aad7610", size = 67180, upload-time = "2024-07-17T12:38:41.043Z" }, +] + +[[package]] +name = "types-jmespath" +version = "1.0.2.20250809" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d5/ff/6848b1603ca47fff317b44dfff78cc1fb0828262f840b3ab951b619d5a22/types_jmespath-1.0.2.20250809.tar.gz", hash = "sha256:e194efec21c0aeae789f701ae25f17c57c25908e789b1123a5c6f8d915b4adff", size = 10248, upload-time = "2025-08-09T03:14:57.996Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/6a/65c8be6b6555beaf1a654ae1c2308c2e19a610c0b318a9730e691b79ac79/types_jmespath-1.0.2.20250809-py3-none-any.whl", hash = "sha256:4147d17cc33454f0dac7e78b4e18e532a1330c518d85f7f6d19e5818ab83da21", size = 11494, upload-time = "2025-08-09T03:14:57.292Z" }, +] + +[[package]] +name = "types-pyyaml" +version = "6.0.12.20250822" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/85/90a442e538359ab5c9e30de415006fb22567aa4301c908c09f19e42975c2/types_pyyaml-6.0.12.20250822.tar.gz", hash = "sha256:259f1d93079d335730a9db7cff2bcaf65d7e04b4a56b5927d49a612199b59413", size = 17481, upload-time = "2025-08-22T03:02:16.209Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/32/8e/8f0aca667c97c0d76024b37cffa39e76e2ce39ca54a38f285a64e6ae33ba/types_pyyaml-6.0.12.20250822-py3-none-any.whl", hash = "sha256:1fe1a5e146aa315483592d292b72a172b65b946a6d98aa6ddd8e4aa838ab7098", size = 20314, upload-time = "2025-08-22T03:02:15.002Z" }, +] + +[[package]] +name = "types-requests" +version = "2.32.4.20250809" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ed/b0/9355adb86ec84d057fea765e4c49cce592aaf3d5117ce5609a95a7fc3dac/types_requests-2.32.4.20250809.tar.gz", hash = "sha256:d8060de1c8ee599311f56ff58010fb4902f462a1470802cf9f6ed27bc46c4df3", size = 23027, upload-time = "2025-08-09T03:17:10.664Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2b/6f/ec0012be842b1d888d46884ac5558fd62aeae1f0ec4f7a581433d890d4b5/types_requests-2.32.4.20250809-py3-none-any.whl", hash = "sha256:f73d1832fb519ece02c85b1f09d5f0dd3108938e7d47e7f94bbfa18a6782b163", size = 20644, upload-time = "2025-08-09T03:17:09.716Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.12.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8", size = 85321, upload-time = "2024-06-07T18:52:15.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", size = 37438, upload-time = "2024-06-07T18:52:13.582Z" }, +] + +[[package]] +name = "tzdata" +version = "2025.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/95/32/1a225d6164441be760d75c2c42e2780dc0873fe382da3e98a2e1e48361e5/tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9", size = 196380, upload-time = "2025-03-23T13:54:43.652Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8", size = 347839, upload-time = "2025-03-23T13:54:41.845Z" }, +] + +[[package]] +name = "urllib3" +version = "2.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/15/22/9ee70a2574a4f4599c47dd506532914ce044817c7752a79b6a51286319bc/urllib3-2.5.0.tar.gz", hash = "sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760", size = 393185, upload-time = "2025-06-18T14:07:41.644Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl", hash = "sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc", size = 129795, upload-time = "2025-06-18T14:07:40.39Z" }, +]