saltstack/salt-extension

Tons of python backtrace following the instructions

darkpixel opened this issue · 2 comments

At the end of running create-salt-extension it spits out a list of steps to get started:

  python3 -m venv .env --prompt 'salt-cait'
  source .env/bin/activate
  git init .
  python -m pip install -e .[dev,tests,docs]
  pre-commit install
  git add .
  git commit -a
The above command will fail because it's pinning the project dependencies.
Now run the following commands:
  git add .
  git commit -a -m 'Initial extension layout'

After running the final step, I get tons of errors and backtraces.

It looks to me like a lot of the dependencies are out-of-date:

$ git commit -a -m 'Initial extension layout'
Check for merge conflicts................................................Passed
Trim Trailing Whitespace.................................................Passed
Mixed line ending........................................................Passed
Fix End of Files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing docs/ref/modules/all.rst

Check for merge conflicts................................................Passed
Check python ast.........................................................Passed
Remove Python Import Header Comments.....................................Passed
Check CLI examples on execution modules..............(no files to check)Skipped
Check rST doc files exist for modules/states.............................Failed
- hook id: check-docs
- files were modified by this hook
Salt extensions docstrings auto-fixes....................................Passed
Rewrite the test suite...................................................Passed
Rewrite Code to be Py3.6+................................................Failed
- hook id: pyupgrade
- exit code: 1

Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/bin/pyupgrade", line 5, in <module>
    from pyupgrade._main import main
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_main.py", line 30, in <module>
    from pyupgrade._data import FUNCS
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 126, in <module>
    _import_plugins()
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 123, in _import_plugins
    __import__(name, fromlist=['_trash'])
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_plugins/pep584.py", line 5, in <module>
    from tokenize_rt import List
ImportError: cannot import name 'List' from 'tokenize_rt' (/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/tokenize_rt.py)
Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/bin/pyupgrade", line 5, in <module>
    from pyupgrade._main import main
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_main.py", line 30, in <module>
    from pyupgrade._data import FUNCS
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 126, in <module>
    _import_plugins()
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 123, in _import_plugins
    __import__(name, fromlist=['_trash'])
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_plugins/pep584.py", line 5, in <module>
    from tokenize_rt import List
ImportError: cannot import name 'List' from 'tokenize_rt' (/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/tokenize_rt.py)
Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/bin/pyupgrade", line 5, in <module>
    from pyupgrade._main import main
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_main.py", line 30, in <module>
    from pyupgrade._data import FUNCS
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 126, in <module>
    _import_plugins()
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 123, in _import_plugins
    __import__(name, fromlist=['_trash'])
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_plugins/pep584.py", line 5, in <module>
    from tokenize_rt import List
ImportError: cannot import name 'List' from 'tokenize_rt' (/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/tokenize_rt.py)
Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/bin/pyupgrade", line 5, in <module>
    from pyupgrade._main import main
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_main.py", line 30, in <module>
    from pyupgrade._data import FUNCS
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 126, in <module>
    _import_plugins()
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 123, in _import_plugins
    __import__(name, fromlist=['_trash'])
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_plugins/pep584.py", line 5, in <module>
    from tokenize_rt import List
ImportError: cannot import name 'List' from 'tokenize_rt' (/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/tokenize_rt.py)
Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/bin/pyupgrade", line 5, in <module>
    from pyupgrade._main import main
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_main.py", line 30, in <module>
    from pyupgrade._data import FUNCS
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 126, in <module>
    _import_plugins()
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 123, in _import_plugins
    __import__(name, fromlist=['_trash'])
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_plugins/pep584.py", line 5, in <module>
    from tokenize_rt import List
ImportError: cannot import name 'List' from 'tokenize_rt' (/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/tokenize_rt.py)
Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/bin/pyupgrade", line 5, in <module>
    from pyupgrade._main import main
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_main.py", line 30, in <module>
    from pyupgrade._data import FUNCS
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 126, in <module>
    _import_plugins()
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_data.py", line 123, in _import_plugins
    __import__(name, fromlist=['_trash'])
  File "/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/pyupgrade/_plugins/pep584.py", line 5, in <module>
    from tokenize_rt import List
ImportError: cannot import name 'List' from 'tokenize_rt' (/home/aaron/.cache/pre-commit/repo9_przqnz/py_env-python3/lib/python3.10/site-packages/tokenize_rt.py)

Reorder python imports...................................................Passed
black....................................................................Failed
- hook id: black
- exit code: 1

Traceback (most recent call last):
  File "/home/aaron/.cache/pre-commit/repojuq79ukt/py_env-python3/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/home/aaron/.cache/pre-commit/repojuq79ukt/py_env-python3/lib/python3.10/site-packages/black/__init__.py", line 1129, in patched_main
    patch_click()
  File "/home/aaron/.cache/pre-commit/repojuq79ukt/py_env-python3/lib/python3.10/site-packages/black/__init__.py", line 1115, in patch_click
    from click import _unicodefun  # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/home/aaron/.cache/pre-commit/repojuq79ukt/py_env-python3/lib/python3.10/site-packages/click/__init__.py)

blacken-docs.............................................................Passed
Run bandit against the code base.........................................Passed
Run bandit against the test suite........................................Passed
Lint Source Code.........................................................Failed
- hook id: nox
- exit code: 1

nox > Running session lint-code-pre-commit
nox > python -m pip install --progress-bar=off wheel
nox > python -m pip install .[dev,tests]
nox > pylint --rcfile=.pylintrc --disable=I noxfile.py src/saltext/salt_cait/__init__.py src/saltext/salt_cait/states/__init__.py setup.py
************* Module .pylintrc
.pylintrc:1:0: E0015: Unrecognized option found: profile, files-output, comment, bad-functions, function-name-hint, variable-name-hint, const-name-hint, attr-name-hint, argument-name-hint, class-attribute-name-hint, inlinevar-name-hint, class-name-hint, module-name-hint, method-name-hint, no-space-check, zope (unrecognized-option)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'I0012' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E8116' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E812' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'un-indexed-curly-braces-error' (unknown-option-value)
************* Module Command line or configuration file
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.pep8' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.strings' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.Exception' ?) instead.
************* Module noxfile
noxfile.py:47:35: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:62:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
noxfile.py:75:11: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:152:8: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:155:8: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:172:30: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:256:26: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:293:25: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
noxfile.py:307:12: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:328:19: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:329:19: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:406:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
noxfile.py:494:12: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:500:12: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)

------------------------------------------------------------------
Your code has been rated at 9.47/10 (previous run: 9.47/10, +0.00)

nox > Command pylint --rcfile=.pylintrc --disable=I noxfile.py src/saltext/salt_cait/__init__.py src/saltext/salt_cait/states/__init__.py setup.py failed with exit code 22
nox > Session lint-code-pre-commit failed.
nox > Running session lint-code-pre-commit
nox > python -m pip install --progress-bar=off wheel
nox > python -m pip install .[dev,tests]
nox > pylint --rcfile=.pylintrc --disable=I src/saltext/salt_cait/states/salt_cait_mod.py src/saltext/salt_cait/grains/__init__.py src/saltext/salt_cait/grains/salt_cait_mod.py
************* Module .pylintrc
.pylintrc:1:0: E0015: Unrecognized option found: profile, files-output, comment, bad-functions, function-name-hint, variable-name-hint, const-name-hint, attr-name-hint, argument-name-hint, class-attribute-name-hint, inlinevar-name-hint, class-name-hint, module-name-hint, method-name-hint, no-space-check, zope (unrecognized-option)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'I0012' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E8116' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E812' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'un-indexed-curly-braces-error' (unknown-option-value)
************* Module Command line or configuration file
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.pep8' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.strings' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.Exception' ?) instead.
************* Module salt_cait.states.salt_cait_mod
src/saltext/salt_cait/states/salt_cait_mod.py:29:25: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)

