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

App namespace resolution #1789 #1801

Merged
merged 14 commits into from
Apr 2, 2024

Conversation

khiron
Copy link
Collaborator

@khiron khiron commented Apr 1, 2024

Added the ability to dynamically create and register apps for the purpose of testing name space collisions

Added the ability to mock up the stevedore.extension.ExtensionManager so we can directly put extensions in without having to change the virtual environment's site-packages

Added tests for namespace collision

@khiron khiron requested a review from GavinHuttley April 1, 2024 20:58
@khiron khiron marked this pull request as draft April 1, 2024 21:18
@khiron
Copy link
Collaborator Author

khiron commented Apr 1, 2024

pkg_resources has been deprecated for Python 3.12

Unfortunately I am using it to verify when a new package I have pip installed appears to the environment. Working on an alternative strategy for dynamically loading packages. For now I'll back out the dynamic installation code as it's not needed to test namespace collision as we can use a mocked ExtensionManager

@khiron
Copy link
Collaborator Author

khiron commented Apr 1, 2024

pkg_resources can be mostly replaced with import_lib with the exception of rebuilding the working set.

import_lib.invalidate.caches() does some of what rebuilding the working set does, but it's not guaranteed to see a change to the environment. Stevedore apparently switched to import_lib.metadata recently which results in the stevedore cache not being updated immediately a new package is installed. The recommended approach is to restart the python interpreter which is not feasible in the context of cogent3 acquiring the latest packages.

For now invalidate_caches will be sufficient for at least one test. Which is sufficient.

@khiron khiron marked this pull request as ready for review April 1, 2024 22:27
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 8514459137

Details

  • 23 of 29 (79.31%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.009%) to 91.605%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/cogent3/app/init.py 23 29 79.31%
Files with Coverage Reduction New Missed Lines %
src/cogent3/app/init.py 2 92.65%
Totals Coverage Status
Change from base Build 8513554612: -0.009%
Covered Lines: 29636
Relevant Lines: 32352

💛 - Coveralls

@khiron khiron merged commit 5fb5df3 into cogent3:plugin-support Apr 2, 2024
15 of 17 checks passed
@khiron khiron deleted the app-namespace-resolution--#1789 branch April 2, 2024 02: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.

None yet

2 participants