Skip to content

Drop python-six dependency#637

Merged
ppisar merged 3 commits intofedora-modularity:mainfrom
bluca:six
Apr 1, 2026
Merged

Drop python-six dependency#637
ppisar merged 3 commits intofedora-modularity:mainfrom
bluca:six

Conversation

@bluca
Copy link
Copy Markdown
Contributor

@bluca bluca commented Apr 1, 2026

In Ubuntu and Debian we no longer ship Python 2.7, so the translation module is an unnecessary dependency. In Python 3 the text type is always 'str', so it is not needed. Simply set the value to 'unicode' on Python2, and 'str' on Python3.

@ppisar ppisar self-assigned this Apr 1, 2026
@ppisar
Copy link
Copy Markdown
Collaborator

ppisar commented Apr 1, 2026

The enhancement is a good direction, but I worry it makes the only important case -- when using Python2 without six module installed difficult to debug: In that case it won't report an import failure. Instead it will assign str to the variable and happily continue. That means the code will behave differently.

I'd like rather see and error on Python2 without six module. That means adding a condition on Python major version. In in that case it's probably simpler to set the variable to str or unicode directly then importing the six module. Could rework the patch like that?

Also fedora/libmodulemd.spec for RPM packages still carry the dependency on the six module. That should also be adjusted.

bluca added 2 commits April 1, 2026 14:36
In Ubuntu and Debian we no longer ship Python 2.7, so the translation
module is an unnecessary dependency. In Python 3 the text type is always
'str', so it is not needed.
Simply set the value to 'unicode' on Python2, and 'str' on Python3.
@bluca
Copy link
Copy Markdown
Contributor Author

bluca commented Apr 1, 2026

The enhancement is a good direction, but I worry it makes the only important case -- when using Python2 without six module installed difficult to debug: In that case it won't report an import failure. Instead it will assign str to the variable and happily continue. That means the code will behave differently.

I'd like rather see and error on Python2 without six module. That means adding a condition on Python major version. In in that case it's probably simpler to set the variable to str or unicode directly then importing the six module. Could rework the patch like that?

Also fedora/libmodulemd.spec for RPM packages still carry the dependency on the six module. That should also be adjusted.

Sure, done

@bluca bluca changed the title Make python-six an optional dependency Drop python-six dependency Apr 1, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

@ppisar ppisar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks for the cooperation.

@ppisar ppisar merged commit e511770 into fedora-modularity:main Apr 1, 2026
24 of 25 checks passed
@bluca bluca deleted the six branch April 1, 2026 14:11
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