------------------------------------------------------------------
Your code has been rated at 9.47/10 (previous run: 9.47/10, +0.00)

nox > Command pylint --rcfile=.pylintrc --disable=I src/saltext/salt_cait/states/salt_cait_mod.py src/saltext/salt_cait/grains/__init__.py src/saltext/salt_cait/grains/salt_cait_mod.py failed with exit code 22
nox > Session lint-code-pre-commit failed.

Lint Tests...............................................................Failed
- hook id: nox
- exit code: 1

nox > Running session lint-tests-pre-commit
nox > python -m pip install --progress-bar=off wheel
nox > python -m pip install .[dev,tests]
nox > pylint --rcfile=.pylintrc --disable=I,redefined-outer-name,missing-function-docstring,no-member,missing-module-docstring tests/integration/grains/__init__.py tests/__init__.py tests/unit/__init__.py tests/conftest.py
************* Module .pylintrc
.pylintrc:1:0: E0015: Unrecognized option found: profile, files-output, comment, bad-functions, function-name-hint, variable-name-hint, const-name-hint, attr-name-hint, argument-name-hint, class-attribute-name-hint, inlinevar-name-hint, class-name-hint, module-name-hint, method-name-hint, no-space-check, zope (unrecognized-option)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'I0012' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E8116' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E812' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'un-indexed-curly-braces-error' (unknown-option-value)
************* Module Command line or configuration file
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.pep8' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.strings' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.Exception' ?) instead.

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

nox > Session lint-tests-pre-commit was successful.
nox > Running session lint-tests-pre-commit
nox > python -m pip install --progress-bar=off wheel
nox > python -m pip install .[dev,tests]
nox > pylint --rcfile=.pylintrc --disable=I,redefined-outer-name,missing-function-docstring,no-member,missing-module-docstring tests/unit/grains/test_salt_cait.py tests/unit/states/test_salt_cait.py tests/integration/__init__.py tests/integration/states/__init__.py
************* Module .pylintrc
.pylintrc:1:0: E0015: Unrecognized option found: profile, files-output, comment, bad-functions, function-name-hint, variable-name-hint, const-name-hint, attr-name-hint, argument-name-hint, class-attribute-name-hint, inlinevar-name-hint, class-name-hint, module-name-hint, method-name-hint, no-space-check, zope (unrecognized-option)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'I0012' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E8116' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E812' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'un-indexed-curly-braces-error' (unknown-option-value)
************* Module Command line or configuration file
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.pep8' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.strings' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.Exception' ?) instead.
************* Module tests.unit.states.test_salt_cait
tests/unit/states/test_salt_cait.py:3:0: E0401: Unable to import 'saltext.salt_cait.modules.salt_cait_mod' (import-error)
tests/unit/states/test_salt_cait.py:3:0: E0611: No name 'modules' in module 'saltext.salt_cait' (no-name-in-module)
tests/unit/states/test_salt_cait.py:29:19: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)

------------------------------------------------------------------
Your code has been rated at 3.89/10 (previous run: 3.89/10, +0.00)

