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

Remove web framework dependency from tools #17058

Merged

Conversation

davelopez
Copy link
Contributor

@davelopez davelopez commented Nov 21, 2023

Part of #17046

This tries to remove several imports of galaxy.web from galaxy.tools and galaxy.managers.
Most changes involve handling URL generation without directly importing galaxy.web.url_for.

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@davelopez davelopez added kind/refactoring cleanup or refactoring of existing code, no functional changes area/backend labels Nov 21, 2023
lib/galaxy/exceptions/utils.py Outdated Show resolved Hide resolved
lib/galaxy/exceptions/utils.py Outdated Show resolved Hide resolved
lib/galaxy/web/framework/decorators.py Outdated Show resolved Hide resolved
lib/galaxy/app.py Outdated Show resolved Hide resolved
@davelopez davelopez force-pushed the remove_web_dependency_from_tools branch 3 times, most recently from 3316d84 to d8dfeac Compare November 22, 2023 12:22
@nsoranzo
Copy link
Member

If you are not planning to create a new package for short_term_storage, can you please add a symlink:

cd packages/app/galaxy/
ln -s ../../../lib/galaxy/short_term_storage/

to fix the package tests?

@davelopez
Copy link
Contributor Author

I was actually planning to create a new package but with your help (just wrote to you on Matrix at the same time 😆) but I will add the symlink meanwhile 👍

@davelopez davelopez force-pushed the remove_web_dependency_from_tools branch from 5b455a0 to 518e6b8 Compare November 23, 2023 17:29
@davelopez davelopez force-pushed the remove_web_dependency_from_tools branch from 71e1eba to 192e890 Compare November 24, 2023 09:38
@davelopez davelopez marked this pull request as ready for review November 28, 2023 11:06
@github-actions github-actions bot added this to the 23.2 milestone Nov 28, 2023
@davelopez
Copy link
Contributor Author

I think I managed to remove all I could spot so opening for review. Is there some known Pythonic sorcery to check there are no more dependencies left?

@nsoranzo
Copy link
Member

I think I managed to remove all I could spot so opening for review. Is there some known Pythonic sorcery to check there are no more dependencies left?

Once/if we split out a tools&workflow package from app, package testing should find out...

lib/galaxy/app.py Outdated Show resolved Hide resolved
- Use `util.unicodify` in copy_view.mako for consistency with other usages of unicodify in the file.
- Move `to_unicode` to the only place it's used under tool/search/__init__.py
The ShortTermStorageManager is a manager and makes sense to have it live under galaxy.managers instead of galaxy.web.

It will also help reduce the dependency of the manager modules on web related stuff.
- And rename it to `api_error_to_dict` since it creates dictionary with and not a message string as the previous name might suggest.
davelopez and others added 15 commits November 30, 2023 17:01
The ShortTermStorageManager and related classes should live in their own package eventually and not within galaxy.web nor galaxy.managers as the short term storage microservices it's fairly independent and has way less dependencies than those other packages.
Temporarily include it in app until the STS goes into its own package.
Temporarily until we create its own package.
We need to use url_builder from the request context to be able to generate valid URLs.

Hopefully url_for_not_available will help identify any other possible use of url_for that does not fall back into url_builder.
Replace calls to web.url_for with compatible url_builder.
Replace calls to web.url_for with compatible url_builder.

Since there is no real API route for those (they live in client controllers) we need to pass the path prefix as name...
Both links `{host}/activate` and `{host}/user/activate` work but the latter seems more explicit about what are we trying to activate.

Co-authored-by: Nicola Soranzo <[email protected]>
Taking the server_starttime from app instead.
Mostly for consistency with other similar functions in the module.

Co-authored-by: Nicola Soranzo <[email protected]>
This should fix URL generation for collections by using the URL builder instead of the legacy url_for.
@davelopez davelopez force-pushed the remove_web_dependency_from_tools branch from 3671279 to 4eb22fe Compare November 30, 2023 16:01
This package is used by pulsar with still supports Python 3.7
@davelopez davelopez force-pushed the remove_web_dependency_from_tools branch from 8701ff7 to 1ef8e6a Compare December 1, 2023 10:35
@nsoranzo nsoranzo merged commit ddbcb39 into galaxyproject:dev Dec 1, 2023
49 checks passed
@davelopez davelopez deleted the remove_web_dependency_from_tools branch December 1, 2023 13:01
@davelopez davelopez modified the milestones: 23.2, 24.0 Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants