Skip to content

Conversation

@yukihiko-shinoda
Copy link

In Python 2.7, Radon doesn't work

The pytests reported two errors:

radon/cli/harvest.py:6: in <module>
    from builtins import super
E   ImportError: No module named builtins
radon/cli/__init__.py:85: in file_config
    config.read_dict(FileConfig.toml_config())
E   AttributeError: ConfigParser instance has no attribute 'read_dict'

Is supporting Python 2 really required instead of sustainability?

We still need Radon that have important roles for maintenancing Python project.

Supporting legacy version holds maintainability back since:

  • That prevents to rewrite codes more simple and efficient by new grammer, especially lacking type hinting and out of Ruff supporting Python version range make contributers difficult to maintain
  • That requires to maintain development and testing environment by ourselves and almost dependency tools are no longer supplied in official package manager for each Linux distribution

I hope next version will be the last version of supporting legacy Python versions.

Summary of this pull request written by Copilot

This pull request primarily addresses compatibility and configuration handling improvements in the CLI codebase. The most significant changes include making the import of super compatible across Python versions and updating how configuration dictionaries are merged.

Python compatibility improvements:

  • Updated the import of super in radon/cli/harvest.py to handle both Python 2 and Python 3 environments, ensuring broader compatibility.

Configuration handling:

  • Changed the way configuration from FileConfig.toml_config() is merged into the main config object in radon/cli/__init__.py by assigning each key-value pair directly, improving clarity and possibly preventing issues with read_dict.

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.

1 participant