Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting issues introducd by #14 #17

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

rvodden
Copy link
Contributor

@rvodden rvodden commented Nov 8, 2023

No description provided.

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #17 (bb4fd50) into main (6daa3cd) will increase coverage by 0.16%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #17      +/-   ##
==========================================
+ Coverage   69.02%   69.18%   +0.16%     
==========================================
  Files          10       10              
  Lines         368      370       +2     
==========================================
+ Hits          254      256       +2     
  Misses        114      114              
Files Coverage Δ
src/maaspower/__main__.py 86.11% <100.00%> (ø)
src/maaspower/devices/shell_cmd.py 100.00% <100.00%> (ø)
src/maaspower/devices/smart_thing.py 56.41% <100.00%> (ø)
src/maaspower/devices/web_device.py 63.63% <100.00%> (+1.13%) ⬆️
src/maaspower/devices/web_ui.py 36.53% <100.00%> (ø)
src/maaspower/maasconfig.py 87.20% <100.00%> (+0.15%) ⬆️

@rvodden rvodden force-pushed the fix_linting branch 3 times, most recently from 4213597 to 15a50a9 Compare November 8, 2023 07:42
@rvodden
Copy link
Contributor Author

rvodden commented Nov 8, 2023

I've fixed the original linting issue (was a missing blank line). I'm seeing a few strange issues which appear to be caused by the ecosystem. Right now I'm bumping up against this issue:

psf/black#3447

Which appears to be because there isn't a version of black which works with 3.10 and 3.11. I'm reading around the issue now.

The python 3,12 issue is because of the removal of distutils from the standard library, which has been deprecated since 3.10. I'll look at that when I've resolved the issue with black.

@rvodden
Copy link
Contributor Author

rvodden commented Nov 8, 2023

Great- that's resolved everything except the 3.12 build. Am looking at that now.

@rvodden
Copy link
Contributor Author

rvodden commented Nov 8, 2023

I have at least managed to replicate it locally:

[rvodden:~/Source/maaspower]└2 [maaspower] fix_linting(+3/-1)+* 2s ± pipenv install --python 3.12 --dev --skip-lock
The flag --skip-lock has been reintroduced (but is not recommended).  Without the lock resolver it is difficult to manage multiple package indexes, and
hash checking is not provided.  However it can help manage installs with current deficiencies in locking across platforms.
Creating a virtualenv for this project...
Pipfile: /home/rvodden/Source/maaspower/Pipfile
Using /home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/bin/python3 (3.12.0) to create virtualenv...
⠼ Creating virtual environment...created virtual environment CPython3.12.0.final.0-64 in 353ms
  creator CPython3Posix(dest=/home/rvodden/.local/share/virtualenvs/maaspower-Z0oYyxSK, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/home/rvodden/.local/share/virtualenv)
    added seed packages: pip==23.3.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /home/rvodden/.local/share/virtualenvs/maaspower-Z0oYyxSK
