diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..4b5111a --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,97 @@ +## This is a basic workflow to help you get started with Actions +# +#name: dev build CI +## Controls when the action will run. +#on: +# # Triggers the workflow on push or pull request events +# push: +# branches: +# - '*' +# pull_request: +# branches: +# - '*' +# # Allows you to run this workflow manually from the Actions tab +# workflow_dispatch: +# +## A workflow run is made up of one or more jobs that can run sequentially or in parallel +#jobs: +# # This workflow contains a single job called "build" +# test: +# # The type of runner that the job will run on +# strategy: +# matrix: +# python-versions: ['3.10'] +# os: [ubuntu-20.04] +# runs-on: ${{ matrix.os }} +# # map step outputs to job outputs so they can be share among jobs +# outputs: +# package_version: ${{ steps.variables_step.outputs.package_version }} +# package_name: ${{ steps.variables_step.outputs.package_name }} +# repo_name: ${{ steps.variables_step.outputs.repo_name }} +# repo_owner: ${{ steps.variables_step.outputs.repo_owner }} +# +# # Steps represent a sequence of tasks that will be executed as part of the job +# steps: +# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it +# - uses: actions/checkout@v2 +# - uses: actions/setup-python@v2 +# with: +# python-version: ${{ matrix.python-versions }} +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install poetry +# poetry install +# +# # declare package_version, repo_owner, repo_name, package_name so you may use it in web hooks. +# - name: Declare variables for convenient use +# id: variables_step +# run: | +# echo "::set-output name=repo_owner::${GITHUB_REPOSITORY%/*}" +# echo "::set-output name=repo_name::${GITHUB_REPOSITORY#*/}" +# echo "::set-output name=package_name::`poetry version | awk '{print $1}'`" +# echo "::set-output name=package_version::`poetry version --short`" +# shell: bash +# +# - name: test with tox +# run: pytest +# +# publish_dev_build: +# # if test failed, we should not publish +# needs: test +# # you may need to change os below +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - uses: actions/setup-python@v2 +# with: +# python-version: '3.9' +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install poetry +# +# - name: build documentation +# run: | +# poetry install -E doc +# poetry run mkdocs build +# git config --global user.name Docs deploy +# git config --global user.email docs@dummy.bot.com +# poetry run mike deploy -p -f --ignore "`poetry version --short`.dev" +# poetry run mike set-default -p "`poetry version --short`.dev" +# +# - name: Build wheels and source tarball +# run: | +# poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER +# poetry lock +# poetry build +# +# - name: publish to Test PyPI +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# user: __token__ +# password: ${{ secrets.TEST_PYPI_API_TOKEN}} +# repository_url: https://test.pypi.org/legacy/ +# skip_existing: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..48c85df --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,93 @@ +## Publish package on release branch if it's tagged with 'v*' +# +#name: build & release +# +## Controls when the action will run. +#on: +# # Triggers the workflow on push or pull request events but only for the master branch +# push: +# branch: [main, master] +# tags: +# - 'v*' +# +# # Allows you to run this workflow manually from the Actions tab +# workflow_dispatch: +# +## A workflow run is made up of one or more jobs that can run sequentially or in parallel +#jobs: +# release: +# runs-on: ubuntu-latest +# +# strategy: +# matrix: +# python-versions: ['3.10'] +# +# # map step outputs to job outputs so they can be share among jobs +# outputs: +# package_version: ${{ steps.variables_step.outputs.package_version }} +# package_name: ${{ steps.variables_step.outputs.package_name }} +# repo_name: ${{ steps.variables_step.outputs.repo_name }} +# repo_owner: ${{ steps.variables_step.outputs.repo_owner }} +# +# # Steps represent a sequence of tasks that will be executed as part of the job +# steps: +# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it +# - uses: actions/checkout@v2 +# +# - name: build change log +# id: build_changelog +# uses: mikepenz/release-changelog-builder-action@v3.2.0 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - uses: actions/setup-python@v2 +# with: +# python-version: ${{ matrix.python-versions }} +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install poetry +# +# # declare package_version, repo_owner, repo_name, package_name so you may use it in web hooks. +# - name: Declare variables for convenient use +# id: variables_step +# run: | +# echo "::set-output name=repo_owner::${GITHUB_REPOSITORY%/*}" +# echo "::set-output name=repo_name::${GITHUB_REPOSITORY#*/}" +# echo "::set-output name=package_name::`poetry version | awk '{print $1}'`" +# echo "::set-output name=package_version::`poetry version --short`" +# shell: bash +# +# - name: publish documentation +# run: | +# poetry install -E doc +# poetry run mkdocs build +# git config --global user.name Docs deploy +# git config --global user.email docs@dummy.bot.com +# poetry run mike deploy -p -f --ignore `poetry version --short` +# poetry run mike set-default -p `poetry version --short` +# +# - name: Build wheels and source tarball +# run: | +# poetry lock +# poetry build +# +# - name: Create Release +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ github.ref_name }} +# release_name: Release ${{ github.ref_name }} +# body: ${{ steps.build_changelog.outputs.changelog }} +# draft: false +# prerelease: false +# +# - name: publish to PYPI +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# user: __token__ +# password: ${{ secrets.PYPI_API_TOKEN }} +# skip_existing: true \ No newline at end of file diff --git a/pydfirram/core/base.py b/pydfirram/core/base.py index 8159011..65c10b1 100644 --- a/pydfirram/core/base.py +++ b/pydfirram/core/base.py @@ -270,7 +270,6 @@ def __init__(self, operating_system: OperatingSystem, dump_file: Path): self.tmp_plugin: PluginEntry = None logger.info(f"Generic OS initialized: {self.os}") - def __getattr__(self, key: str,**kwargs: Dict) -> Renderer : """ @@ -284,13 +283,14 @@ def __getattr__(self, key: str,**kwargs: Dict) -> Renderer : :type key: str :param args: Positional arguments for the method call. :param kwargs: Keyword arguments for the method call. - :return: A class of Renderer that is the result of a lambda function that executes the __run_commands method for the given key. + :return: A class of Renderer that is the result of a lambda + function that executes the __run_commands method for the given key. """ key = key.lower() try: plugin: PluginEntry = self.get_plugin(key) - except: - raise ValueError(f"Unable to handle {key}") + except Exception as exc: + raise ValueError(f"Unable to handle {key}") from exc def parse_data_function(**kwargs): return Renderer( data= self.run_plugin(plugin,**kwargs)