nox > Command pylint --rcfile=.pylintrc --disable=I,redefined-outer-name,missing-function-docstring,no-member,missing-module-docstring tests/unit/grains/test_salt_cait.py tests/unit/states/test_salt_cait.py tests/integration/__init__.py tests/integration/states/__init__.py failed with exit code 22
nox > Session lint-tests-pre-commit failed.
nox > Running session lint-tests-pre-commit
nox > python -m pip install --progress-bar=off wheel
nox > python -m pip install .[dev,tests]
nox > pylint --rcfile=.pylintrc --disable=I,redefined-outer-name,missing-function-docstring,no-member,missing-module-docstring tests/integration/conftest.py tests/unit/grains/__init__.py tests/unit/states/__init__.py
************* Module .pylintrc
.pylintrc:1:0: E0015: Unrecognized option found: profile, files-output, comment, bad-functions, function-name-hint, variable-name-hint, const-name-hint, attr-name-hint, argument-name-hint, class-attribute-name-hint, inlinevar-name-hint, class-name-hint, module-name-hint, method-name-hint, no-space-check, zope (unrecognized-option)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'I0012' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E8116' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'E812' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'un-indexed-curly-braces-error' (unknown-option-value)
************* Module Command line or configuration file
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.pep8' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
Command line or configuration file:1:0: E0013: Plugin 'saltpylint.strings' is impossible to load, is it installed ? ('No module named 'six'') (bad-plugin-value)
pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.Exception' ?) instead.

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

nox > Session lint-tests-pre-commit was successful.

Py3.6 Test Requirements..............................(no files to check)Skipped
Py3.7 Test Requirements..............................(no files to check)Skipped
Py3.8 Test Requirements..............................(no files to check)Skipped
Py3.9 Test Requirements..............................(no files to check)Skipped
Py3.6 Lint Requirements..............................(no files to check)Skipped
Py3.7 Lint Requirements..............................(no files to check)Skipped
Py3.8 Lint Requirements..............................(no files to check)Skipped
Py3.9 Lint Requirements..............................(no files to check)Skipped
Py3.6 Docs Requirements..............................(no files to check)Skipped
Py3.7 Docs Requirements..............................(no files to check)Skipped
Py3.8 Docs Requirements..............................(no files to check)Skipped
Py3.9 Docs Requirements..............................(no files to check)Skipped
$

A lot of the issues can be solved by editing .pre-commit-config.yaml and upgrading:

  • pyupgrade to version 3.9.0
  • black to version 23.7.0

I had to remove a ton of junk from the .pylintrc file because it kept complaining of 'bad options' including zope, no-space-checking, method-name-hint, module-name-hint, and so on...

There's still some bizarre issue where a file is created under ./src with the group and owner set to 'root' and/or a file being missing that causes things to fail:

There's still an issue with a file being created as the root user under the build folder that prevents compilation:

      running install_egg_info
      Copying src/saltext.salt_cait.egg-info to build/bdist.linux-x86_64/wheel/saltext.salt_cait-0.1.dev0+d20230726-py3.10.egg-info
      error: [Errno 13] Permission denied
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for saltext.salt-cait
Failed to build saltext.salt-cait

I can't get a clean build as I'm constantly getting errors about "permission denied" under the build/ directory.

ls -lha build/bdist.linux-x86_64/
total 87K
drwxrwxrwx 3 aaron aaron 3 Jul 26 13:00 .
drwxrwxrwx 4 aaron aaron 4 Jul 26 12:57 ..
d-w------- 3 aaron aaron 3 Jul 26 13:00 wheel

Not sure why the wheel folder is being created with no read or execute permissions.

