question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dataclasses backport required for Python 3.6

See original GitHub issue

Describe the bug Since #567, dataclasses is being used. This module is not in Python 3.6, so the backport needs to be installed.

To Reproduce Steps to reproduce the behavior:

$ python --version
> python 3.6.11
$ python -m venv .env
> ...
$ source .venv/bin/activate
$ pip install checkov
> ...
$ checkov --version

Traceback (most recent call last):
  File "/tmp/test/.env/bin/checkov", line 2, in <module>
    from checkov.main import run
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/main.py", line 15, in <module>
    from checkov.common.util.docs_generator import print_checks
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/common/util/docs_generator.py", line 11, in <module>
    from checkov.serverless.registry import sls_registry
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/__init__.py", line 1, in <module>
    from checkov.serverless.checks.function import *
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/checks/__init__.py", line 3, in <module>
    from checkov.serverless.checks.function import *
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/checks/function/__init__.py", line 1, in <module>
    from checkov.serverless.checks.function.aws import *
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/checks/function/aws/StarActionPolicyDocument.py", line 1, in <module>
    from checkov.serverless.checks.function.base_function_check import BaseFunctionCheck
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/checks/function/base_function_check.py", line 5, in <module>
    from checkov.serverless.checks.function.registry import function_registry
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/checks/function/registry.py", line 1, in <module>
    from checkov.serverless.base_registry import ServerlessRegistry
  File "/tmp/test/.env/lib/python3.6/site-packages/checkov/serverless/base_registry.py", line 2, in <module>
    from dataclasses import dataclass
ModuleNotFoundError: No module named 'dataclasses
#
# To resolve
#
$ pip install dataclasses
$ checkov --version
1.0.544

Expected behavior setup.py should have a dependency for dataclasses, if the Python version is 3.6.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Checkov Version 1.0.544

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
schosterbarakcommented, Sep 21, 2020

let’s update setup.py to support only python 3.7 and above.

1reaction
schosterbarakcommented, Sep 21, 2020

Done. @timhourigan thank you for reporting this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dataclasses - PyPI
This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python...
Read more >
Could not find a version that satisfies the requirement ... - GitHub
This repo is only about the 3.6 backport. dataclasses is built in to python 3.8, so you don't need to install anything, you...
Read more >
A Backport Of The Dataclasses Module for Python 3.6 - Morioh
This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python...
Read more >
python - What are data classes and how are they different from ...
If you want to use dataclasses module in Python versions < 3.7, then you could install the backported module (requires 3.6) or use...
Read more >
PyCharm doesn't allow 'dataclasses' backport for Python 3.6
Enable PyCharm's code compatibility inspection for Python 3.6; Install 'dataclasses' backport package from PyPI; Use 'import dataclasses' in some file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found