Skip to content

Remove all pkg_resources usage - #108

Open
SuperSandro2000 wants to merge 1 commit into
pasteorg:masterfrom
SuperSandro2000:remove-pkg_resources-usage
Open

Remove all pkg_resources usage#108
SuperSandro2000 wants to merge 1 commit into
pasteorg:masterfrom
SuperSandro2000:remove-pkg_resources-usage

Conversation

@SuperSandro2000

Copy link
Copy Markdown

Tested this with mediagoblin tests as part of NixOS/nixpkgs#538703

@dotlambda

Copy link
Copy Markdown

@gforcada Would you mind taking a look at this? It should replace #105.

@gforcada gforcada left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice job! Much better than mine!

I left two comments, take them with a grain of salt, I'm no expert on the field despite having converted +50 packages to native namespace, it was mostly a mechanical work 🙃

Comment thread paste/__init__.py
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

According to the packaging guide this namespace style is also obsolete: https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#legacy-namespace-packages

The broader question here would be: are there other paste python distributions that share the namespace and thus should be migrated together?

As a temporal solution maybe https://pypi.org/project/horse-with-no-namespace/ works to patch the problem, though it mentions pkg_resources style namespaces not pkgutil namespaces

Comment thread setup.py
packages=find_packages(exclude=['ez_setup', 'examples', 'packages', 'tests*']),
package_data=finddata.find_package_data(
exclude_directories=finddata.standard_exclude_directories + ('tests',)),
namespace_packages=['paste'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not 100% sure if we need some guiding to setuptools to discover the code as we are not using a src layout model here, according to https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#native-namespace-packages the src layout allows automatic discovery of namespaces, while the flatten does not... but I guess you have tried it and CI is green, so 🤷🏾

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.

3 participants