From b6559b01c40161b791995e0bcf517ee963a55df7 Mon Sep 17 00:00:00 2001 From: Mike Gray Date: Tue, 16 Jan 2024 23:40:54 -0600 Subject: [PATCH] fix: make helloworld skill installable addresses #14 --- src/files/setup.py.ts | 2 +- src/index.ts | 3 +- test/OVOSSkillProject.test.ts | 63 +- .../OVOSSkillProject.test.ts.snap | 1730 ++++++++++++++++- 4 files changed, 1793 insertions(+), 5 deletions(-) diff --git a/src/files/setup.py.ts b/src/files/setup.py.ts index c57816f..8866016 100644 --- a/src/files/setup.py.ts +++ b/src/files/setup.py.ts @@ -117,7 +117,7 @@ setup( author="${author}", author_email="${authorAddress}", license="${license}", - package_dir={SKILL_PKG: ""}, + package_dir={SKILL_PKG: "${packageDir ?? '.'}"}, package_data={SKILL_PKG: find_resource_files()}, packages=[SKILL_PKG], include_package_data=True, diff --git a/src/index.ts b/src/index.ts index 8aa42cb..907b2d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -199,7 +199,7 @@ ${line}`; new SampleFile(this, 'skill.json', { contents: '{}', }); - let requirements = 'ovos-utils\novos-bus-client\novos-workshop\n# Your requirements here\n'; + let requirements = 'ovos-utils\novos-bus-client\novos-workshop\novos-plugin-manager\n# Your requirements here\n'; let manifestReqs = ''; if (existsSync('manifest.yml')) { // Load and parse YAML file @@ -425,6 +425,7 @@ ${line}`; const dirPath = join(sourceFolder, dir); // Check if the directory exists before proceeding + console.debug(`Checking if ${dirPath} folder exists in original skill...`); if (!existsSync(dirPath)) { console.warn(`${dir} folder not found in original skill; skipping.`); return; // Continue to the next iteration of the loop diff --git a/test/OVOSSkillProject.test.ts b/test/OVOSSkillProject.test.ts index 03032ca..78d1173 100644 --- a/test/OVOSSkillProject.test.ts +++ b/test/OVOSSkillProject.test.ts @@ -1,4 +1,4 @@ -import { rmSync, writeFileSync } from 'fs'; +import { existsSync, mkdirSync, rm, rmSync, writeFileSync } from 'fs'; import { Testing } from 'projen'; import { OVOSSkillProject } from '../src'; @@ -15,6 +15,32 @@ test('snapshot', () => { expect(synth['requirements.txt']).toContain('ovos-utils\novos-bus-client\novos-workshop'); }); +describe('packageDir snapshot', () => { + test('old style package in root', () => { + const project = new OVOSSkillProject({ + name: 'test', + skillClass: 'TestSkill', + pypiName: 'test-skill', + packageDir: '.', + }); + + const synth = Testing.synth(project); + expect(synth).toMatchSnapshot(); + expect(synth['setup.py']).toContain('package_dir={SKILL_PKG: "."},'); + }); + test('new style package in src', () => { + const project = new OVOSSkillProject({ + name: 'test', + skillClass: 'TestSkill', + pypiName: 'test-skill', + }); + + const synth = Testing.synth(project); + expect(synth).toMatchSnapshot(); + expect(synth['setup.py']).toContain('package_dir={SKILL_PKG: "src"},'); + }); +}); + test('snapshot retrofit', () => { const project = new OVOSSkillProject({ name: 'test', @@ -53,4 +79,39 @@ test('snapshot retrofit with manifest.yml', () => { rmSync('manifest.yml'); rmSync('TODO.md'); +}); + +test('snapshot refactoring locale', () => { + try { + + // Create directories and example files + mkdirSync('vocab/en-us', { recursive: true }); + mkdirSync('dialog/en-us', { recursive: true }); + mkdirSync('regex/en-us', { recursive: true }); + mkdirSync('intents/en-us', { recursive: true }); + writeFileSync('vocab/en-us/ExampleKeyword.voc', 'example', { flag: 'w' }); + writeFileSync('dialog/en-us/hello.dialog', 'example', { flag: 'w' }); + writeFileSync('regex/en-us/example.rx', '^example$', { flag: 'w' }); + writeFileSync('intents/en-us/hello.intent', 'example', { flag: 'w' }); + const project = new OVOSSkillProject({ + name: 'test', + skillClass: 'TestSkill', + pypiName: 'test-skill', + retrofit: true, + }); + + const synth = Testing.synth(project); + expect(synth).toMatchSnapshot(); + expect(existsSync('locale/en-us/vocab/ExampleKeyword.voc')).toBeTruthy(); + expect(existsSync('locale/en-us/dialog/hello.dialog')).toBeTruthy(); + expect(existsSync('locale/en-us/regex/example.rx')).toBeTruthy(); + expect(existsSync('locale/en-us/intents/hello.intent')).toBeTruthy(); + } finally { + rm('vocab', { recursive: true, force: true }, () => {}); + rm('dialog', { recursive: true, force: true }, () => {}); + rm('regex', { recursive: true, force: true }, () => {}); + rm('intents', { recursive: true, force: true }, () => {}); + rm('locale', { recursive: true, force: true }, () => {}); + } + }); \ No newline at end of file diff --git a/test/__snapshots__/OVOSSkillProject.test.ts.snap b/test/__snapshots__/OVOSSkillProject.test.ts.snap index 448cb41..9ba76ae 100644 --- a/test/__snapshots__/OVOSSkillProject.test.ts.snap +++ b/test/__snapshots__/OVOSSkillProject.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`snapshot 1`] = ` +exports[`packageDir snapshot new style package in src 1`] = ` Object { ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". @@ -446,6 +446,7 @@ ovos skill "requirements.txt": "ovos-utils ovos-bus-client ovos-workshop +ovos-plugin-manager # Your requirements here ", @@ -522,7 +523,7 @@ setup( author=\\"TODO: Add 'author' to .projenrc.json and run pj\\", author_email=\\"TODO: Add 'authorAddress' to .projenrc.json and run pj\\", license=\\"# TODO: Add 'license' to .projenrc.json and run pj\\", - package_dir={SKILL_PKG: \\"\\"}, + package_dir={SKILL_PKG: \\"src\\"}, package_data={SKILL_PKG: find_resource_files()}, packages=[SKILL_PKG], include_package_data=True, @@ -668,6 +669,1729 @@ VERSION_ALPHA = 0", } `; +exports[`packageDir snapshot old style package in root 1`] = ` +Object { + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +/.gitattributes linguist-generated +/.github/workflows/license_tests.yml linguist-generated +/.github/workflows/propose_release.yml linguist-generated +/.github/workflows/publish_alpha.yml linguist-generated +/.github/workflows/publish_release.yml linguist-generated +/.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/skill_tests.yml linguist-generated +/.github/workflows/update_skill_json.yml linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/setup.py linguist-generated", + ".github/workflows/license_tests.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: license_tests +on: + push: {} + workflow_dispatch: {} + pull_request: + branches: + - master + - main +jobs: + license_tests: + name: license_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/license_tests.yml@master +", + ".github/workflows/propose_release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: propose_release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - build + - minor + - major + - patch + - alpha +jobs: + update_version: + name: update_version + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + release_type: \${{ inputs.release_type }} + version_file: version.py + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR + update_changelog: true + branch: dev + pull_changes: + needs: update_version + permissions: + contents: write + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + with: + pr_assignee: \${{ github.actor }} + pr_draft: false + pr_title: \${{ needs.update_version.outputs.version }} + pr_body: \${{ needs.update_version.outputs.changelog }} +", + ".github/workflows/publish_alpha.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: publish_alpha +on: + push: + branches: + - dev + paths: + - \\"!version.py\\" + - \\"!test/**\\" + - \\"!examples/**\\" + - \\"!.github/**\\" + - \\"!.gitignore\\" + - \\"!LICENSE\\" + - \\"!CHANGELOG.md\\" + - \\"!MANIFEST.in\\" + - \\"!README.md\\" + - \\"!scripts/*\\" + workflow_dispatch: {} +jobs: + publish_alpha_release: + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + with: + version_file: version.py + publish_prerelease: true + update_changelog: true + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR +", + ".github/workflows/publish_release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: publish_release +on: + push: + branches: + - master + - main +jobs: + build_and_publish_pypi_and_release: + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: + PYPI_TOKEN: \${{ secrets.PYPI_TOKEN }} +", + ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: pull-request-lint +on: + pull_request_target: + types: + - labeled + - opened + - synchronize + - reopened + - ready_for_review + - edited +jobs: + validate: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.0.2 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + types: |- + feat + fix + chore + requireScope: false +", + ".github/workflows/skill_tests.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: skill_tests +on: + pull_request: {} + workflow_dispatch: {} +jobs: + py_build_tests: + name: py_build_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master + skill_unit_tests: + name: skill_unit_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_tests.yml@master + skill_intent_tests: + name: skill_intent_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_intents.yml@master + skill_resource_tests: + name: skill_resource_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_resources.yml@master + skill_install_tests: + name: skill_install_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_installation.yml@master +", + ".github/workflows/update_skill_json.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: update_skill_json +on: + push: {} +jobs: + update-skill-json: + name: update_skill_json + permissions: + contents: write + uses: neongeckocom/.github/.github/workflows/skill_update_json_spec.yml@master +", + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/.github/workflows/pull-request-lint.yml +.DS_Store +node_modules +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +!/setup.py +!/.github/workflows/license_tests.yml +!/.github/workflows/propose_release.yml +!/.github/workflows/publish_alpha.yml +!/.github/workflows/publish_release.yml +!/.github/workflows/skill_tests.yml +!/.github/workflows/update_skill_json.yml +", + ".projen/files.json": Object { + "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\".", + "files": Array [ + ".gitattributes", + ".github/workflows/license_tests.yml", + ".github/workflows/propose_release.yml", + ".github/workflows/publish_alpha.yml", + ".github/workflows/publish_release.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/skill_tests.yml", + ".github/workflows/update_skill_json.yml", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "setup.py", + ], + }, + ".projen/tasks.json": Object { + "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\".", + "tasks": Object { + "build": Object { + "description": "Full release build", + "name": "build", + "steps": Array [ + Object { + "spawn": "default", + }, + Object { + "spawn": "pre-compile", + }, + Object { + "spawn": "compile", + }, + Object { + "spawn": "post-compile", + }, + Object { + "spawn": "test", + }, + Object { + "spawn": "package", + }, + ], + }, + "clobber": Object { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": Object { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": Array [ + Object { + "exec": "git checkout -b scratch", + "name": "save current HEAD in \\"scratch\\" branch", + }, + Object { + "exec": "git checkout $BRANCH", + }, + Object { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + Object { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + Object { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + Object { + "say": "ready to rock! (unpushed commits are under the \\"scratch\\" branch)", + }, + ], + }, + "compile": Object { + "description": "Only compile", + "name": "compile", + }, + "default": Object { + "description": "Synthesize project files", + "env": Object { + "FILENAME": ".projenrc.json", + }, + "name": "default", + "steps": Array [ + Object { + "builtin": "run-projenrc-json", + }, + ], + }, + "eject": Object { + "description": "Remove projen from the project", + "env": Object { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": Array [ + Object { + "spawn": "default", + }, + ], + }, + "package": Object { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": Object { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": Object { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": Object { + "description": "Run tests", + "name": "test", + }, + }, + }, + "README.md": "# TestSkill + +Introductory Skill so that Skill Authors can see how an OVOS Skill is put together + +## About + +Information about your skill + +## Examples + +- \\"Hello world\\" +- \\"How are you?\\" +- \\"Thank you\\" + +## Credits + +authorName (@githubUsername) + +## Category + +TODO: + +## Tags + +ovos skill +", + "requirements.txt": "ovos-utils +ovos-bus-client +ovos-workshop +ovos-plugin-manager +# Your requirements here + +", + "setup.py": "#!/usr/bin/env python3 +from setuptools import setup +from os import walk, path + +BASEDIR = path.abspath(path.dirname(__file__)) +URL = \\"TODO: Add 'repositoryUrl' to .projenrc.json and run pj\\" +SKILL_CLAZZ = \\"TestSkill\\" # needs to match __init__.py class name +PYPI_NAME = \\"test-skill\\" # pip install PYPI_NAME + +# below derived from github url to ensure standard skill_id +SKILL_AUTHOR, SKILL_NAME = URL.split(\\".com/\\")[-1].split(\\"/\\") +SKILL_PKG = SKILL_NAME.lower().replace(\\"-\\", \\"_\\") +PLUGIN_ENTRY_POINT = f\\"{SKILL_NAME.lower()}.{SKILL_AUTHOR.lower()}={SKILL_PKG}:{SKILL_CLAZZ}\\" +# skill_id=package_name:SkillClass +BASE_PATH = BASE_PATH = path.abspath(path.join(path.dirname(__file__), \\".\\")) + + +def get_version(): + \\"\\"\\"Find the version of the package\\"\\"\\" + version = None + version_file = path.join(BASE_PATH, \\"version.py\\") + major, minor, build, alpha = (None, None, None, None) + with open(version_file) as f: + for line in f: + if \\"VERSION_MAJOR\\" in line: + major = line.split(\\"=\\")[1].strip() + elif \\"VERSION_MINOR\\" in line: + minor = line.split(\\"=\\")[1].strip() + elif \\"VERSION_BUILD\\" in line: + build = line.split(\\"=\\")[1].strip() + elif \\"VERSION_ALPHA\\" in line: + alpha = line.split(\\"=\\")[1].strip() + + if (major and minor and build and alpha) or \\"# END_VERSION_BLOCK\\" in line: + break + version = f\\"{major}.{minor}.{build}\\" + if alpha and int(alpha) > 0: + version += f\\"a{alpha}\\" + return version + + +def get_requirements(requirements_filename: str): + requirements_file = path.join(path.dirname(__file__), requirements_filename) + with open(requirements_file, \\"r\\", encoding=\\"utf-8\\") as r: + requirements = r.readlines() + requirements = [r.strip() for r in requirements if r.strip() and not r.strip().startswith(\\"#\\")] + return requirements + + +def find_resource_files(): + resource_base_dirs = (\\"locale\\", \\"intents\\", \\"dialog\\", \\"vocab\\", \\"regex\\", \\"ui\\") + package_data = [\\"*.json\\"] + for res in resource_base_dirs: + if path.isdir(path.join(BASE_PATH, res)): + for directory, _, files in walk(path.join(BASE_PATH, res)): + if files: + package_data.append(path.join(directory.replace(BASE_PATH, \\"\\").lstrip(\\"/\\"), \\"*\\")) + return package_data + + +with open(\\"README.md\\", \\"r\\") as f: + long_description = f.read() + +setup( + name=PYPI_NAME, + version=get_version(), + description=\\"\\", + long_description=long_description, + long_description_content_type=\\"text/markdown\\", + url=URL, + author=\\"TODO: Add 'author' to .projenrc.json and run pj\\", + author_email=\\"TODO: Add 'authorAddress' to .projenrc.json and run pj\\", + license=\\"# TODO: Add 'license' to .projenrc.json and run pj\\", + package_dir={SKILL_PKG: \\".\\"}, + package_data={SKILL_PKG: find_resource_files()}, + packages=[SKILL_PKG], + include_package_data=True, + install_requires=get_requirements(\\"requirements.txt\\"), + keywords=\\"ovos skill voice assistant\\", + entry_points={\\"ovos.plugin.skill\\": PLUGIN_ENTRY_POINT}, +) +", + "skill.json": Object {}, +} +`; + +exports[`snapshot 1`] = ` +Object { + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +/.gitattributes linguist-generated +/.github/workflows/license_tests.yml linguist-generated +/.github/workflows/propose_release.yml linguist-generated +/.github/workflows/publish_alpha.yml linguist-generated +/.github/workflows/publish_release.yml linguist-generated +/.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/skill_tests.yml linguist-generated +/.github/workflows/update_skill_json.yml linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/setup.py linguist-generated", + ".github/workflows/license_tests.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: license_tests +on: + push: {} + workflow_dispatch: {} + pull_request: + branches: + - master + - main +jobs: + license_tests: + name: license_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/license_tests.yml@master +", + ".github/workflows/propose_release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: propose_release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - build + - minor + - major + - patch + - alpha +jobs: + update_version: + name: update_version + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + release_type: \${{ inputs.release_type }} + version_file: version.py + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR + update_changelog: true + branch: dev + pull_changes: + needs: update_version + permissions: + contents: write + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + with: + pr_assignee: \${{ github.actor }} + pr_draft: false + pr_title: \${{ needs.update_version.outputs.version }} + pr_body: \${{ needs.update_version.outputs.changelog }} +", + ".github/workflows/publish_alpha.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: publish_alpha +on: + push: + branches: + - dev + paths: + - \\"!version.py\\" + - \\"!test/**\\" + - \\"!examples/**\\" + - \\"!.github/**\\" + - \\"!.gitignore\\" + - \\"!LICENSE\\" + - \\"!CHANGELOG.md\\" + - \\"!MANIFEST.in\\" + - \\"!README.md\\" + - \\"!scripts/*\\" + workflow_dispatch: {} +jobs: + publish_alpha_release: + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + with: + version_file: version.py + publish_prerelease: true + update_changelog: true + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR +", + ".github/workflows/publish_release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: publish_release +on: + push: + branches: + - master + - main +jobs: + build_and_publish_pypi_and_release: + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: + PYPI_TOKEN: \${{ secrets.PYPI_TOKEN }} +", + ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: pull-request-lint +on: + pull_request_target: + types: + - labeled + - opened + - synchronize + - reopened + - ready_for_review + - edited +jobs: + validate: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.0.2 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + types: |- + feat + fix + chore + requireScope: false +", + ".github/workflows/skill_tests.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: skill_tests +on: + pull_request: {} + workflow_dispatch: {} +jobs: + py_build_tests: + name: py_build_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master + skill_unit_tests: + name: skill_unit_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_tests.yml@master + skill_intent_tests: + name: skill_intent_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_intents.yml@master + skill_resource_tests: + name: skill_resource_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_resources.yml@master + skill_install_tests: + name: skill_install_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_installation.yml@master +", + ".github/workflows/update_skill_json.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: update_skill_json +on: + push: {} +jobs: + update-skill-json: + name: update_skill_json + permissions: + contents: write + uses: neongeckocom/.github/.github/workflows/skill_update_json_spec.yml@master +", + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/.github/workflows/pull-request-lint.yml +.DS_Store +node_modules +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +!/setup.py +!/.github/workflows/license_tests.yml +!/.github/workflows/propose_release.yml +!/.github/workflows/publish_alpha.yml +!/.github/workflows/publish_release.yml +!/.github/workflows/skill_tests.yml +!/.github/workflows/update_skill_json.yml +", + ".projen/files.json": Object { + "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\".", + "files": Array [ + ".gitattributes", + ".github/workflows/license_tests.yml", + ".github/workflows/propose_release.yml", + ".github/workflows/publish_alpha.yml", + ".github/workflows/publish_release.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/skill_tests.yml", + ".github/workflows/update_skill_json.yml", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "setup.py", + ], + }, + ".projen/tasks.json": Object { + "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\".", + "tasks": Object { + "build": Object { + "description": "Full release build", + "name": "build", + "steps": Array [ + Object { + "spawn": "default", + }, + Object { + "spawn": "pre-compile", + }, + Object { + "spawn": "compile", + }, + Object { + "spawn": "post-compile", + }, + Object { + "spawn": "test", + }, + Object { + "spawn": "package", + }, + ], + }, + "clobber": Object { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": Object { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": Array [ + Object { + "exec": "git checkout -b scratch", + "name": "save current HEAD in \\"scratch\\" branch", + }, + Object { + "exec": "git checkout $BRANCH", + }, + Object { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + Object { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + Object { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + Object { + "say": "ready to rock! (unpushed commits are under the \\"scratch\\" branch)", + }, + ], + }, + "compile": Object { + "description": "Only compile", + "name": "compile", + }, + "default": Object { + "description": "Synthesize project files", + "env": Object { + "FILENAME": ".projenrc.json", + }, + "name": "default", + "steps": Array [ + Object { + "builtin": "run-projenrc-json", + }, + ], + }, + "eject": Object { + "description": "Remove projen from the project", + "env": Object { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": Array [ + Object { + "spawn": "default", + }, + ], + }, + "package": Object { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": Object { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": Object { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": Object { + "description": "Run tests", + "name": "test", + }, + }, + }, + "README.md": "# TestSkill + +Introductory Skill so that Skill Authors can see how an OVOS Skill is put together + +## About + +Information about your skill + +## Examples + +- \\"Hello world\\" +- \\"How are you?\\" +- \\"Thank you\\" + +## Credits + +authorName (@githubUsername) + +## Category + +TODO: + +## Tags + +ovos skill +", + "requirements.txt": "ovos-utils +ovos-bus-client +ovos-workshop +ovos-plugin-manager +# Your requirements here + +", + "setup.py": "#!/usr/bin/env python3 +from setuptools import setup +from os import walk, path + +BASEDIR = path.abspath(path.dirname(__file__)) +URL = \\"TODO: Add 'repositoryUrl' to .projenrc.json and run pj\\" +SKILL_CLAZZ = \\"TestSkill\\" # needs to match __init__.py class name +PYPI_NAME = \\"test-skill\\" # pip install PYPI_NAME + +# below derived from github url to ensure standard skill_id +SKILL_AUTHOR, SKILL_NAME = URL.split(\\".com/\\")[-1].split(\\"/\\") +SKILL_PKG = SKILL_NAME.lower().replace(\\"-\\", \\"_\\") +PLUGIN_ENTRY_POINT = f\\"{SKILL_NAME.lower()}.{SKILL_AUTHOR.lower()}={SKILL_PKG}:{SKILL_CLAZZ}\\" +# skill_id=package_name:SkillClass +BASE_PATH = BASE_PATH = path.abspath(path.join(path.dirname(__file__), \\"src\\")) + + +def get_version(): + \\"\\"\\"Find the version of the package\\"\\"\\" + version = None + version_file = path.join(BASE_PATH, \\"version.py\\") + major, minor, build, alpha = (None, None, None, None) + with open(version_file) as f: + for line in f: + if \\"VERSION_MAJOR\\" in line: + major = line.split(\\"=\\")[1].strip() + elif \\"VERSION_MINOR\\" in line: + minor = line.split(\\"=\\")[1].strip() + elif \\"VERSION_BUILD\\" in line: + build = line.split(\\"=\\")[1].strip() + elif \\"VERSION_ALPHA\\" in line: + alpha = line.split(\\"=\\")[1].strip() + + if (major and minor and build and alpha) or \\"# END_VERSION_BLOCK\\" in line: + break + version = f\\"{major}.{minor}.{build}\\" + if alpha and int(alpha) > 0: + version += f\\"a{alpha}\\" + return version + + +def get_requirements(requirements_filename: str): + requirements_file = path.join(path.dirname(__file__), requirements_filename) + with open(requirements_file, \\"r\\", encoding=\\"utf-8\\") as r: + requirements = r.readlines() + requirements = [r.strip() for r in requirements if r.strip() and not r.strip().startswith(\\"#\\")] + return requirements + + +def find_resource_files(): + resource_base_dirs = (\\"locale\\", \\"intents\\", \\"dialog\\", \\"vocab\\", \\"regex\\", \\"ui\\") + package_data = [\\"*.json\\"] + for res in resource_base_dirs: + if path.isdir(path.join(BASE_PATH, res)): + for directory, _, files in walk(path.join(BASE_PATH, res)): + if files: + package_data.append(path.join(directory.replace(BASE_PATH, \\"\\").lstrip(\\"/\\"), \\"*\\")) + return package_data + + +with open(\\"README.md\\", \\"r\\") as f: + long_description = f.read() + +setup( + name=PYPI_NAME, + version=get_version(), + description=\\"\\", + long_description=long_description, + long_description_content_type=\\"text/markdown\\", + url=URL, + author=\\"TODO: Add 'author' to .projenrc.json and run pj\\", + author_email=\\"TODO: Add 'authorAddress' to .projenrc.json and run pj\\", + license=\\"# TODO: Add 'license' to .projenrc.json and run pj\\", + package_dir={SKILL_PKG: \\"src\\"}, + package_data={SKILL_PKG: find_resource_files()}, + packages=[SKILL_PKG], + include_package_data=True, + install_requires=get_requirements(\\"requirements.txt\\"), + keywords=\\"ovos skill voice assistant\\", + entry_points={\\"ovos.plugin.skill\\": PLUGIN_ENTRY_POINT}, +) +", + "skill.json": Object {}, + "src/__init__.py": "from ovos_utils import classproperty +from ovos_utils.intents import IntentBuilder +from ovos_utils.process_utils import RuntimeRequirements +from ovos_workshop.decorators import intent_handler +# from ovos_workshop.intents import IntentHandler # Uncomment to use Adapt intents +from ovos_workshop.skills import OVOSSkill + +# Optional - if you want to populate settings.json with default values, do so here +DEFAULT_SETTINGS = { + \\"setting1\\": True, + \\"setting2\\": 50, + \\"setting3\\": \\"test\\" +} + +class HelloWorldSkill(OVOSSkill): + def __init__(self, *args, bus=None, **kwargs): + \\"\\"\\"The __init__ method is called when the Skill is first constructed. + Note that self.bus, self.skill_id, self.settings, and + other base class settings are only available after the call to super(). + + This is a good place to load and pre-process any data needed by your + Skill, ideally after the super() call. + \\"\\"\\" + super().__init__(*args, bus=bus, **kwargs) + self.learning = True + + def initialize(self): + # merge default settings + # self.settings is a jsondb, which extends the dict class and adds helpers like merge + self.settings.merge(DEFAULT_SETTINGS, new_only=True) + + @classproperty + def runtime_requirements(self): + return RuntimeRequirements( + internet_before_load=False, + network_before_load=False, + gui_before_load=False, + requires_internet=False, + requires_network=False, + requires_gui=False, + no_internet_fallback=True, + no_network_fallback=True, + no_gui_fallback=True, + ) + + @property + def my_setting(self): + \\"\\"\\"Dynamically get the my_setting from the skill settings file. + If it doesn't exist, return the default value. + This will reflect live changes to settings.json files (local or from backend) + \\"\\"\\" + return self.settings.get(\\"my_setting\\", \\"default_value\\") + + @intent_handler(\\"HowAreYou.intent\\") + def handle_how_are_you_intent(self, message): + \\"\\"\\"This is a Padatious intent handler. + It is triggered using a list of sample phrases.\\"\\"\\" + self.speak_dialog(\\"hello_world\\") + + @intent_handler(IntentBuilder(\\"HelloWorldIntent\\").require(\\"HelloWorldKeyword\\")) + def handle_hello_world_intent(self, message): + \\"\\"\\"This is an Adapt intent handler, it is triggered by a keyword. + Skills can log useful information. These will appear in the CLI and + the skills.log file.\\"\\"\\" + self.log.info(\\"There are five types of log messages: \\" \\"info, debug, warning, error, and exception.\\") + self.speak_dialog(\\"hello_world\\") + + @intent_handler(IntentBuilder(\\"RoboticsLawsIntent\\").require(\\"LawKeyword\\").build()) + def handle_robotic_laws_intent(self, message): + \\"\\"\\"This is an Adapt intent handler, but using a RegEx intent.\\"\\"\\" + # Optionally, get the RegEx group from the intent message + # law = str(message.data.get(\\"LawOfRobotics\\", \\"all\\")) + self.speak_dialog(\\"robotics\\") + + def stop(self): + \\"\\"\\"Optional action to take when \\"stop\\" is requested by the user. + This method should return True if it stopped something or + False (or None) otherwise. + If not relevant to your skill, feel free to remove. + \\"\\"\\" + return +", + "src/locale/en-us/dialog/hello_world.dialog": "hello world! +hullo world!", + "src/locale/en-us/dialog/robotics.dialog": "I am not bound by the laws of robotics", + "src/locale/en-us/intents/HowAreYou.intent": "how are you( doing|) +how have you been +how has your day been", + "src/locale/en-us/regex/Law.rx": "(the|is) (?P.*) (law of robotic|law of robotics)", + "src/locale/en-us/vocab/HelloWorldKeyword.voc": "hello world +greetings", + "src/settingsmeta.yaml": "skillMetadata: + sections: + - name: Label Field Example + fields: + - type: label + label: This is descriptive text. + - name: Email Field Example + fields: + - name: my_email_address + type: email + label: Enter your email address + value: + - name: Password Field Example + fields: + - name: my_password + type: password + label: Enter your password + value: + # - name: Checkbox Field Example + # fields: + # - name: my_boolean + # type: checkbox + # label: This is an example checkbox. It creates a Boolean value. + # value: \\"false\\" # OVOS expects a string of \\"true\\" or \\"false\\" rather than a Boolean + # - name: Number Field Example + # fields: + # - name: my_number + # type: number + # label: Enter any number + # value: 7 + # - name: Select Field Example + # fields: + # - name: my_selected_option + # type: select + # label: Select an option + # options: Option 1|option_one;Option 2|option_two;Option 3|option_three + # value: option_one +", + "src/version.py": "VERSION_MAJOR = 0 +VERSION_MINOR = 0 +VERSION_BUILD = 1 +VERSION_ALPHA = 0", +} +`; + +exports[`snapshot refactoring locale 1`] = ` +Object { + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +/.gitattributes linguist-generated +/.github/workflows/license_tests.yml linguist-generated +/.github/workflows/propose_release.yml linguist-generated +/.github/workflows/publish_alpha.yml linguist-generated +/.github/workflows/publish_release.yml linguist-generated +/.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/skill_tests.yml linguist-generated +/.github/workflows/update_skill_json.yml linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/setup.py linguist-generated +/version.py linguist-generated", + ".github/workflows/license_tests.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: license_tests +on: + push: {} + workflow_dispatch: {} + pull_request: + branches: + - master + - main +jobs: + license_tests: + name: license_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/license_tests.yml@master +", + ".github/workflows/propose_release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: propose_release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - build + - minor + - major + - patch + - alpha +jobs: + update_version: + name: update_version + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + release_type: \${{ inputs.release_type }} + version_file: version.py + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR + update_changelog: true + branch: dev + pull_changes: + needs: update_version + permissions: + contents: write + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + with: + pr_assignee: \${{ github.actor }} + pr_draft: false + pr_title: \${{ needs.update_version.outputs.version }} + pr_body: \${{ needs.update_version.outputs.changelog }} +", + ".github/workflows/publish_alpha.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: publish_alpha +on: + push: + branches: + - dev + paths: + - \\"!version.py\\" + - \\"!test/**\\" + - \\"!examples/**\\" + - \\"!.github/**\\" + - \\"!.gitignore\\" + - \\"!LICENSE\\" + - \\"!CHANGELOG.md\\" + - \\"!MANIFEST.in\\" + - \\"!README.md\\" + - \\"!scripts/*\\" + workflow_dispatch: {} +jobs: + publish_alpha_release: + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + with: + version_file: version.py + publish_prerelease: true + update_changelog: true + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR +", + ".github/workflows/publish_release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: publish_release +on: + push: + branches: + - master + - main +jobs: + build_and_publish_pypi_and_release: + permissions: + contents: write + packages: write + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: + PYPI_TOKEN: \${{ secrets.PYPI_TOKEN }} +", + ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: pull-request-lint +on: + pull_request_target: + types: + - labeled + - opened + - synchronize + - reopened + - ready_for_review + - edited +jobs: + validate: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.0.2 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + types: |- + feat + fix + chore + requireScope: false +", + ".github/workflows/skill_tests.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: skill_tests +on: + pull_request: {} + workflow_dispatch: {} +jobs: + py_build_tests: + name: py_build_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master + skill_unit_tests: + name: skill_unit_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_tests.yml@master + skill_intent_tests: + name: skill_intent_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_intents.yml@master + skill_resource_tests: + name: skill_resource_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_resources.yml@master + skill_install_tests: + name: skill_install_tests + permissions: + contents: read + uses: neongeckocom/.github/.github/workflows/skill_test_installation.yml@master +", + ".github/workflows/update_skill_json.yml": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". + +name: update_skill_json +on: + push: {} +jobs: + update-skill-json: + name: update_skill_json + permissions: + contents: write + uses: neongeckocom/.github/.github/workflows/skill_update_json_spec.yml@master +", + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/.github/workflows/pull-request-lint.yml +.DS_Store +node_modules +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +!/setup.py +!/version.py +!/.github/workflows/license_tests.yml +!/.github/workflows/propose_release.yml +!/.github/workflows/publish_alpha.yml +!/.github/workflows/publish_release.yml +!/.github/workflows/skill_tests.yml +!/.github/workflows/update_skill_json.yml +", + ".projen/files.json": Object { + "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\".", + "files": Array [ + ".gitattributes", + ".github/workflows/license_tests.yml", + ".github/workflows/propose_release.yml", + ".github/workflows/publish_alpha.yml", + ".github/workflows/publish_release.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/skill_tests.yml", + ".github/workflows/update_skill_json.yml", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "setup.py", + "version.py", + ], + }, + ".projen/tasks.json": Object { + "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\".", + "tasks": Object { + "build": Object { + "description": "Full release build", + "name": "build", + "steps": Array [ + Object { + "spawn": "default", + }, + Object { + "spawn": "pre-compile", + }, + Object { + "spawn": "compile", + }, + Object { + "spawn": "post-compile", + }, + Object { + "spawn": "test", + }, + Object { + "spawn": "package", + }, + ], + }, + "clobber": Object { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": Object { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": Array [ + Object { + "exec": "git checkout -b scratch", + "name": "save current HEAD in \\"scratch\\" branch", + }, + Object { + "exec": "git checkout $BRANCH", + }, + Object { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + Object { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + Object { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + Object { + "say": "ready to rock! (unpushed commits are under the \\"scratch\\" branch)", + }, + ], + }, + "compile": Object { + "description": "Only compile", + "name": "compile", + }, + "default": Object { + "description": "Synthesize project files", + "env": Object { + "FILENAME": ".projenrc.json", + }, + "name": "default", + "steps": Array [ + Object { + "builtin": "run-projenrc-json", + }, + ], + }, + "eject": Object { + "description": "Remove projen from the project", + "env": Object { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": Array [ + Object { + "spawn": "default", + }, + ], + }, + "package": Object { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": Object { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": Object { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": Object { + "description": "Run tests", + "name": "test", + }, + }, + }, + "README.md": "# replace this", + "requirements.txt": "ovos-utils +ovos-bus-client +ovos-workshop +ovos-plugin-manager +# Your requirements here + +", + "setup.py": "#!/usr/bin/env python3 +from setuptools import setup +from os import walk, path + +BASEDIR = path.abspath(path.dirname(__file__)) +URL = \\"TODO: Add 'repositoryUrl' to .projenrc.json and run pj\\" +SKILL_CLAZZ = \\"TestSkill\\" # needs to match __init__.py class name +PYPI_NAME = \\"test-skill\\" # pip install PYPI_NAME + +# below derived from github url to ensure standard skill_id +SKILL_AUTHOR, SKILL_NAME = URL.split(\\".com/\\")[-1].split(\\"/\\") +SKILL_PKG = SKILL_NAME.lower().replace(\\"-\\", \\"_\\") +PLUGIN_ENTRY_POINT = f\\"{SKILL_NAME.lower()}.{SKILL_AUTHOR.lower()}={SKILL_PKG}:{SKILL_CLAZZ}\\" +# skill_id=package_name:SkillClass +BASE_PATH = BASE_PATH = path.abspath(path.join(path.dirname(__file__), \\"\\")) + + +def get_version(): + \\"\\"\\"Find the version of the package\\"\\"\\" + version = None + version_file = path.join(BASE_PATH, \\"version.py\\") + major, minor, build, alpha = (None, None, None, None) + with open(version_file) as f: + for line in f: + if \\"VERSION_MAJOR\\" in line: + major = line.split(\\"=\\")[1].strip() + elif \\"VERSION_MINOR\\" in line: + minor = line.split(\\"=\\")[1].strip() + elif \\"VERSION_BUILD\\" in line: + build = line.split(\\"=\\")[1].strip() + elif \\"VERSION_ALPHA\\" in line: + alpha = line.split(\\"=\\")[1].strip() + + if (major and minor and build and alpha) or \\"# END_VERSION_BLOCK\\" in line: + break + version = f\\"{major}.{minor}.{build}\\" + if alpha and int(alpha) > 0: + version += f\\"a{alpha}\\" + return version + + +def get_requirements(requirements_filename: str): + requirements_file = path.join(path.dirname(__file__), requirements_filename) + with open(requirements_file, \\"r\\", encoding=\\"utf-8\\") as r: + requirements = r.readlines() + requirements = [r.strip() for r in requirements if r.strip() and not r.strip().startswith(\\"#\\")] + return requirements + + +def find_resource_files(): + resource_base_dirs = (\\"locale\\", \\"intents\\", \\"dialog\\", \\"vocab\\", \\"regex\\", \\"ui\\") + package_data = [\\"*.json\\"] + for res in resource_base_dirs: + if path.isdir(path.join(BASE_PATH, res)): + for directory, _, files in walk(path.join(BASE_PATH, res)): + if files: + package_data.append(path.join(directory.replace(BASE_PATH, \\"\\").lstrip(\\"/\\"), \\"*\\")) + return package_data + + +with open(\\"README.md\\", \\"r\\") as f: + long_description = f.read() + +setup( + name=PYPI_NAME, + version=get_version(), + description=\\"\\", + long_description=long_description, + long_description_content_type=\\"text/markdown\\", + url=URL, + author=\\"TODO: Add 'author' to .projenrc.json and run pj\\", + author_email=\\"TODO: Add 'authorAddress' to .projenrc.json and run pj\\", + license=\\"# TODO: Add 'license' to .projenrc.json and run pj\\", + package_dir={SKILL_PKG: \\"\\"}, + package_data={SKILL_PKG: find_resource_files()}, + packages=[SKILL_PKG], + include_package_data=True, + install_requires=get_requirements(\\"requirements.txt\\"), + keywords=\\"ovos skill voice assistant\\", + entry_points={\\"ovos.plugin.skill\\": PLUGIN_ENTRY_POINT}, +) +", + "skill.json": Object {}, + "version.py": "VERSION_MAJOR = 0 +VERSION_MINOR = 0 +VERSION_BUILD = 1 +VERSION_ALPHA = 0", +} +`; + exports[`snapshot retrofit 1`] = ` Object { ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.json and run \\"npx projen\\". @@ -1092,6 +2816,7 @@ cython_debug/ "requirements.txt": "ovos-utils ovos-bus-client ovos-workshop +ovos-plugin-manager # Your requirements here ", @@ -1609,6 +3334,7 @@ cython_debug/ "requirements.txt": "ovos-utils ovos-bus-client ovos-workshop +ovos-plugin-manager # Your requirements here akinator