graphcore-kernel 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graphcore_kernel-0.1.0/LICENSE +202 -0
- graphcore_kernel-0.1.0/NOTICE +2 -0
- graphcore_kernel-0.1.0/PKG-INFO +94 -0
- graphcore_kernel-0.1.0/README.md +60 -0
- graphcore_kernel-0.1.0/graphcore/__init__.py +5 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/__init__.py +8 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/api.py +69 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/base/__init__.py +11 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/base/views.py +167 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/client.py +31 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/context.py +157 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/errors.py +12 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/loading.py +54 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/registry.py +42 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/render.py +207 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/server.py +103 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/signatures.py +35 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/testing.py +45 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/tests/fakes.py +114 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/tests/test_frontend.py +447 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/tests/test_loading.py +83 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/tests/test_server.py +109 -0
- graphcore_kernel-0.1.0/graphcore/agent_frontend/tools.py +137 -0
- graphcore_kernel-0.1.0/graphcore/api/__init__.py +4 -0
- graphcore_kernel-0.1.0/graphcore/api/graph_api.py +378 -0
- graphcore_kernel-0.1.0/graphcore/api/predicate_codec.py +81 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/test_changed_entities.py +109 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/test_graph_api.py +290 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/test_graph_api_access.py +94 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/test_graph_api_grants.py +90 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/test_predicate_codec.py +83 -0
- graphcore_kernel-0.1.0/graphcore/api/tests/test_subtree_query.py +79 -0
- graphcore_kernel-0.1.0/graphcore/apps.py +71 -0
- graphcore_kernel-0.1.0/graphcore/auth/__init__.py +1 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/README.md +178 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/__init__.py +3 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/authenticator.py +120 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/onboarding.py +105 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/principals.py +20 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/resource_metadata.py +43 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/service_accounts.py +96 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/testing.py +96 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/tests/test_authenticator.py +145 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/tests/test_onboarding.py +145 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/tests/test_service_accounts.py +180 -0
- graphcore_kernel-0.1.0/graphcore/auth/authn/users.py +59 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/access_port.py +120 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/default_access_adapter.py +556 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/tests/test_default_adapter.py +543 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/tests/test_entity_write_hooks.py +207 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/tests/test_group_types.py +70 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/adapter/tests/test_sync_support.py +209 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/defaults.py +26 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/kernel_policy.py +191 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/kernel_writes.py +31 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/lookups.py +25 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/policy.py +403 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_can_contain.py +150 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_contained_by.py +167 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_creation.py +391 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_delete_permission.py +82 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_granted_to_me.py +160 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_integration.py +637 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_invites.py +184 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_kernel_policy.py +140 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_lockout.py +132 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_policy.py +329 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_primitives.py +73 -0
- graphcore_kernel-0.1.0/graphcore/auth/authz/tests/test_principal_creation.py +62 -0
- graphcore_kernel-0.1.0/graphcore/bootstrap/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/bootstrap/deployment.py +67 -0
- graphcore_kernel-0.1.0/graphcore/bootstrap/signals.py +16 -0
- graphcore_kernel-0.1.0/graphcore/bootstrap/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/bootstrap/tests/test_deployment_seed.py +154 -0
- graphcore_kernel-0.1.0/graphcore/broadcast/__init__.py +4 -0
- graphcore_kernel-0.1.0/graphcore/broadcast/broadcaster.py +201 -0
- graphcore_kernel-0.1.0/graphcore/broadcast/channels.py +56 -0
- graphcore_kernel-0.1.0/graphcore/broadcast/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/broadcast/tests/test_broadcaster.py +444 -0
- graphcore_kernel-0.1.0/graphcore/celery.py +14 -0
- graphcore_kernel-0.1.0/graphcore/docs/AGENT_FRONTEND_TDD.md +389 -0
- graphcore_kernel-0.1.0/graphcore/docs/ARCHITECTURE_PRINCIPLES.md +152 -0
- graphcore_kernel-0.1.0/graphcore/docs/AUTHORIZATION_TECHNICAL_TDD.md +1379 -0
- graphcore_kernel-0.1.0/graphcore/docs/ENTITY_REFERENCE_TDD.md +561 -0
- graphcore_kernel-0.1.0/graphcore/docs/GRAPHAPI_FRONT_DOOR.md +173 -0
- graphcore_kernel-0.1.0/graphcore/docs/RUNTIME.md +90 -0
- graphcore_kernel-0.1.0/graphcore/docs/SCHEDULING_TDD.md +244 -0
- graphcore_kernel-0.1.0/graphcore/docs/STRATEGY_EXECUTION_TDD.md +1043 -0
- graphcore_kernel-0.1.0/graphcore/docs/VIEW_ENTITY_TDD.md +522 -0
- graphcore_kernel-0.1.0/graphcore/docs/VIEW_SYSTEM_TDD.md +307 -0
- graphcore_kernel-0.1.0/graphcore/docs/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/docs/doc_topics.py +97 -0
- graphcore_kernel-0.1.0/graphcore/docs/docs_discovery.py +64 -0
- graphcore_kernel-0.1.0/graphcore/docs/public_api.py +56 -0
- graphcore_kernel-0.1.0/graphcore/domain/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/Entity.py +204 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/deployment/Deployment.py +25 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/deployment/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/grant/Grant.py +31 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/grant/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/group/Group.py +48 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/group/README.md +88 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/group/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/invite/Invite.py +31 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/invite/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/request_template/RequestTemplate.py +48 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/request_template/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/request_template/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/request_template/tests/test_request_template.py +52 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/service_account/ServiceAccount.py +41 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/service_account/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/strategy_request/StrategyRequest.py +61 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/strategy_request/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/strategy_request/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/strategy_request/tests/test_strategy_request_entity.py +35 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/tests/test_entity.py +227 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/tests/test_grant_group_entities.py +36 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/tests/test_write_once_fields.py +98 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/user/User.py +39 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/user/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/user/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/user/tests/test_user_entity.py +33 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/view/View.py +37 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/view/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/view/position.py +78 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/view/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/view/tests/test_position.py +71 -0
- graphcore_kernel-0.1.0/graphcore/domain/entity/view/tests/test_view_entity.py +134 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/BaseStrategy.py +759 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/DeploymentStrategies.py +55 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/GrantStrategies.py +189 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/GroupStrategies.py +193 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/InviteStrategies.py +84 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/RequestTemplateStrategies.py +126 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/ViewStrategies.py +219 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/runner.py +84 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/session.py +56 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/BaseStrategyTest.py +167 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_BaseStrategies.py +870 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_grant_strategies.py +245 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_group_strategies.py +99 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_runner.py +220 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_strategy_locks.py +446 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_utils.py +95 -0
- graphcore_kernel-0.1.0/graphcore/domain/strategy/tests/test_view_strategies.py +436 -0
- graphcore_kernel-0.1.0/graphcore/errors.py +145 -0
- graphcore_kernel-0.1.0/graphcore/execution/README.md +97 -0
- graphcore_kernel-0.1.0/graphcore/execution/StrategyExecutorService.py +333 -0
- graphcore_kernel-0.1.0/graphcore/execution/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/execution/dispatcher.py +19 -0
- graphcore_kernel-0.1.0/graphcore/execution/environments/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/execution/environments/celery.py +59 -0
- graphcore_kernel-0.1.0/graphcore/execution/environments/in_process.py +55 -0
- graphcore_kernel-0.1.0/graphcore/execution/local_session.py +117 -0
- graphcore_kernel-0.1.0/graphcore/execution/redis_run_events.py +74 -0
- graphcore_kernel-0.1.0/graphcore/execution/requests.py +22 -0
- graphcore_kernel-0.1.0/graphcore/execution/run_events.py +85 -0
- graphcore_kernel-0.1.0/graphcore/execution/strategy_context.py +54 -0
- graphcore_kernel-0.1.0/graphcore/execution/tasks.py +34 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/__init__.py +5 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/contract.py +171 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/support.py +310 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/test_dispatchers.py +76 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/test_executor.py +368 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/test_local_session.py +95 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/test_reconcile_runs.py +134 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/test_run_events.py +106 -0
- graphcore_kernel-0.1.0/graphcore/execution/tests/test_strategy_context.py +62 -0
- graphcore_kernel-0.1.0/graphcore/gateway/__init__.py +1 -0
- graphcore_kernel-0.1.0/graphcore/gateway/remote.py +35 -0
- graphcore_kernel-0.1.0/graphcore/gateway/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/gateway/tests/test_remote.py +30 -0
- graphcore_kernel-0.1.0/graphcore/graph/EntityService.py +710 -0
- graphcore_kernel-0.1.0/graphcore/graph/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/graph/entity_cache.py +152 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/__init__.py +4 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_EntityService.py +908 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_EntityService_list.py +170 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_EntityService_model_resolution.py +339 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_EntityService_referrers.py +236 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_EntityService_routing.py +119 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_dependent_on.py +141 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_engine_is_type_agnostic.py +25 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_engine_resolves_read_permission.py +93 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_entity_cache.py +159 -0
- graphcore_kernel-0.1.0/graphcore/graph/tests/test_null_entity_cache.py +12 -0
- graphcore_kernel-0.1.0/graphcore/management/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/management/commands/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/management/commands/dev_reset.py +18 -0
- graphcore_kernel-0.1.0/graphcore/management/commands/graphcore_createadmin.py +65 -0
- graphcore_kernel-0.1.0/graphcore/management/commands/graphcore_policy.py +59 -0
- graphcore_kernel-0.1.0/graphcore/management/commands/graphcore_status.py +98 -0
- graphcore_kernel-0.1.0/graphcore/management/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/management/tests/test_createadmin.py +78 -0
- graphcore_kernel-0.1.0/graphcore/management/tests/test_policy_command.py +46 -0
- graphcore_kernel-0.1.0/graphcore/management/tests/test_status_command.py +85 -0
- graphcore_kernel-0.1.0/graphcore/migrations/0001_initial.py +186 -0
- graphcore_kernel-0.1.0/graphcore/migrations/0002_invite.py +26 -0
- graphcore_kernel-0.1.0/graphcore/migrations/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/models.py +11 -0
- graphcore_kernel-0.1.0/graphcore/persistence/ENTITY_REPOSITORY_TECHNICAL_TDD.md +396 -0
- graphcore_kernel-0.1.0/graphcore/persistence/__init__.py +6 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/backends.py +43 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/bindings.py +28 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/cache.py +38 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/compiler.py +214 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/identity.py +18 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/models.py +252 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/repository.py +525 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/test_backends.py +68 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/test_compiler.py +269 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/test_repository.py +472 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/test_shared_column.py +120 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/test_threads.py +50 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/tests/test_update_shape.py +175 -0
- graphcore_kernel-0.1.0/graphcore/persistence/django/threads.py +38 -0
- graphcore_kernel-0.1.0/graphcore/persistence/repository.py +172 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/contract.py +688 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/evaluate.py +51 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/fixtures.py +32 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/memory.py +263 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/test_memory_repository.py +10 -0
- graphcore_kernel-0.1.0/graphcore/persistence/tests/test_query_types.py +127 -0
- graphcore_kernel-0.1.0/graphcore/public/__init__.py +9 -0
- graphcore_kernel-0.1.0/graphcore/public/api.py +9 -0
- graphcore_kernel-0.1.0/graphcore/public/apps.py +10 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/__init__.py +1 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/grants.py +7 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/onboarding.py +8 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/perms.py +7 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/policy.py +10 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/roles.py +8 -0
- graphcore_kernel-0.1.0/graphcore/public/auth/subjects.py +7 -0
- graphcore_kernel-0.1.0/graphcore/public/entities/__init__.py +32 -0
- graphcore_kernel-0.1.0/graphcore/public/errors.py +19 -0
- graphcore_kernel-0.1.0/graphcore/public/persistence/__init__.py +44 -0
- graphcore_kernel-0.1.0/graphcore/public/persistence/django.py +24 -0
- graphcore_kernel-0.1.0/graphcore/public/scheduling.py +23 -0
- graphcore_kernel-0.1.0/graphcore/public/strategies/__init__.py +85 -0
- graphcore_kernel-0.1.0/graphcore/public/test_settings.py +16 -0
- graphcore_kernel-0.1.0/graphcore/public/testing.py +47 -0
- graphcore_kernel-0.1.0/graphcore/registry/EntityDirectory.py +246 -0
- graphcore_kernel-0.1.0/graphcore/registry/README.md +147 -0
- graphcore_kernel-0.1.0/graphcore/registry/StrategyDirectory.py +308 -0
- graphcore_kernel-0.1.0/graphcore/registry/TYPE_METADATA_PLACEMENT.md +66 -0
- graphcore_kernel-0.1.0/graphcore/registry/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/registry/app_discovery.py +108 -0
- graphcore_kernel-0.1.0/graphcore/registry/decorators.py +77 -0
- graphcore_kernel-0.1.0/graphcore/registry/discovery.py +111 -0
- graphcore_kernel-0.1.0/graphcore/registry/registry.py +79 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_agent_frontend_discovery.py +56 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_app_config.py +36 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_discovery.py +147 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_entity_directory_storage.py +73 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_import_package.py +87 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_principal_flag.py +67 -0
- graphcore_kernel-0.1.0/graphcore/registry/tests/test_strategy_directory.py +29 -0
- graphcore_kernel-0.1.0/graphcore/routes/__init__.py +116 -0
- graphcore_kernel-0.1.0/graphcore/routes/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/routes/tests/test_routes.py +90 -0
- graphcore_kernel-0.1.0/graphcore/runtime.py +243 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/beat_scheduler.py +164 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/beat_tasks.py +63 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/scheduler.py +37 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/tests/contract.py +136 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/tests/memory.py +42 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/tests/test_beat_scheduler.py +87 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/tests/test_memory_scheduler.py +15 -0
- graphcore_kernel-0.1.0/graphcore/scheduling/tests/test_ticks.py +143 -0
- graphcore_kernel-0.1.0/graphcore/tasks.py +9 -0
- graphcore_kernel-0.1.0/graphcore/test_settings.py +78 -0
- graphcore_kernel-0.1.0/graphcore/testing/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/testing/case.py +112 -0
- graphcore_kernel-0.1.0/graphcore/testing/runner.py +32 -0
- graphcore_kernel-0.1.0/graphcore/testing/settings.py +26 -0
- graphcore_kernel-0.1.0/graphcore/testing/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/testing/tests/agent_view_fixture.py +19 -0
- graphcore_kernel-0.1.0/graphcore/testing/tests/test_case_and_runner.py +219 -0
- graphcore_kernel-0.1.0/graphcore/testing/tests/test_settings_for_apps.py +50 -0
- graphcore_kernel-0.1.0/graphcore/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/tests/ids.py +14 -0
- graphcore_kernel-0.1.0/graphcore/tests/public_api_manifest.py +102 -0
- graphcore_kernel-0.1.0/graphcore/tests/runs.py +7 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_app_discovery.py +90 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_composition_boundaries.py +231 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_docs_discovery.py +108 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_no_print.py +70 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_packaging.py +64 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_public_api_boundaries.py +229 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_public_api_contract.py +62 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_public_api_docs.py +28 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_runtime.py +42 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_shared_type_boundaries.py +128 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_shared_types.py +144 -0
- graphcore_kernel-0.1.0/graphcore/tests/test_test_settings.py +45 -0
- graphcore_kernel-0.1.0/graphcore/transport/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/transport/agent_asgi.py +68 -0
- graphcore_kernel-0.1.0/graphcore/transport/agent_client.py +85 -0
- graphcore_kernel-0.1.0/graphcore/transport/channel_layer.py +68 -0
- graphcore_kernel-0.1.0/graphcore/transport/consumers.py +507 -0
- graphcore_kernel-0.1.0/graphcore/transport/routing.py +6 -0
- graphcore_kernel-0.1.0/graphcore/transport/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/transport/tests/test_agent_client.py +31 -0
- graphcore_kernel-0.1.0/graphcore/transport/tests/test_api_views.py +733 -0
- graphcore_kernel-0.1.0/graphcore/transport/tests/test_channel_layer.py +96 -0
- graphcore_kernel-0.1.0/graphcore/transport/tests/test_consumers.py +963 -0
- graphcore_kernel-0.1.0/graphcore/transport/tests/test_resource_metadata.py +67 -0
- graphcore_kernel-0.1.0/graphcore/transport/urls.py +29 -0
- graphcore_kernel-0.1.0/graphcore/transport/views.py +358 -0
- graphcore_kernel-0.1.0/graphcore/types/__init__.py +4 -0
- graphcore_kernel-0.1.0/graphcore/types/access.py +114 -0
- graphcore_kernel-0.1.0/graphcore/types/api.py +76 -0
- graphcore_kernel-0.1.0/graphcore/types/entities.py +100 -0
- graphcore_kernel-0.1.0/graphcore/types/entity_id.py +85 -0
- graphcore_kernel-0.1.0/graphcore/types/execution.py +41 -0
- graphcore_kernel-0.1.0/graphcore/types/identity.py +20 -0
- graphcore_kernel-0.1.0/graphcore/types/onboarding.py +20 -0
- graphcore_kernel-0.1.0/graphcore/types/query.py +116 -0
- graphcore_kernel-0.1.0/graphcore/types/schedules.py +91 -0
- graphcore_kernel-0.1.0/graphcore/types/strategy.py +73 -0
- graphcore_kernel-0.1.0/graphcore/types/tests/__init__.py +0 -0
- graphcore_kernel-0.1.0/graphcore/types/tests/test_entity_id.py +50 -0
- graphcore_kernel-0.1.0/graphcore/urls.py +5 -0
- graphcore_kernel-0.1.0/graphcore_kernel.egg-info/PKG-INFO +94 -0
- graphcore_kernel-0.1.0/graphcore_kernel.egg-info/SOURCES.txt +346 -0
- graphcore_kernel-0.1.0/graphcore_kernel.egg-info/dependency_links.txt +1 -0
- graphcore_kernel-0.1.0/graphcore_kernel.egg-info/entry_points.txt +2 -0
- graphcore_kernel-0.1.0/graphcore_kernel.egg-info/requires.txt +18 -0
- graphcore_kernel-0.1.0/graphcore_kernel.egg-info/top_level.txt +1 -0
- graphcore_kernel-0.1.0/pyproject.toml +72 -0
- graphcore_kernel-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: graphcore-kernel
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: GraphCore platform kernel (entities, strategies, transport, auth)
|
|
5
|
+
Author: GraphCore
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/graphcore-org/graphcore
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: Framework :: Django :: 5.2
|
|
13
|
+
Requires-Python: >=3.13
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Requires-Dist: Django<6,>=5.2
|
|
18
|
+
Requires-Dist: channels<5,>=4.2
|
|
19
|
+
Requires-Dist: celery<6,>=5.4
|
|
20
|
+
Requires-Dist: django-celery-beat<3,>=2.7
|
|
21
|
+
Requires-Dist: psycopg[binary,pool]<4,>=3.2
|
|
22
|
+
Requires-Dist: PyJWT[crypto]<3,>=2.9
|
|
23
|
+
Requires-Dist: django-cors-headers<5,>=4.4
|
|
24
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
25
|
+
Requires-Dist: mcp<3,>=2.3
|
|
26
|
+
Requires-Dist: daphne<5,>=4.1
|
|
27
|
+
Provides-Extra: redis
|
|
28
|
+
Requires-Dist: redis<9,>=8.1; extra == "redis"
|
|
29
|
+
Requires-Dist: django-redis<8,>=7.0; extra == "redis"
|
|
30
|
+
Requires-Dist: channels-redis<5,>=4.3; extra == "redis"
|
|
31
|
+
Provides-Extra: server
|
|
32
|
+
Requires-Dist: uvicorn[standard]<1,>=0.34; extra == "server"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# graphcore-kernel (backend)
|
|
36
|
+
|
|
37
|
+
Installable Django package (distributed as `graphcore-kernel`; the import
|
|
38
|
+
name stays `graphcore`). Pure platform library — entities, strategies,
|
|
39
|
+
executor, transport, auth. No CLI, no process supervisor, no templates.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cd kernel/backend
|
|
43
|
+
python3.14 -m venv .venv
|
|
44
|
+
source .venv/bin/activate
|
|
45
|
+
pip install -e ".[redis,server]"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For CLI + scaffolding, install the local monorepo packages together (nothing
|
|
49
|
+
is on PyPI yet):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# from local_dev/
|
|
53
|
+
pip install -e "graphcore/kernel/backend[redis,server]" \
|
|
54
|
+
-e graphcore/distro/backend
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Public surface
|
|
58
|
+
|
|
59
|
+
App authors import from `graphcore.public.*`; everything else under
|
|
60
|
+
`graphcore.*` is internal and free to move.
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from graphcore.public.apps import GraphCoreAppConfig
|
|
64
|
+
from graphcore.public.entities import Entity, register_entity
|
|
65
|
+
from graphcore.public.strategies import SetAttributes, Strategy, register_strategy
|
|
66
|
+
from graphcore.public.auth.policy import AccessPolicy
|
|
67
|
+
from graphcore.public.auth.perms import Read, Write
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`graphcore.public.apps` is imported while Django populates the app registry,
|
|
71
|
+
before models can be defined. `graphcore.public` is a namespace only, so that
|
|
72
|
+
import does not pull in `Entity`.
|
|
73
|
+
|
|
74
|
+
## Optional extras
|
|
75
|
+
|
|
76
|
+
Library-only installs of the kernel can omit these. The distro enables both
|
|
77
|
+
by default; generated projects can still use LocMem or another cache in
|
|
78
|
+
settings even when the Redis packages are installed.
|
|
79
|
+
|
|
80
|
+
| Extra | Adds | Needed for |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| `redis` | `redis`, `django-redis`, `channels-redis` | Redis-backed cache + channel layer |
|
|
83
|
+
| `server` | `uvicorn[standard]` | ASGI serving |
|
|
84
|
+
|
|
85
|
+
## Tests
|
|
86
|
+
|
|
87
|
+
From the monorepo root, with the shared Postgres running (`graphcore infra up`):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
scripts/test # every suite on Postgres, database-dependent suites on SQLite
|
|
91
|
+
scripts/test graphcore.persistence # narrow to a test label, on every database
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
See `.agents/skills/run-tests/SKILL.md` for the options.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# graphcore-kernel (backend)
|
|
2
|
+
|
|
3
|
+
Installable Django package (distributed as `graphcore-kernel`; the import
|
|
4
|
+
name stays `graphcore`). Pure platform library — entities, strategies,
|
|
5
|
+
executor, transport, auth. No CLI, no process supervisor, no templates.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd kernel/backend
|
|
9
|
+
python3.14 -m venv .venv
|
|
10
|
+
source .venv/bin/activate
|
|
11
|
+
pip install -e ".[redis,server]"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
For CLI + scaffolding, install the local monorepo packages together (nothing
|
|
15
|
+
is on PyPI yet):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# from local_dev/
|
|
19
|
+
pip install -e "graphcore/kernel/backend[redis,server]" \
|
|
20
|
+
-e graphcore/distro/backend
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Public surface
|
|
24
|
+
|
|
25
|
+
App authors import from `graphcore.public.*`; everything else under
|
|
26
|
+
`graphcore.*` is internal and free to move.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from graphcore.public.apps import GraphCoreAppConfig
|
|
30
|
+
from graphcore.public.entities import Entity, register_entity
|
|
31
|
+
from graphcore.public.strategies import SetAttributes, Strategy, register_strategy
|
|
32
|
+
from graphcore.public.auth.policy import AccessPolicy
|
|
33
|
+
from graphcore.public.auth.perms import Read, Write
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`graphcore.public.apps` is imported while Django populates the app registry,
|
|
37
|
+
before models can be defined. `graphcore.public` is a namespace only, so that
|
|
38
|
+
import does not pull in `Entity`.
|
|
39
|
+
|
|
40
|
+
## Optional extras
|
|
41
|
+
|
|
42
|
+
Library-only installs of the kernel can omit these. The distro enables both
|
|
43
|
+
by default; generated projects can still use LocMem or another cache in
|
|
44
|
+
settings even when the Redis packages are installed.
|
|
45
|
+
|
|
46
|
+
| Extra | Adds | Needed for |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `redis` | `redis`, `django-redis`, `channels-redis` | Redis-backed cache + channel layer |
|
|
49
|
+
| `server` | `uvicorn[standard]` | ASGI serving |
|
|
50
|
+
|
|
51
|
+
## Tests
|
|
52
|
+
|
|
53
|
+
From the monorepo root, with the shared Postgres running (`graphcore infra up`):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
scripts/test # every suite on Postgres, database-dependent suites on SQLite
|
|
57
|
+
scripts/test graphcore.persistence # narrow to a test label, on every database
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See `.agents/skills/run-tests/SKILL.md` for the options.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from graphcore.agent_frontend.api import AgentView, ToolSpec, agent_view, operation, strategy_tool
|
|
2
|
+
from graphcore.agent_frontend.context import Context
|
|
3
|
+
from graphcore.agent_frontend.errors import AgentError, RenderTooLarge
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
'AgentError', 'AgentView', 'Context', 'RenderTooLarge', 'ToolSpec',
|
|
7
|
+
'agent_view', 'operation', 'strategy_tool',
|
|
8
|
+
]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""What an app's agent frontend package imports."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from typing import Any, Callable, Optional, Sequence
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _tool_name(strategy: str) -> str:
|
|
10
|
+
base = strategy.removesuffix('Strategy')
|
|
11
|
+
return re.sub(r'(?<!^)(?=[A-Z])', '_', base).lower()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class ToolSpec:
|
|
16
|
+
name: str
|
|
17
|
+
description: Optional[str] = None
|
|
18
|
+
strategy: Optional[str] = None
|
|
19
|
+
takes_target: bool = True
|
|
20
|
+
bind: Optional[str] = None
|
|
21
|
+
schema: Optional[dict] = None
|
|
22
|
+
fn: Optional[Callable] = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def strategy_tool(
|
|
26
|
+
strategy: str, takes_target: bool = True, bind: Optional[str] = None,
|
|
27
|
+
name: Optional[str] = None, description: Optional[str] = None,
|
|
28
|
+
) -> ToolSpec:
|
|
29
|
+
"""A view tool that runs the registered strategy named `strategy`. The agent
|
|
30
|
+
supplies its target; `takes_target=False` runs it untargeted, and `bind`
|
|
31
|
+
fixes the target to an entity id."""
|
|
32
|
+
return ToolSpec(
|
|
33
|
+
name=name or _tool_name(strategy), description=description, strategy=strategy,
|
|
34
|
+
takes_target=takes_target, bind=bind,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def operation(name: str, description: str, schema: dict) -> Callable[[Callable], ToolSpec]:
|
|
39
|
+
"""A view tool that is code: `async def fn(ctx, **params)`."""
|
|
40
|
+
def wrap(fn: Callable) -> ToolSpec:
|
|
41
|
+
return ToolSpec(name=name, description=description, schema=schema, fn=fn, takes_target=False)
|
|
42
|
+
return wrap
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
class AgentView:
|
|
47
|
+
name: str
|
|
48
|
+
fn: Callable
|
|
49
|
+
default_for: tuple[str, ...] = ()
|
|
50
|
+
tools: Optional[Callable] = field(default=None, compare=False)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def agent_view(
|
|
54
|
+
name: str, default_for: Sequence[str] = (), tools: Optional[Callable] = None,
|
|
55
|
+
) -> Callable[[Callable], Callable]:
|
|
56
|
+
"""Declare `async def fn(ctx, entity)` (or `fn(ctx)` for a view with no entity) as the agent
|
|
57
|
+
view `name`; a module-level view in an agent frontend package is registered at startup.
|
|
58
|
+
`tools` is `async def (ctx, entity) -> list[ToolSpec]`, called on every render; `entity` is None
|
|
59
|
+
for a view with no entity."""
|
|
60
|
+
def wrap(fn: Callable) -> Callable:
|
|
61
|
+
fn.__agent_view__ = AgentView(name, fn, tuple(default_for), tools)
|
|
62
|
+
return fn
|
|
63
|
+
return wrap
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def view_of(value: Any) -> Optional[AgentView]:
|
|
67
|
+
"""The agent view `value` was declared as with `@agent_view`, if any."""
|
|
68
|
+
view = getattr(value, '__agent_view__', None)
|
|
69
|
+
return view if isinstance(view, AgentView) else None
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""The base agent views, loaded below every app's. An app view of the same name, or claiming
|
|
2
|
+
the same `default_for` type, replaces the one here, and may reuse these parts."""
|
|
3
|
+
from graphcore.agent_frontend.base.views import (
|
|
4
|
+
children_section, deployment_tools, entity_fields, entity_summary, entity_view, grouped,
|
|
5
|
+
home_view, places, type_tools, view_tools, view_view,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
'children_section', 'deployment_tools', 'entity_fields', 'entity_summary', 'entity_view',
|
|
10
|
+
'grouped', 'home_view', 'places', 'type_tools', 'view_tools', 'view_view',
|
|
11
|
+
]
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""The base agent views: `home` at `/`, `entity` at `/e/{entity}`, and `view`, the default for view entities."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
from collections import defaultdict
|
|
6
|
+
from typing import Any, Optional
|
|
7
|
+
|
|
8
|
+
from graphcore.agent_frontend import AgentView, Context, ToolSpec, agent_view, strategy_tool
|
|
9
|
+
|
|
10
|
+
# The base entity's own keys, rendered under `## Entity`; every other key is a field.
|
|
11
|
+
STRUCTURAL_KEYS = ('entity_id', 'entity_type_id', 'owner', 'parent_id', 'sibling_position', 'version')
|
|
12
|
+
MAX_FIELD_CHARS = 2000
|
|
13
|
+
VIEW_TYPE = 'graphcore.View'
|
|
14
|
+
_ENTITY_ID_PREFIX = 'gc://'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _value(ctx: Context, value: Any) -> str:
|
|
18
|
+
"""One line: strings bare unless empty or multi-line, everything else as JSON; an entity
|
|
19
|
+
id gains its address, and a long value is cut with its full length."""
|
|
20
|
+
if isinstance(value, str) and value and '\n' not in value:
|
|
21
|
+
text = value
|
|
22
|
+
else:
|
|
23
|
+
text = json.dumps(value, default=str, ensure_ascii=False)
|
|
24
|
+
if len(text) > MAX_FIELD_CHARS:
|
|
25
|
+
return f"{text[:MAX_FIELD_CHARS]}… (truncated; {len(text)} characters)"
|
|
26
|
+
if isinstance(value, str) and value.startswith(_ENTITY_ID_PREFIX):
|
|
27
|
+
return f"{text} · {ctx.place(value).address}"
|
|
28
|
+
return text
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def entity_fields(ctx: Context, entity: Any) -> list[str]:
|
|
32
|
+
"""`key: value` for every key of the entity that is not structural."""
|
|
33
|
+
return [
|
|
34
|
+
f"{key}: {_value(ctx, value)}"
|
|
35
|
+
for key, value in entity.to_dict().items() if key not in STRUCTURAL_KEYS
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
async def entity_summary(ctx: Context, entity: Any) -> list[str]:
|
|
40
|
+
"""The entity's structural keys, each said plainly: who owns it and where it sits."""
|
|
41
|
+
data = entity.to_dict()
|
|
42
|
+
owner = data.get('owner')
|
|
43
|
+
lines = [
|
|
44
|
+
f"id: {entity.entity_id}",
|
|
45
|
+
f"type: {entity.entity_type_id}",
|
|
46
|
+
f"owner: {owner} (you)" if owner == ctx.principal.principal_entity_id
|
|
47
|
+
else f"owner: {owner or 'none'}",
|
|
48
|
+
f"parent: {await _parent(ctx, data.get('parent_id'))}",
|
|
49
|
+
]
|
|
50
|
+
lines += [f"{key}: {data[key]}" for key in ('version', 'sibling_position') if key in data]
|
|
51
|
+
return lines
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def _parent(ctx: Context, parent_id: Optional[str]) -> str:
|
|
55
|
+
if not parent_id:
|
|
56
|
+
return 'none (top level)'
|
|
57
|
+
parent = await ctx.get(parent_id)
|
|
58
|
+
if parent is None:
|
|
59
|
+
return f"{parent_id} (not readable)"
|
|
60
|
+
data = parent.to_dict()
|
|
61
|
+
label = next((str(data[k]) for k in ('name', 'title', 'slug') if data.get(k)), parent_id)
|
|
62
|
+
return f"{label} · {parent.entity_type_id} · {ctx.place(parent_id).address}"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async def children_section(ctx: Context, entity: Any, limit: int = 50) -> list:
|
|
66
|
+
"""`## Children` and a compact placement per child, in sibling order."""
|
|
67
|
+
children = await ctx.children(entity, limit=limit)
|
|
68
|
+
if not children:
|
|
69
|
+
return ['## Children\nnone']
|
|
70
|
+
parts: list = [f"## Children ({len(children)}{', more exist' if ctx.more else ''})"]
|
|
71
|
+
parts.extend(ctx.place(child.entity_id) for child in children)
|
|
72
|
+
if ctx.more:
|
|
73
|
+
parts.append(f"Narrow with `find(type, {{\"parent_id\": \"{entity.entity_id}\"}})`.")
|
|
74
|
+
return parts
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def grouped(ctx: Context, entities: list) -> list:
|
|
78
|
+
"""Compact placements of `entities` under one heading per type."""
|
|
79
|
+
groups: dict[str, list] = defaultdict(list)
|
|
80
|
+
for entity in entities:
|
|
81
|
+
groups[entity.entity_type_id].append(entity)
|
|
82
|
+
parts: list = []
|
|
83
|
+
for type_id, members in sorted(groups.items()):
|
|
84
|
+
parts.append(f"### {type_id} ({len(members)})")
|
|
85
|
+
parts.extend(ctx.place(member.entity_id) for member in members)
|
|
86
|
+
if ctx.more:
|
|
87
|
+
parts.append("More exist than are shown; use `find` to narrow by type and field.")
|
|
88
|
+
return parts
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
async def type_tools(ctx: Context, entity: Any) -> list[ToolSpec]:
|
|
92
|
+
"""Every strategy the entity's type offers, bound to the entity."""
|
|
93
|
+
return [
|
|
94
|
+
strategy_tool(s['name'], bind=entity.entity_id)
|
|
95
|
+
for s in ctx.type_strategies(entity.entity_type_id)
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
async def deployment_tools(ctx: Context, entity: Optional[Any] = None) -> list[ToolSpec]:
|
|
100
|
+
"""Every strategy on the deployment's allowlist, untargeted."""
|
|
101
|
+
return [strategy_tool(s['name'], takes_target=False) for s in ctx.deployment_strategies()]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def places(ctx: Context) -> list:
|
|
105
|
+
"""`## Places` and a compact placement per route other than `/` that needs no entity."""
|
|
106
|
+
paths = [r['pattern'] for r in ctx.routes() if r['pattern'] != '/' and '{' not in r['pattern']]
|
|
107
|
+
return ['## Places', *(ctx.place(path) for path in paths)] if paths else []
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@agent_view('home', tools=deployment_tools)
|
|
111
|
+
async def home_view(ctx: Context) -> list:
|
|
112
|
+
top_level = await ctx.find(frozenset(ctx.entity_types()), where={'parent_id': None})
|
|
113
|
+
return [
|
|
114
|
+
*places(ctx),
|
|
115
|
+
"## Top-level entities\nOpen one to see what it contains.",
|
|
116
|
+
*grouped(ctx, top_level),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@agent_view('entity', tools=type_tools)
|
|
121
|
+
async def entity_view(ctx: Context, entity: Any) -> list:
|
|
122
|
+
fields = entity_fields(ctx, entity)
|
|
123
|
+
return [
|
|
124
|
+
'## Entity\n' + '\n'.join(await entity_summary(ctx, entity)),
|
|
125
|
+
'## Fields\n' + ('\n'.join(fields) if fields else 'none'),
|
|
126
|
+
*await children_section(ctx, entity),
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
async def _component(ctx: Context, view: Any) -> tuple[Optional[AgentView], Any]:
|
|
131
|
+
"""The agent view the view's `component` names, and the entity it renders (None for none);
|
|
132
|
+
sets `ctx.view_state` to the view's stored state for the component and its tools."""
|
|
133
|
+
data = view.to_dict()
|
|
134
|
+
ctx.view_state = data.get('state') or {}
|
|
135
|
+
component = ctx.view(data.get('component') or '')
|
|
136
|
+
if component is not None and VIEW_TYPE in component.default_for:
|
|
137
|
+
component = None # a view naming the view view would render itself forever
|
|
138
|
+
target = await ctx.get(data['renders']) if data.get('renders') else None
|
|
139
|
+
return component, target
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def view_tools(ctx: Context, view: Any) -> list[ToolSpec]:
|
|
143
|
+
"""The component's tools, then the view entity's own."""
|
|
144
|
+
component, target = await _component(ctx, view)
|
|
145
|
+
own = await type_tools(ctx, view)
|
|
146
|
+
if component is None or component.tools is None:
|
|
147
|
+
return own
|
|
148
|
+
return [*await component.tools(ctx, target), *own]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@agent_view('view', default_for=[VIEW_TYPE], tools=view_tools)
|
|
152
|
+
async def view_view(ctx: Context, view: Any) -> list:
|
|
153
|
+
"""A view renders as itself: the agent view its `component` names, over the entity it
|
|
154
|
+
renders. Without an agent view of that name it renders as an entity."""
|
|
155
|
+
data = view.to_dict()
|
|
156
|
+
component, target = await _component(ctx, view)
|
|
157
|
+
if component is None:
|
|
158
|
+
note = f"No agent view is named {data.get('component')!r}; showing the view as an entity."
|
|
159
|
+
return [note, *await entity_view(ctx, view)]
|
|
160
|
+
if data.get('renders') and target is None:
|
|
161
|
+
return [f"This view renders {data['renders']}, which does not exist or is not readable."]
|
|
162
|
+
shows = ctx.place(data['renders']).address if target is not None else 'no entity'
|
|
163
|
+
body = await (component.fn(ctx, target) if target is not None else component.fn(ctx))
|
|
164
|
+
return [
|
|
165
|
+
f"View `{component.name}` of {shows} · view entity {view.entity_id}",
|
|
166
|
+
*(body if isinstance(body, list) else [body]),
|
|
167
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""The only way the agent frontend reaches the kernel: a `GraphAPI` client."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Any, Optional, Protocol
|
|
5
|
+
|
|
6
|
+
from graphcore.types.entities import EntityPage
|
|
7
|
+
from graphcore.types.identity import Principal
|
|
8
|
+
from graphcore.types.query import Predicate
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GraphClient(Protocol):
|
|
12
|
+
async def authenticate(self, token: str) -> Optional[Principal]: ...
|
|
13
|
+
async def get_entity(self, principal: Principal, entity_id: str) -> Any: ...
|
|
14
|
+
async def list_children(
|
|
15
|
+
self, principal: Principal, parent_id: str, type_ids: Optional[frozenset[str]] = None,
|
|
16
|
+
cursor: Optional[str] = None, limit: int = 25,
|
|
17
|
+
) -> EntityPage: ...
|
|
18
|
+
async def list_entities(
|
|
19
|
+
self, principal: Principal, type_ids: frozenset[str], parent_id: Optional[str] = None,
|
|
20
|
+
where: Predicate | dict | None = None, cursor: Optional[str] = None, limit: int = 25,
|
|
21
|
+
granted_to_me: bool = False,
|
|
22
|
+
) -> EntityPage: ...
|
|
23
|
+
async def execute(
|
|
24
|
+
self, principal: Principal, strategy_name: str, target_id: Optional[str], params: dict,
|
|
25
|
+
) -> dict: ...
|
|
26
|
+
def resolve(self, address: str) -> dict: ...
|
|
27
|
+
def routes(self) -> list[dict]: ...
|
|
28
|
+
def entity_types(self) -> list[str]: ...
|
|
29
|
+
def type_strategies(self, entity_type_id: str) -> list[dict]: ...
|
|
30
|
+
def deployment_strategies(self) -> list[dict]: ...
|
|
31
|
+
def strategy_info(self) -> dict[str, dict]: ...
|