sudo chmod -R 777 build/ and/or rm -rf build/* doesn't seem to help things.

On top of that, pylint complains (and apparently fails the commit) over a bunch of issues in noxfile.py:

noxfile.py:47:35: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:62:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
noxfile.py:75:11: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:293:25: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
noxfile.py:307:12: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:406:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
noxfile.py:494:12: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
noxfile.py:500:12: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
lkubb commented

Edit3: The following worked with current master:

  • use pipx install git+https://github.com/saltstack/salt-extension, not pipx install salt-extension (last release is from 2021)
  • create your extension
  • when installing deps, notice that there are no requirement files, either create them or roll back 1807e70#diff-9b465c073cd4beda25001772a1c69cdb018c6206a24a43dd348a12a1612235d9 (ensure you use pytest-salt-factories>=1.0.0rc21 though)
  • when running tests, notice that TypeError: FactoriesManager.__init__() got an unexpected keyword argument 'inject_coverage', just remove the line in tests/conftest.py
  • ensure that you run export SKIP_REQUIREMENTS_INSTALL=1 before trying to commit, otherwise you get a lot of permission denied/file exists errors during setup of lint steps
  • when pre-commit is running, notice that pylint complains about __salt__ etc. not being defined. fix by including additional-builtins=__context__,__grains__,__salt__,__pillar__,__opts__,__states__ in .pylintrc (or whichever dunders you require)
  • enjoy the experience of working tests and your initial commit

Edit2: This seems to be mostly fixed in master, but the latest release is from 2021. Installing via pipx install git+https://github.com/saltstack/salt-extension will probably fix most of the issues below, testing this now.

I could make this work by applying the following changes after initialization:

Outdated `.pre-commit-config.yml`: - change `pyupgrade` version to `v2.37.2` (Salt uses the same) - change `black` version to `22.6.0` (Salt uses the same) - comment out the `lint-src` definition (done in the ~~official~~ outsourced zabbix extension as well) - add the following to `lint-tests` definition (taken from Salt):
           - -e
           - lint-tests-pre-commit
           - --
+        additional_dependencies:
+          - setuptools<58.0
+          - pip>=20.2.4,<21.2

setup.cfg:

  • options.extras_require.dev pin pylint==2.4.4 and SaltPyLint>=v2020.9.28 (taken from Salt, the latter should be redundant)

.pylintrc:

  • add invalid-name to disabled, otherwise pylint complains about pytestmark not being a valid constant name in the integration tests (done in Salt as well):
@@ -64,7 +64,8 @@
   E812,
   wrong-import-position,
   wrong-import-order,
-  un-indexed-curly-braces-error
+  un-indexed-curly-braces-error,
+  invalid-name
 
 # Disabled:
 # R* [refactoring suggestions & reports]

Note this might be suboptimal, but I can at least perform the initial commit without --no-verify.

Edit:
Running python -m nox -e tests-3 also does not work out of the box, as described in #15. To get this running, I had to:

setup.cfg:

  • unindent everything in options.extras-require by one level because of unexpected value continuation
  • change pytest-salt-factories==0.906.0 to pytest-salt-factories>=1.0.0rc21 as per #15 (comment)

tests/conftest.py:

--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -12,7 +12,6 @@ def salt_factories_config():
     """
     return {
         "code_dir": str(PACKAGE_ROOT),
-        "inject_coverage": "COVERAGE_PROCESS_START" in os.environ,
         "inject_sitecustomize": "COVERAGE_PROCESS_START" in os.environ,
         "start_timeout": 120 if os.environ.get("CI") else 60,
     }
@@ -20,9 +19,9 @@ def salt_factories_config():

 @pytest.fixture(scope="package")
 def master(salt_factories):
-    return salt_factories.get_salt_master_daemon(random_string("master-"))
+    return salt_factories.salt_master_daemon(random_string("master-"))


 @pytest.fixture(scope="package")
 def minion(master):
-    return master.get_salt_minion_daemon(random_string("minion-"))
+    return master.salt_minion_daemon(random_string("minion-"))

tests/integration/conftest.py:

--- a/tests/integration/conftest.py
+++ b/tests/integration/conftest.py
@@ -15,14 +15,14 @@ def minion(minion):

 @pytest.fixture
 def salt_run_cli(master):
-    return master.get_salt_run_cli()
+    return master.salt_run_cli()


 @pytest.fixture
 def salt_cli(master):
-    return master.get_salt_cli()
+    return master.salt_cli()


 @pytest.fixture
 def salt_call_cli(minion):
-    return minion.get_salt_call_cli()
+    return minion.salt_call_cli()

Salt Project / VMware has ended active development of this project, this repository will no longer be updated.

The community has created and maintained a better alternative to the development of Salt extensions: salt-extensions/salt-extension-copier (Create and maintain Salt extensions using Copier)