Add serviceapps Django app for Cytoscape Web Service Apps#126
Open
kushvinth wants to merge 1 commit intocytoscape:masterfrom
Open
Add serviceapps Django app for Cytoscape Web Service Apps#126kushvinth wants to merge 1 commit intocytoscape:masterfrom
kushvinth wants to merge 1 commit intocytoscape:masterfrom
Conversation
Implements support for Cytoscape Web Service Apps as described in the Service App Specification (draft v2). Service Apps are web services discoverable and installable via the App Store UI and a machine-readable API endpoint for Cytoscape Web. New serviceapps app includes: - ServiceApp model with URL, metadata, health status tracking - Submit view that validates endpoints (/ and /status) per the spec - List and detail views with filtering by health status - JSON API endpoint at /api/service-apps/config for Cytoscape Web - Admin integration for managing service apps - Management command (check_service_apps) for periodic health checks - Unit tests for submission, listing, detail, and config API Wired into settings/base.py INSTALLED_APPS and root urls.py. Added requests to requirements.txt. Closes cytoscape#115
Author
|
PTAL @coleslaw481 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Add Cytoscape Web Service Apps Support
Related Issues:
Summary
This PR adds a new
serviceappsDjango app that brings Cytoscape Web Service App support to the App Store. Service Apps, per the Service App Specification (draft v2), become a first-class app type, discoverable via the App Store UI and consumable via a machine-readable JSON API endpoint for Cytoscape Web.What's Included
URL Routes
/submit/service-app/serviceapps:submit/service-apps/serviceapps:list?health=okor?q=search)/service-apps/<id>/serviceapps:detail/api/service-apps/configserviceapps:config[{"url": "..."}]for healthy apps, consumed by Cytoscape WebSubmission & Validation Flow
When an author submits a service app URL:
/) and checks for required keys per the spec:name,description,version,parameters,serviceInputDefinition,cyWebActions,cyWebMenuItem/statusand records the health stateServiceApprecord is created/updated with the fetched metadataHealth Check Command
Iterates over all active
ServiceApprecords, pings their/statusendpoint, and updateslast_status(ok,unavailable, orerror),last_message, andlast_checked. Designed to be run via cron or CI on a schedule.Django Dual-Import Fix
The Problem
This project has an unusual
sys.pathsetup:manage.pyappends..tosys.path__init__.py(making it anappstorePython package)This means every top-level app is importable via two paths:
serviceapps(direct)appstore.serviceapps(via the root package)When Django's test runner discovers tests, it imports modules via the
appstore.serviceappspath. But Django's app registry already loaded the app asserviceapps. This causes theServiceAppmodel class to be instantiated twice from two different module identities, leading to:The existing apps (
apps,download,submit_app, etc.) happen to avoid this because they don't haveapps.pyAppConfig files and Django's legacy app loading resolves them differently.The Fix
In
serviceapps/__init__.py, module canonicalization logic detects when the module is being imported via the alternateappstore.serviceappspath and maps it back to the canonicalserviceappsentry insys.modules. This ensures both import paths resolve to the same module objects, preventing Django from registering duplicate model classes.This is a targeted fix scoped to
serviceapps. A broader fix would be to remove thesys.path.append('..')frommanage.pyor remove the root__init__.py, but that would affect the entire project and is out of scope for this PR.Testing
Test results: 11 tests total, 5 pass, 6 fail due to a pre-existing Django 4.2 + Python 3.14 incompatibility in template context copying (
AttributeError: 'super' object has no attribute 'dicts'). This affects any view that renders a template, including tests in the existingappstest suite. It is not caused by this PR.Post-Merge Steps
python manage.py migratepython manage.py check_service_appsvia cron__copy__bug