Installing dependencies from Pipfile...
[pipenv.exceptions.InstallError]: Obtaining file:///home/rvodden/Source/maaspower (from -r /tmp/pipenv-hflwope7-requirements/pipenv-uo28p775-reqs.txt (line 1))
[pipenv.exceptions.InstallError]:   Installing build dependencies: started
[pipenv.exceptions.InstallError]:   Installing build dependencies: finished with status 'done'
[pipenv.exceptions.InstallError]:   Checking if build backend supports build_editable: started
[pipenv.exceptions.InstallError]:   Checking if build backend supports build_editable: finished with status 'done'
[pipenv.exceptions.InstallError]: ERROR: Exception:
[pipenv.exceptions.InstallError]: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
[pipenv.exceptions.InstallError]:     status = run_func(*args)
[pipenv.exceptions.InstallError]:              ^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/cli/req_command.py", line 245, in wrapper
[pipenv.exceptions.InstallError]:     return func(self, options, args)
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/commands/install.py", line 377, in run
[pipenv.exceptions.InstallError]:     requirement_set = resolver.resolve(
[pipenv.exceptions.InstallError]:                       ^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/resolver.py", line 76, in resolve
[pipenv.exceptions.InstallError]:     collected = self.factory.collect_root_requirements(root_reqs)
[pipenv.exceptions.InstallError]:                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/factory.py", line 513, in collect_root_requirements
[pipenv.exceptions.InstallError]:     reqs = list(
[pipenv.exceptions.InstallError]:            ^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/factory.py", line 474, in _make_requirements_from_install_req
[pipenv.exceptions.InstallError]:     cand = self._make_candidate_from_link(
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/factory.py", line 190, in _make_candidate_from_link
[pipenv.exceptions.InstallError]:     self._editable_candidate_cache[link] = EditableCandidate(
[pipenv.exceptions.InstallError]:                                            ^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py", line 322, in __init__
[pipenv.exceptions.InstallError]:     super().__init__(
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py", line 157, in __init__
[pipenv.exceptions.InstallError]:     self.dist = self._prepare()
[pipenv.exceptions.InstallError]:                 ^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py", line 226, in _prepare
[pipenv.exceptions.InstallError]:     dist = self._prepare_distribution()
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py", line 332, in _prepare_distribution
[pipenv.exceptions.InstallError]:     return self._factory.preparer.prepare_editable_requirement(self._ireq)
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/operations/prepare.py", line 696, in prepare_editable_requirement
[pipenv.exceptions.InstallError]:     dist = _get_prepared_distribution(
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/operations/prepare.py", line 71, in _get_prepared_distribution
[pipenv.exceptions.InstallError]:     abstract_dist.prepare_distribution_metadata(
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/distributions/sdist.py", line 52, in prepare_distribution_metadata
[pipenv.exceptions.InstallError]:     self.req.isolated_editable_sanity_check()
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/req/req_install.py", line 544, in isolated_editable_sanity_check
[pipenv.exceptions.InstallError]:     and not self.supports_pyproject_editable()
[pipenv.exceptions.InstallError]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_internal/req/req_install.py", line 247, in supports_pyproject_editable
[pipenv.exceptions.InstallError]:     return "build_editable" in self.pep517_backend._supported_features()
[pipenv.exceptions.InstallError]:                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_vendor/pyproject_hooks/_impl.py", line 153, in _supported_features
[pipenv.exceptions.InstallError]:     return self._call_hook('_supported_features', {})
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_vendor/pyproject_hooks/_impl.py", line 321, in _call_hook
[pipenv.exceptions.InstallError]:     raise BackendUnavailable(data.get('traceback', ''))
[pipenv.exceptions.InstallError]: pipenv.patched.pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/envs/maaspower/lib/python3.12/site-packages/pipenv/patched/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
[pipenv.exceptions.InstallError]:     obj = import_module(mod_path)
[pipenv.exceptions.InstallError]:           ^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "/home/rvodden/.pyenv/versions/3.12.0/lib/python3.12/importlib/__init__.py", line 90, in import_module
[pipenv.exceptions.InstallError]:     return _bootstrap._gcd_import(name[level:], package, level)
[pipenv.exceptions.InstallError]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap_external>", line 994, in exec_module
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
[pipenv.exceptions.InstallError]:   File "/tmp/pip-build-env-wdxmwq35/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>
[pipenv.exceptions.InstallError]:     import distutils.core
[pipenv.exceptions.InstallError]: ModuleNotFoundError: No module named 'distutils'
ERROR: Couldn't install package: {}

@rvodden rvodden force-pushed the fix_linting branch 2 times, most recently from 1ee5e82 to 4856ab3 Compare November 8, 2023 10:03
@rvodden
Copy link
Contributor Author

rvodden commented Nov 8, 2023

OK something odd is going on with pipenv and Python 3.12. I've raised this with pipenv: pypa/setuptools#3661 and temporarily removed 3.12 from the build matrix (our code works under 3.12, so I've not removed it from setup). I'll keep an eye on that bug and raise a new PR when its resolved.

@gilesknap over to you - comments, as always, more than welcome.

@rvodden
Copy link
Contributor Author

rvodden commented Nov 8, 2023

(as the 3.12 action is no longer running this will no longer succeed, so that check will always show as failed - you'll need to force merge it if you're happy

@gilesknap gilesknap merged commit d63b5b5 into gilesknap:main Nov 8, 2023
9 of 10 checks passed
@gilesknap
Copy link
Owner

Thanks @rvodden. Since creating this project the 'skeleton' framework it is based on has moved on from pipenv which is a bit dead now. We just use pip these days.

So I'll take an action to get this project updated to the latest skeleton framework. I'm really embedded in another project right now so will get to this in a few weeks.

@rvodden
Copy link
Contributor Author

rvodden commented Nov 9, 2023

Great stuff. I've got some ideas about future enhancements , and I've got a few engineers I can potentially enlist for a bit of help. How would you like to discuss these? If you don't have an existing pattern, I suggest that I open a GitHub discussion and we can noodle around on that ahead of opening issues?

@gilesknap
Copy link
Owner

Sure. Let's use this #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants