harp-proxy 0.5.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.
- harp_proxy-0.5.0/LICENSE.rst +43 -0
- harp_proxy-0.5.0/PKG-INFO +187 -0
- harp_proxy-0.5.0/README.rst +142 -0
- harp_proxy-0.5.0/docs/apps/dashboard/development/index.rst +24 -0
- harp_proxy-0.5.0/docs/apps/dashboard/development/tests_e2e.rst +152 -0
- harp_proxy-0.5.0/docs/apps/dashboard/development/tests_unit.rst +209 -0
- harp_proxy-0.5.0/docs/apps/dashboard/examples/auth.basic.yml +5 -0
- harp_proxy-0.5.0/docs/apps/dashboard/examples/auth.yml +5 -0
- harp_proxy-0.5.0/docs/apps/dashboard/examples/devserver.yml +3 -0
- harp_proxy-0.5.0/docs/apps/dashboard/examples/main.yml +3 -0
- harp_proxy-0.5.0/docs/apps/dashboard/index.rst +73 -0
- harp_proxy-0.5.0/docs/apps/http_client/examples/full.yml +51 -0
- harp_proxy-0.5.0/docs/apps/http_client/examples/simple.yml +11 -0
- harp_proxy-0.5.0/docs/apps/http_client/index.rst +68 -0
- harp_proxy-0.5.0/docs/apps/janitor/index.rst +25 -0
- harp_proxy-0.5.0/docs/apps/proxy/examples/swapi.yml +5 -0
- harp_proxy-0.5.0/docs/apps/proxy/index.rst +28 -0
- harp_proxy-0.5.0/docs/apps/sqlalchemy_storage/index.rst +92 -0
- harp_proxy-0.5.0/docs/apps/telemetry/index.rst +38 -0
- harp_proxy-0.5.0/harp/__init__.py +99 -0
- harp_proxy-0.5.0/harp/__main__.py +4 -0
- harp_proxy-0.5.0/harp/_logging.py +109 -0
- harp_proxy-0.5.0/harp/asgi/__init__.py +7 -0
- harp_proxy-0.5.0/harp/asgi/bridge/__init__.py +0 -0
- harp_proxy-0.5.0/harp/asgi/bridge/requests.py +71 -0
- harp_proxy-0.5.0/harp/asgi/bridge/responses.py +42 -0
- harp_proxy-0.5.0/harp/asgi/events.py +91 -0
- harp_proxy-0.5.0/harp/asgi/kernel.py +169 -0
- harp_proxy-0.5.0/harp/asgi/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/asgi/tests/test_http_bridge_asgi_request.py +200 -0
- harp_proxy-0.5.0/harp/commandline/__init__.py +89 -0
- harp_proxy-0.5.0/harp/commandline/install.py +11 -0
- harp_proxy-0.5.0/harp/commandline/migrations.py +84 -0
- harp_proxy-0.5.0/harp/commandline/options/__init__.py +0 -0
- harp_proxy-0.5.0/harp/commandline/options/server.py +77 -0
- harp_proxy-0.5.0/harp/commandline/server.py +20 -0
- harp_proxy-0.5.0/harp/commandline/start.py +110 -0
- harp_proxy-0.5.0/harp/commandline/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/commandline/tests/test_server_options.py +18 -0
- harp_proxy-0.5.0/harp/commandline/utils/__init__.py +0 -0
- harp_proxy-0.5.0/harp/commandline/utils/_hacks.py +41 -0
- harp_proxy-0.5.0/harp/commandline/utils/manager.py +131 -0
- harp_proxy-0.5.0/harp/config/__init__.py +40 -0
- harp_proxy-0.5.0/harp/config/adapters/__init__.py +0 -0
- harp_proxy-0.5.0/harp/config/adapters/hypercorn.py +56 -0
- harp_proxy-0.5.0/harp/config/application.py +78 -0
- harp_proxy-0.5.0/harp/config/config.py +327 -0
- harp_proxy-0.5.0/harp/config/events.py +60 -0
- harp_proxy-0.5.0/harp/config/factories/__init__.py +0 -0
- harp_proxy-0.5.0/harp/config/factories/kernel_factory.py +116 -0
- harp_proxy-0.5.0/harp/config/factories/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/config/factories/tests/test_configuration.py +62 -0
- harp_proxy-0.5.0/harp/config/factories/tests/test_settings.py +29 -0
- harp_proxy-0.5.0/harp/config/settings/__init__.py +15 -0
- harp_proxy-0.5.0/harp/config/settings/base.py +60 -0
- harp_proxy-0.5.0/harp/config/settings/disabled.py +38 -0
- harp_proxy-0.5.0/harp/config/settings/from_file.py +21 -0
- harp_proxy-0.5.0/harp/config/settings/lazy.py +103 -0
- harp_proxy-0.5.0/harp/config/settings/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/config/settings/tests/test_disabled.py +10 -0
- harp_proxy-0.5.0/harp/config/settings/tests/test_lazy.py +143 -0
- harp_proxy-0.5.0/harp/controllers/__init__.py +62 -0
- harp_proxy-0.5.0/harp/controllers/default.py +24 -0
- harp_proxy-0.5.0/harp/controllers/resolvers.py +37 -0
- harp_proxy-0.5.0/harp/controllers/routing.py +128 -0
- harp_proxy-0.5.0/harp/controllers/typing.py +7 -0
- harp_proxy-0.5.0/harp/errors.py +29 -0
- harp_proxy-0.5.0/harp/event_dispatcher.py +36 -0
- harp_proxy-0.5.0/harp/http/__init__.py +21 -0
- harp_proxy-0.5.0/harp/http/errors.py +28 -0
- harp_proxy-0.5.0/harp/http/requests.py +115 -0
- harp_proxy-0.5.0/harp/http/responses.py +46 -0
- harp_proxy-0.5.0/harp/http/serializers.py +103 -0
- harp_proxy-0.5.0/harp/http/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/http/tests/stubs.py +65 -0
- harp_proxy-0.5.0/harp/http/tests/test_requests.py +189 -0
- harp_proxy-0.5.0/harp/http/tests/test_requests_wrapped.py +83 -0
- harp_proxy-0.5.0/harp/http/tests/test_utils_cookies.py +68 -0
- harp_proxy-0.5.0/harp/http/typing/__init__.py +11 -0
- harp_proxy-0.5.0/harp/http/typing/bridges.py +34 -0
- harp_proxy-0.5.0/harp/http/typing/messages.py +33 -0
- harp_proxy-0.5.0/harp/http/typing/serializers.py +15 -0
- harp_proxy-0.5.0/harp/http/utils/__init__.py +7 -0
- harp_proxy-0.5.0/harp/http/utils/cookies.py +20 -0
- harp_proxy-0.5.0/harp/http/utils/methods.py +118 -0
- harp_proxy-0.5.0/harp/meta/__init__.py +33 -0
- harp_proxy-0.5.0/harp/models/__init__.py +23 -0
- harp_proxy-0.5.0/harp/models/base.py +25 -0
- harp_proxy-0.5.0/harp/models/blobs.py +55 -0
- harp_proxy-0.5.0/harp/models/messages.py +15 -0
- harp_proxy-0.5.0/harp/models/transactions.py +41 -0
- harp_proxy-0.5.0/harp/settings.py +30 -0
- harp_proxy-0.5.0/harp/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/tests/test_asgi_kernel.py +51 -0
- harp_proxy-0.5.0/harp/tests/test_settings.py +32 -0
- harp_proxy-0.5.0/harp/typing/__init__.py +21 -0
- harp_proxy-0.5.0/harp/typing/global_settings.py +6 -0
- harp_proxy-0.5.0/harp/typing/signs.py +11 -0
- harp_proxy-0.5.0/harp/typing/storage.py +64 -0
- harp_proxy-0.5.0/harp/utils/__init__.py +7 -0
- harp_proxy-0.5.0/harp/utils/arguments.py +14 -0
- harp_proxy-0.5.0/harp/utils/background.py +36 -0
- harp_proxy-0.5.0/harp/utils/bytes.py +10 -0
- harp_proxy-0.5.0/harp/utils/collections.py +62 -0
- harp_proxy-0.5.0/harp/utils/commandline.py +49 -0
- harp_proxy-0.5.0/harp/utils/dates.py +25 -0
- harp_proxy-0.5.0/harp/utils/env.py +25 -0
- harp_proxy-0.5.0/harp/utils/guids.py +4 -0
- harp_proxy-0.5.0/harp/utils/identifiers.py +2 -0
- harp_proxy-0.5.0/harp/utils/json.py +9 -0
- harp_proxy-0.5.0/harp/utils/network.py +44 -0
- harp_proxy-0.5.0/harp/utils/processes.py +14 -0
- harp_proxy-0.5.0/harp/utils/testing/__init__.py +0 -0
- harp_proxy-0.5.0/harp/utils/testing/applications.py +32 -0
- harp_proxy-0.5.0/harp/utils/testing/benchmarking.py +110 -0
- harp_proxy-0.5.0/harp/utils/testing/communicators/__init__.py +10 -0
- harp_proxy-0.5.0/harp/utils/testing/communicators/asgi.py +64 -0
- harp_proxy-0.5.0/harp/utils/testing/communicators/http.py +57 -0
- harp_proxy-0.5.0/harp/utils/testing/databases.py +110 -0
- harp_proxy-0.5.0/harp/utils/testing/http.py +101 -0
- harp_proxy-0.5.0/harp/utils/testing/mixins/__init__.py +6 -0
- harp_proxy-0.5.0/harp/utils/testing/mixins/controllers.py +68 -0
- harp_proxy-0.5.0/harp/utils/testing/stub_api/__init__.py +33 -0
- harp_proxy-0.5.0/harp/utils/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp/utils/tests/test_collections.py +84 -0
- harp_proxy-0.5.0/harp/utils/tests/test_dates.py +17 -0
- harp_proxy-0.5.0/harp/utils/tests/test_env.py +28 -0
- harp_proxy-0.5.0/harp/utils/tests/test_urls.py +6 -0
- harp_proxy-0.5.0/harp/utils/tpdex.py +13 -0
- harp_proxy-0.5.0/harp/utils/urls.py +5 -0
- harp_proxy-0.5.0/harp/views/__init__.py +17 -0
- harp_proxy-0.5.0/harp/views/json.py +62 -0
- harp_proxy-0.5.0/harp/views/strings.py +14 -0
- harp_proxy-0.5.0/harp_apps/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/contrib/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/contrib/sentry/__app__.py +27 -0
- harp_proxy-0.5.0/harp_apps/contrib/sentry/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/contrib/sentry/settings.py +6 -0
- harp_proxy-0.5.0/harp_apps/dashboard/__app__.py +39 -0
- harp_proxy-0.5.0/harp_apps/dashboard/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/dashboard/controllers/__init__.py +145 -0
- harp_proxy-0.5.0/harp_apps/dashboard/controllers/blobs.py +25 -0
- harp_proxy-0.5.0/harp_apps/dashboard/controllers/overview.py +136 -0
- harp_proxy-0.5.0/harp_apps/dashboard/controllers/system.py +78 -0
- harp_proxy-0.5.0/harp_apps/dashboard/controllers/transactions.py +95 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/__init__.py +15 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/base.py +120 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/transaction_endpoint.py +21 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/transaction_flag.py +7 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/transaction_method.py +6 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/transaction_status.py +6 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/transaction_tpdex.py +5 -0
- harp_proxy-0.5.0/harp_apps/dashboard/filters/utils.py +17 -0
- harp_proxy-0.5.0/harp_apps/dashboard/schemas/__init__.py +3 -0
- harp_proxy-0.5.0/harp_apps/dashboard/schemas/transactions_grouped_by.py +11 -0
- harp_proxy-0.5.0/harp_apps/dashboard/settings.py +88 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/filters/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/filters/test_base.py +42 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/filters/test_utils.py +9 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/test_controllers_blobs.py +52 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/test_controllers_overview.py +100 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/test_controllers_transactions.py +83 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/test_settings.py +31 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/test_utils_dependencies.py +127 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/utils/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/tests/utils/test_dates.py +77 -0
- harp_proxy-0.5.0/harp_apps/dashboard/utils/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/utils/dates.py +73 -0
- harp_proxy-0.5.0/harp_apps/dashboard/utils/dependencies.py +30 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/android-icon-144x144.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/android-icon-192x192.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/android-icon-36x36.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/android-icon-48x48.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/android-icon-72x72.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/android-icon-96x96.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-114x114.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-120x120.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-144x144.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-152x152.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-180x180.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-57x57.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-60x60.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-72x72.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-76x76.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon-precomposed.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/apple-icon.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/dateFns-HtJmkpQQ.js +1 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/index-B3DOsDR-.js +535 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/index-CCrzvmeS.css +1 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/react-D_Tw0keN.js +32 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/reactQuery-CZkty2vN.js +1 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/reactRouter-DpNtGriS.js +29 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/recharts-rDo41veu.js +68 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/sentry-B_XI-0Ih.js +14 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/syntaxHighlighter-w3E7YOxW.js +13 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/assets/ui-dyya_Ddv.js +4 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/browserconfig.xml +2 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/favicon-16x16.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/favicon-32x32.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/favicon-96x96.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/favicon.ico +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/index.html +38 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/manifest.json +41 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/ms-icon-144x144.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/ms-icon-150x150.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/ms-icon-310x310.png +0 -0
- harp_proxy-0.5.0/harp_apps/dashboard/web/ms-icon-70x70.png +0 -0
- harp_proxy-0.5.0/harp_apps/http_client/__app__.py +18 -0
- harp_proxy-0.5.0/harp_apps/http_client/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/http_client/client.py +19 -0
- harp_proxy-0.5.0/harp_apps/http_client/settings.py +40 -0
- harp_proxy-0.5.0/harp_apps/http_client/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/http_client/tests/test_settings.py +68 -0
- harp_proxy-0.5.0/harp_apps/janitor/__app__.py +18 -0
- harp_proxy-0.5.0/harp_apps/janitor/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/janitor/settings.py +7 -0
- harp_proxy-0.5.0/harp_apps/janitor/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/janitor/tests/test_worker.py +68 -0
- harp_proxy-0.5.0/harp_apps/janitor/worker.py +112 -0
- harp_proxy-0.5.0/harp_apps/proxy/__app__.py +38 -0
- harp_proxy-0.5.0/harp_apps/proxy/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/proxy/controllers.py +196 -0
- harp_proxy-0.5.0/harp_apps/proxy/events.py +3 -0
- harp_proxy-0.5.0/harp_apps/proxy/settings.py +26 -0
- harp_proxy-0.5.0/harp_apps/proxy/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/proxy/tests/test_controllers_http_proxy.py +205 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/__app__.py +37 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/constants.py +10 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/migrations/env.py +76 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/migrations/script.py.mako +26 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/migrations/versions/20240609082234_248285939c4c_initial.py +147 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/migrations/versions/20240614152802_0b4d9cb71c38_rename_apdex_to_tpdex.py +26 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/__init__.py +32 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/base.py +82 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/blobs.py +58 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/flags.py +32 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/messages.py +69 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/metrics.py +42 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/tags.py +32 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/transactions.py +172 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/models/users.py +37 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/optionals/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/optionals/_base.py +18 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/optionals/pg_trgm.py +101 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/settings.py +13 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/storage.py +538 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_application.py +35 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_migrations.py +8 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_models_base.py +74 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_optionals_pg_trgm.py +118 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_storage_tags.py +21 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_storage_transactions.py +30 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/tests/test_storage_usage.py +14 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/dates.py +90 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/migrations.py +91 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/sql.py +20 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/testing/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/testing/database.py +34 -0
- harp_proxy-0.5.0/harp_apps/sqlalchemy_storage/utils/testing/mixins.py +102 -0
- harp_proxy-0.5.0/harp_apps/telemetry/__app__.py +37 -0
- harp_proxy-0.5.0/harp_apps/telemetry/__init__.py +1 -0
- harp_proxy-0.5.0/harp_apps/telemetry/manager.py +85 -0
- harp_proxy-0.5.0/harp_apps/telemetry/tests/__init__.py +0 -0
- harp_proxy-0.5.0/harp_apps/telemetry/tests/test_application.py +5 -0
- harp_proxy-0.5.0/harp_apps/telemetry/tests/test_manager.py +54 -0
- harp_proxy-0.5.0/pyproject.toml +114 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
License
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
HARP Community Edition (or HARP CE) is the open-source core (`this repository <https://github.com/msqd/harp>`_) for the
|
|
5
|
+
HARP ecosystem (including both the open-source core, the professional and enterprise extensions and third party
|
|
6
|
+
extensions that did not define their own licence).
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
HARP Community Edition (HARP CE)
|
|
10
|
+
::::::::::::::::::::::::::::::::
|
|
11
|
+
|
|
12
|
+
HARP CE is an API Runtime Proxy, a sidecar service for web applications that helps raising reliability, performances,
|
|
13
|
+
security and observability of your external API usage.
|
|
14
|
+
|
|
15
|
+
All the code included in this repository is part of HARP CE, and is distributed under the terms of the GNU Lesser
|
|
16
|
+
General Public License (LGPL) version 3.0 or later.
|
|
17
|
+
|
|
18
|
+
Copyright (C) 2023-2024 Romain Dorgueil
|
|
19
|
+
|
|
20
|
+
.. code-block:: text
|
|
21
|
+
|
|
22
|
+
This program is free software: you can redistribute it and/or modify
|
|
23
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
24
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
25
|
+
(at your option) any later version.
|
|
26
|
+
|
|
27
|
+
This program is distributed in the hope that it will be useful,
|
|
28
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
29
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
30
|
+
GNU Lesser General Public License for more details.
|
|
31
|
+
|
|
32
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
33
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
34
|
+
|
|
35
|
+
Read the full license: https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
HARP Professional Edition (HARP PE) and Enterprise Edition (HARP EE)
|
|
39
|
+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
40
|
+
|
|
41
|
+
HARP Professional Edition (HARP PE) and Enterprise Edition (HARP EE) are the commercial extensions of HARP CE, and are
|
|
42
|
+
distributed under a commercial license. They are not open-source (although you will get access to the source code if
|
|
43
|
+
you are a professional edition or enterprise edition customer), and are not distributed with this repository.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: harp-proxy
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Harp is an API Runtime Proxy – A toolkit for Fast, Reliable and Observable external APIs
|
|
5
|
+
Author: Romain Dorgueil
|
|
6
|
+
Author-email: romain@makersquad.fr
|
|
7
|
+
Requires-Python: >=3.12,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
|
|
12
|
+
Requires-Dist: aiosqlite (>=0.19,<0.21)
|
|
13
|
+
Requires-Dist: alembic (>=1.13.1,<2.0.0)
|
|
14
|
+
Requires-Dist: anyio (>=4.4.0,<5.0.0)
|
|
15
|
+
Requires-Dist: asgi-prometheus (>=1.1.2,<2.0.0)
|
|
16
|
+
Requires-Dist: asgimiddlewarestaticfile (>=0.6.0,<0.7.0)
|
|
17
|
+
Requires-Dist: asgiref (>=3.8.1,<4.0.0)
|
|
18
|
+
Requires-Dist: asyncpg (>=0.29.0,<0.30.0)
|
|
19
|
+
Requires-Dist: dataclasses-json (>=0.6.7,<0.7.0)
|
|
20
|
+
Requires-Dist: dataclasses-jsonschema (>=2.16.0,<3.0.0)
|
|
21
|
+
Requires-Dist: essentials-configuration (>=2.0.4,<3.0.0)
|
|
22
|
+
Requires-Dist: hishel (>=0.0.21,<0.0.28)
|
|
23
|
+
Requires-Dist: honcho (>=1.1.0,<2.0.0) ; extra == "dev"
|
|
24
|
+
Requires-Dist: http-router (>=4.1.2,<5.0.0)
|
|
25
|
+
Requires-Dist: httpx (>=0.26,<0.28)
|
|
26
|
+
Requires-Dist: hypercorn (>=0.17.2,<0.18.0)
|
|
27
|
+
Requires-Dist: multidict (>=6.0.5,<7.0.0)
|
|
28
|
+
Requires-Dist: orjson (>=3.10.5,<4.0.0)
|
|
29
|
+
Requires-Dist: passlib (>=1.7.4,<2.0.0)
|
|
30
|
+
Requires-Dist: psycopg2-binary (>=2.9.9,<3.0.0)
|
|
31
|
+
Requires-Dist: pyheck (>=0.1.5,<0.2.0)
|
|
32
|
+
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
33
|
+
Requires-Dist: rich (>=13.7.1,<14.0.0)
|
|
34
|
+
Requires-Dist: rich-click (>=1.8.3,<2.0.0)
|
|
35
|
+
Requires-Dist: rodi (>=2.0.6,<3.0.0)
|
|
36
|
+
Requires-Dist: sentry-sdk (>=2.5.1,<3.0.0)
|
|
37
|
+
Requires-Dist: sqlalchemy-utils (>=0.41.1,<0.42.0)
|
|
38
|
+
Requires-Dist: sqlalchemy[asyncio] (>=2.0.30,<3.0.0)
|
|
39
|
+
Requires-Dist: structlog (>=24.2.0,<25.0.0)
|
|
40
|
+
Requires-Dist: svix-ksuid (>=0.6.2,<0.7.0)
|
|
41
|
+
Requires-Dist: watchfiles (>=0.22.0,<0.23.0) ; extra == "dev"
|
|
42
|
+
Requires-Dist: whistle (==2.0.0b1)
|
|
43
|
+
Description-Content-Type: text/x-rst
|
|
44
|
+
|
|
45
|
+
HARP – Harp, an API Runtime Proxy
|
|
46
|
+
=================================
|
|
47
|
+
|
|
48
|
+
HARP is a powerful sidecar proxy service designed to elevate the reliability, performance, security, and observability
|
|
49
|
+
of your application's external API interactions. Think of it as a reverse API gateway or a nearline service mesh for
|
|
50
|
+
external APIs.
|
|
51
|
+
|
|
52
|
+
**HARP is released as an Early Access Preview.**
|
|
53
|
+
|
|
54
|
+
.. image:: https://img.shields.io/pypi/v/harp-proxy.svg
|
|
55
|
+
:target: https://pypi.python.org/pypi/harp-proxy
|
|
56
|
+
:alt: PyPI
|
|
57
|
+
|
|
58
|
+
.. image:: https://www.gitlab.com/makersquad/oss/harp/badges/dev/pipeline.svg
|
|
59
|
+
:target: https://www.gitlab.com/makersquad/oss/harp/pipelines
|
|
60
|
+
:alt: GitLab CI/CD Pipeline Status
|
|
61
|
+
|
|
62
|
+
.. image:: https://readthedocs.org/projects/harp-proxy/badge/?version=latest
|
|
63
|
+
:target: https://harp-proxy.readthedocs.io/
|
|
64
|
+
:alt: Documentation
|
|
65
|
+
|
|
66
|
+
.. image:: https://img.shields.io/pypi/pyversions/harp-proxy.svg
|
|
67
|
+
:target: https://pypi.python.org/pypi/harp-proxy
|
|
68
|
+
:alt: Versions
|
|
69
|
+
|
|
70
|
+
*Although we use HARP for production workloads, it is still under heavy active development and some features
|
|
71
|
+
may not be available, or it may not be suitable for your applications. We are actively looking for feedback, please
|
|
72
|
+
reach out with your thoughts, ideas, rants or issues. We can help.*
|
|
73
|
+
|
|
74
|
+
**Quick links:** `Documentation <https://harp-proxy.readthedocs.io/en/latest/>`_
|
|
75
|
+
| `Getting Started <https://harp-proxy.readthedocs.io/en/latest/start/index.html>`_
|
|
76
|
+
| `Install (Docker) <https://harp-proxy.readthedocs.io/en/latest/start/docker.html>`_
|
|
77
|
+
| `Install (PIP) <https://harp-proxy.readthedocs.io/en/latest/start/python.html>`_
|
|
78
|
+
| `Repository (Git) <https://github.com/msqd/harp>`_
|
|
79
|
+
| `Issues <https://github.com/msqd/harp/issues>`_
|
|
80
|
+
| `CI/CD <https://gitlab.com/makersquad/oss/harp/-/pipelines>`_
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
How it works?
|
|
84
|
+
:::::::::::::
|
|
85
|
+
|
|
86
|
+
Overview
|
|
87
|
+
--------
|
|
88
|
+
|
|
89
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-Overview.png
|
|
90
|
+
:alt: An overview of how HARP works in your system
|
|
91
|
+
:align: center
|
|
92
|
+
|
|
93
|
+
* **Easy Integration:** Integrating with your application is a breeze, because it speaks the same language you already
|
|
94
|
+
use: HTTP. Simply run the proxy, update your API endpoints, and you're ready to go. No complex setup or extensive
|
|
95
|
+
configuration required. Of course, everything is modular and configurable, so you'll be able to fine-tune for your
|
|
96
|
+
taste later.
|
|
97
|
+
* **Reduced Network Distance:** As a *nearline* proxy, HARP minimizes the network distance between your application
|
|
98
|
+
and external services, when possible, using standard techniques like caching or prefetching. This leads to faster
|
|
99
|
+
response times and improved overall performance of your application, even before any configuration is done.
|
|
100
|
+
* **Simplified Development:** HARP eliminates the need for writing extensive code for functionalities such as caching,
|
|
101
|
+
monitoring, alerting, rate limiting, circuit breaking, retries, tracing, logging, and more. These features can be
|
|
102
|
+
easily delegated to the proxy, reducing the amount of code you need to write and maintain.
|
|
103
|
+
* **Seamless HTTP Integration:** HARP seamlessly integrates with your application using the HTTP protocol. This means
|
|
104
|
+
that the integration or removal cost is virtually zero, or even negative when considering the reduction in code you
|
|
105
|
+
won't need to write.
|
|
106
|
+
|
|
107
|
+
`Read the full documentation <https://harp-proxy.readthedocs.io/en/latest/>`_
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
Hub to external services
|
|
111
|
+
------------------------
|
|
112
|
+
|
|
113
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-OverviewMultipleApps.png
|
|
114
|
+
:alt: An overview of how HARP works in your system when you have multiple consumers
|
|
115
|
+
:align: center
|
|
116
|
+
|
|
117
|
+
* **Mutualize Client Logic**: Having n API consumers does not mean you have to implement n times each client-side
|
|
118
|
+
feature. Use HARP as a hub and greatly reduce the amount of client code you need to write and maintain.
|
|
119
|
+
* **Observes and Controls**: You get a central place to observe and control all your API interactions.
|
|
120
|
+
* **Grow and Scale**: As your company grows and develop new applications, you can leverage the work done on existing
|
|
121
|
+
external services without having to write a single new line of code.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
Service
|
|
125
|
+
-------
|
|
126
|
+
|
|
127
|
+
Within the service, harp runs one or more proxies, each one listening to one port to instrument your external API calls
|
|
128
|
+
with the features you need (auditing, caching, alerting, circuit breaker switch, health checks, etc.).
|
|
129
|
+
|
|
130
|
+
Each proxy is configured to intercept and forward requests to a specific external API, with independent configuration.
|
|
131
|
+
|
|
132
|
+
An additional (optional) port serves a dashboard to observe your proxies in real-time.
|
|
133
|
+
|
|
134
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-Service.png
|
|
135
|
+
:alt: What happens within the harp service
|
|
136
|
+
:align: center
|
|
137
|
+
|
|
138
|
+
* **Features**: Harp comes builtin with a set of industry-standard client side features that you can leverage with a few
|
|
139
|
+
lines of configuration.
|
|
140
|
+
* **Flexibility**: Each feature is optional, and it's up to you to chose the setup that fits your needs.
|
|
141
|
+
* **Customizable**: You can write code to extend the proxy features, using the same interface as all the builtin
|
|
142
|
+
features. It guarantees that you can basically implement pretty much anything that make sense inbetween your
|
|
143
|
+
applications and the external services.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
Proxy
|
|
147
|
+
-----
|
|
148
|
+
|
|
149
|
+
As an HTTP Proxy, HARP does not change anything to the way you communicate with the external services. You were speaking
|
|
150
|
+
HTTP before, you will still speak HTTP. The only change needed in your applications configuration to plug or unplug HARP
|
|
151
|
+
is the base endpoint of the external services. In a modern 12factor-like application, it usually only means changing an
|
|
152
|
+
environment variable.
|
|
153
|
+
|
|
154
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-Proxy.png
|
|
155
|
+
:alt: What happens within one harp proxy
|
|
156
|
+
:align: center
|
|
157
|
+
|
|
158
|
+
* **Reversibility**: By requiring 0 code change on your application side (except endpoint url configuration, that
|
|
159
|
+
should be outside the code if you follow the 12factor principles), HARP can be plugged and unplugged at a very low
|
|
160
|
+
cost. You have absolutely no vendor lock-in.
|
|
161
|
+
* **Sidecar**: Harp runs in your infrastructure, implementing the client side features right next to your application.
|
|
162
|
+
The service is fast, and the minimum network distance between your application and the proxy makes it even faster.
|
|
163
|
+
* **Open Core**: Harp is an open software. The core and reference implementation of the proxy is open source, and you
|
|
164
|
+
can extend it to fit your needs.
|
|
165
|
+
|
|
166
|
+
Proxy features
|
|
167
|
+
--------------
|
|
168
|
+
|
|
169
|
+
.. note:: (TODO) Add a list of features with links to the documentation.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
Credits
|
|
173
|
+
:::::::
|
|
174
|
+
|
|
175
|
+
* Core contributors:
|
|
176
|
+
|
|
177
|
+
- `Arthur Degonde <https://github.com/ArthurD1>`_
|
|
178
|
+
- `Romain Dorgueil <https://github.com/hartym>`_
|
|
179
|
+
|
|
180
|
+
* Original idea, design, and development:
|
|
181
|
+
|
|
182
|
+
- `Romain Dorgueil <https://github.com/hartym>`_
|
|
183
|
+
|
|
184
|
+
* Sponsored by `Makersquad <https://www.makersquad.fr/>`_
|
|
185
|
+
|
|
186
|
+
`There are many ways you can contribute to HARP! <https://harp-proxy.readthedocs.io/en/latest/contribute/>`_
|
|
187
|
+
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
HARP – Harp, an API Runtime Proxy
|
|
2
|
+
=================================
|
|
3
|
+
|
|
4
|
+
HARP is a powerful sidecar proxy service designed to elevate the reliability, performance, security, and observability
|
|
5
|
+
of your application's external API interactions. Think of it as a reverse API gateway or a nearline service mesh for
|
|
6
|
+
external APIs.
|
|
7
|
+
|
|
8
|
+
**HARP is released as an Early Access Preview.**
|
|
9
|
+
|
|
10
|
+
.. image:: https://img.shields.io/pypi/v/harp-proxy.svg
|
|
11
|
+
:target: https://pypi.python.org/pypi/harp-proxy
|
|
12
|
+
:alt: PyPI
|
|
13
|
+
|
|
14
|
+
.. image:: https://www.gitlab.com/makersquad/oss/harp/badges/dev/pipeline.svg
|
|
15
|
+
:target: https://www.gitlab.com/makersquad/oss/harp/pipelines
|
|
16
|
+
:alt: GitLab CI/CD Pipeline Status
|
|
17
|
+
|
|
18
|
+
.. image:: https://readthedocs.org/projects/harp-proxy/badge/?version=latest
|
|
19
|
+
:target: https://harp-proxy.readthedocs.io/
|
|
20
|
+
:alt: Documentation
|
|
21
|
+
|
|
22
|
+
.. image:: https://img.shields.io/pypi/pyversions/harp-proxy.svg
|
|
23
|
+
:target: https://pypi.python.org/pypi/harp-proxy
|
|
24
|
+
:alt: Versions
|
|
25
|
+
|
|
26
|
+
*Although we use HARP for production workloads, it is still under heavy active development and some features
|
|
27
|
+
may not be available, or it may not be suitable for your applications. We are actively looking for feedback, please
|
|
28
|
+
reach out with your thoughts, ideas, rants or issues. We can help.*
|
|
29
|
+
|
|
30
|
+
**Quick links:** `Documentation <https://harp-proxy.readthedocs.io/en/latest/>`_
|
|
31
|
+
| `Getting Started <https://harp-proxy.readthedocs.io/en/latest/start/index.html>`_
|
|
32
|
+
| `Install (Docker) <https://harp-proxy.readthedocs.io/en/latest/start/docker.html>`_
|
|
33
|
+
| `Install (PIP) <https://harp-proxy.readthedocs.io/en/latest/start/python.html>`_
|
|
34
|
+
| `Repository (Git) <https://github.com/msqd/harp>`_
|
|
35
|
+
| `Issues <https://github.com/msqd/harp/issues>`_
|
|
36
|
+
| `CI/CD <https://gitlab.com/makersquad/oss/harp/-/pipelines>`_
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
How it works?
|
|
40
|
+
:::::::::::::
|
|
41
|
+
|
|
42
|
+
Overview
|
|
43
|
+
--------
|
|
44
|
+
|
|
45
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-Overview.png
|
|
46
|
+
:alt: An overview of how HARP works in your system
|
|
47
|
+
:align: center
|
|
48
|
+
|
|
49
|
+
* **Easy Integration:** Integrating with your application is a breeze, because it speaks the same language you already
|
|
50
|
+
use: HTTP. Simply run the proxy, update your API endpoints, and you're ready to go. No complex setup or extensive
|
|
51
|
+
configuration required. Of course, everything is modular and configurable, so you'll be able to fine-tune for your
|
|
52
|
+
taste later.
|
|
53
|
+
* **Reduced Network Distance:** As a *nearline* proxy, HARP minimizes the network distance between your application
|
|
54
|
+
and external services, when possible, using standard techniques like caching or prefetching. This leads to faster
|
|
55
|
+
response times and improved overall performance of your application, even before any configuration is done.
|
|
56
|
+
* **Simplified Development:** HARP eliminates the need for writing extensive code for functionalities such as caching,
|
|
57
|
+
monitoring, alerting, rate limiting, circuit breaking, retries, tracing, logging, and more. These features can be
|
|
58
|
+
easily delegated to the proxy, reducing the amount of code you need to write and maintain.
|
|
59
|
+
* **Seamless HTTP Integration:** HARP seamlessly integrates with your application using the HTTP protocol. This means
|
|
60
|
+
that the integration or removal cost is virtually zero, or even negative when considering the reduction in code you
|
|
61
|
+
won't need to write.
|
|
62
|
+
|
|
63
|
+
`Read the full documentation <https://harp-proxy.readthedocs.io/en/latest/>`_
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Hub to external services
|
|
67
|
+
------------------------
|
|
68
|
+
|
|
69
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-OverviewMultipleApps.png
|
|
70
|
+
:alt: An overview of how HARP works in your system when you have multiple consumers
|
|
71
|
+
:align: center
|
|
72
|
+
|
|
73
|
+
* **Mutualize Client Logic**: Having n API consumers does not mean you have to implement n times each client-side
|
|
74
|
+
feature. Use HARP as a hub and greatly reduce the amount of client code you need to write and maintain.
|
|
75
|
+
* **Observes and Controls**: You get a central place to observe and control all your API interactions.
|
|
76
|
+
* **Grow and Scale**: As your company grows and develop new applications, you can leverage the work done on existing
|
|
77
|
+
external services without having to write a single new line of code.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
Service
|
|
81
|
+
-------
|
|
82
|
+
|
|
83
|
+
Within the service, harp runs one or more proxies, each one listening to one port to instrument your external API calls
|
|
84
|
+
with the features you need (auditing, caching, alerting, circuit breaker switch, health checks, etc.).
|
|
85
|
+
|
|
86
|
+
Each proxy is configured to intercept and forward requests to a specific external API, with independent configuration.
|
|
87
|
+
|
|
88
|
+
An additional (optional) port serves a dashboard to observe your proxies in real-time.
|
|
89
|
+
|
|
90
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-Service.png
|
|
91
|
+
:alt: What happens within the harp service
|
|
92
|
+
:align: center
|
|
93
|
+
|
|
94
|
+
* **Features**: Harp comes builtin with a set of industry-standard client side features that you can leverage with a few
|
|
95
|
+
lines of configuration.
|
|
96
|
+
* **Flexibility**: Each feature is optional, and it's up to you to chose the setup that fits your needs.
|
|
97
|
+
* **Customizable**: You can write code to extend the proxy features, using the same interface as all the builtin
|
|
98
|
+
features. It guarantees that you can basically implement pretty much anything that make sense inbetween your
|
|
99
|
+
applications and the external services.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Proxy
|
|
103
|
+
-----
|
|
104
|
+
|
|
105
|
+
As an HTTP Proxy, HARP does not change anything to the way you communicate with the external services. You were speaking
|
|
106
|
+
HTTP before, you will still speak HTTP. The only change needed in your applications configuration to plug or unplug HARP
|
|
107
|
+
is the base endpoint of the external services. In a modern 12factor-like application, it usually only means changing an
|
|
108
|
+
environment variable.
|
|
109
|
+
|
|
110
|
+
.. figure:: https://github.com/msqd/harp/raw/dev/docs/images/HowItWorks-Proxy.png
|
|
111
|
+
:alt: What happens within one harp proxy
|
|
112
|
+
:align: center
|
|
113
|
+
|
|
114
|
+
* **Reversibility**: By requiring 0 code change on your application side (except endpoint url configuration, that
|
|
115
|
+
should be outside the code if you follow the 12factor principles), HARP can be plugged and unplugged at a very low
|
|
116
|
+
cost. You have absolutely no vendor lock-in.
|
|
117
|
+
* **Sidecar**: Harp runs in your infrastructure, implementing the client side features right next to your application.
|
|
118
|
+
The service is fast, and the minimum network distance between your application and the proxy makes it even faster.
|
|
119
|
+
* **Open Core**: Harp is an open software. The core and reference implementation of the proxy is open source, and you
|
|
120
|
+
can extend it to fit your needs.
|
|
121
|
+
|
|
122
|
+
Proxy features
|
|
123
|
+
--------------
|
|
124
|
+
|
|
125
|
+
.. note:: (TODO) Add a list of features with links to the documentation.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Credits
|
|
129
|
+
:::::::
|
|
130
|
+
|
|
131
|
+
* Core contributors:
|
|
132
|
+
|
|
133
|
+
- `Arthur Degonde <https://github.com/ArthurD1>`_
|
|
134
|
+
- `Romain Dorgueil <https://github.com/hartym>`_
|
|
135
|
+
|
|
136
|
+
* Original idea, design, and development:
|
|
137
|
+
|
|
138
|
+
- `Romain Dorgueil <https://github.com/hartym>`_
|
|
139
|
+
|
|
140
|
+
* Sponsored by `Makersquad <https://www.makersquad.fr/>`_
|
|
141
|
+
|
|
142
|
+
`There are many ways you can contribute to HARP! <https://harp-proxy.readthedocs.io/en/latest/contribute/>`_
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Dashboard
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
.. toctree::
|
|
5
|
+
:maxdepth: 2
|
|
6
|
+
|
|
7
|
+
tests_unit
|
|
8
|
+
tests_e2e
|
|
9
|
+
|
|
10
|
+
Recipes
|
|
11
|
+
:::::::
|
|
12
|
+
|
|
13
|
+
How to work on interface without the API?
|
|
14
|
+
-----------------------------------------
|
|
15
|
+
|
|
16
|
+
To work on pure interface development, it is often handy to work using the MSW API mocks instead of the real API.
|
|
17
|
+
|
|
18
|
+
To do this, you can run the following command:
|
|
19
|
+
|
|
20
|
+
.. code-block:: bash
|
|
21
|
+
|
|
22
|
+
harp start --mock
|
|
23
|
+
|
|
24
|
+
Caveat: you must use localhost:4080 instead of the ipv6 url.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
End-to-End Tests
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
The :doc:`Dashboard Application </apps/dashboard/index>` uses Playwright for end-to-end testing.
|
|
5
|
+
|
|
6
|
+
Playwright is a Node.js library for automating browser tasks. In our project, we use Playwright for end-to-end (E2E)
|
|
7
|
+
testing. E2E tests simulate real user scenarios by running tests in a real browser environment.
|
|
8
|
+
|
|
9
|
+
Here's an example of a basic Playwright test:
|
|
10
|
+
|
|
11
|
+
.. code-block:: javascript
|
|
12
|
+
|
|
13
|
+
import { test, expect } from '@playwright/test';
|
|
14
|
+
|
|
15
|
+
test('Example test', async ({ page }) => {
|
|
16
|
+
await page.goto('https://example.com');
|
|
17
|
+
const title = await page.title();
|
|
18
|
+
expect(title).toBe('Example Domain');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
To run our E2E tests, we use the command `pnpm run test:browser`. This command starts Playwright, which opens a new
|
|
23
|
+
browser window and runs our E2E tests.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Running E2E Tests
|
|
27
|
+
:::::::::::::::::
|
|
28
|
+
|
|
29
|
+
To run all tests, use the following command in the dashboard application directory:
|
|
30
|
+
|
|
31
|
+
.. code-block:: bash
|
|
32
|
+
|
|
33
|
+
pnpm test
|
|
34
|
+
|
|
35
|
+
This will also include the :doc:`unit tests <./tests_unit>`. If you only want to run the browser tests, use the
|
|
36
|
+
following command:
|
|
37
|
+
|
|
38
|
+
.. code-block:: bash
|
|
39
|
+
|
|
40
|
+
pnpm test:browser
|
|
41
|
+
|
|
42
|
+
We can also run a single test file by specifying the file path as an argument to the `test` command:
|
|
43
|
+
|
|
44
|
+
.. code-block:: bash
|
|
45
|
+
|
|
46
|
+
pnpm run test:browser transactions.spec.ts
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Writing E2E Tests
|
|
50
|
+
:::::::::::::::::
|
|
51
|
+
|
|
52
|
+
We use Playwright for end-to-end testing to simulate real user interactions with our application.
|
|
53
|
+
|
|
54
|
+
Playwright provides a high-level API to control headless or non-headless browsers, enabling us to automate browser
|
|
55
|
+
tasks and test our application in real-world scenarios.
|
|
56
|
+
|
|
57
|
+
.. code-block:: typescript
|
|
58
|
+
|
|
59
|
+
import { test, expect, request } from "@playwright/test"
|
|
60
|
+
|
|
61
|
+
test.beforeEach(async ({ page }) => {
|
|
62
|
+
await page.goto("/transactions")
|
|
63
|
+
await page.waitForFunction(() => document.body.innerText.includes("Endpoint"))
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test.describe("Transactions Page", () => {
|
|
67
|
+
test("Interacting with the filter side bar", async ({ page }) => {
|
|
68
|
+
const requestMethodButton = await page.$('span:has-text("Request Method")')
|
|
69
|
+
const getLabel = await page.getByLabel("GET")
|
|
70
|
+
expect(getLabel).toBeVisible()
|
|
71
|
+
|
|
72
|
+
await requestMethodButton?.click()
|
|
73
|
+
expect(getLabel).not.toBeVisible()
|
|
74
|
+
|
|
75
|
+
const endpointButton = await page.getByText("Endpoint", { exact: true })
|
|
76
|
+
const endpoint1Label = await page.getByLabel("endpoint1")
|
|
77
|
+
expect(endpoint1Label).toBeVisible()
|
|
78
|
+
|
|
79
|
+
await endpointButton?.click()
|
|
80
|
+
expect(endpoint1Label).not.toBeVisible()
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
In this example, we use Playwright to test the interactions with the filter sidebar on the Transactions page. We
|
|
85
|
+
navigate to the Transactions page before each test and wait for the page to load. In the test, we simulate user
|
|
86
|
+
interactions with the filter sidebar, such as clicking on buttons and checking the visibility of elements. We use
|
|
87
|
+
Playwright's `expect` function to assert the expected outcomes of these interactions.
|
|
88
|
+
|
|
89
|
+
This approach allows us to ensure that our application behaves as expected when users interact with it, providing us
|
|
90
|
+
with confidence in the quality of our application.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
Overriding API Mocks
|
|
94
|
+
--------------------
|
|
95
|
+
|
|
96
|
+
In some cases, we might want to override the default handlers for a single test. We can do this by accessing the
|
|
97
|
+
`worker` object on the `window` object and calling its `use` method with a new handler.
|
|
98
|
+
|
|
99
|
+
.. code-block:: typescript
|
|
100
|
+
|
|
101
|
+
test("Override msw worker for system dependencies", async ({ page }) => {
|
|
102
|
+
// Test setup code here...
|
|
103
|
+
|
|
104
|
+
await page.evaluate(() => {
|
|
105
|
+
const { worker, http, HttpResponse } = window.msw
|
|
106
|
+
worker.use(
|
|
107
|
+
http.get("/api/system/dependencies", function override() {
|
|
108
|
+
return HttpResponse.json({ python: ["pydantic", "tensorflow"] })
|
|
109
|
+
}),
|
|
110
|
+
)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// Test code here...
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
In this test, we override the handler for GET requests to `/api/system/dependencies` to return a predefined JSON
|
|
117
|
+
response. This allows us to control the data that our application receives from the API in this specific test.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
Implementation details
|
|
121
|
+
::::::::::::::::::::::
|
|
122
|
+
|
|
123
|
+
In our project, we set up the Mock Service Worker (MSW) in development mode to mock API responses. This is done in the
|
|
124
|
+
`main.tsx` file, where we conditionally import the MSW worker and start it if the application is running in development
|
|
125
|
+
mode.
|
|
126
|
+
|
|
127
|
+
.. code-block:: typescript
|
|
128
|
+
|
|
129
|
+
// Enable mocking in development using msw server set up for the browser
|
|
130
|
+
async function enableMocking() {
|
|
131
|
+
if (process.env.NODE_ENV !== "development") {
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const { worker, http, HttpResponse } = await import("./tests/mocks/browser")
|
|
136
|
+
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
// Propagate the worker and `http` references to be globally available.
|
|
139
|
+
// This would allow to modify request handlers on runtime.
|
|
140
|
+
window.msw = {
|
|
141
|
+
worker,
|
|
142
|
+
http,
|
|
143
|
+
HttpResponse,
|
|
144
|
+
}
|
|
145
|
+
return worker.start()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
In this function, we first check if the application is running in development mode. If it is, we dynamically import the
|
|
149
|
+
MSW worker, `http`, and `HttpResponse` from our browser mocks. We then assign these to the `window.msw` object, making
|
|
150
|
+
them globally available. This allows us to modify the request handlers at runtime, which is useful for overriding
|
|
151
|
+
handlers in specific tests. Finally, we start the MSW worker, which begins intercepting network requests according to
|
|
152
|
+
the predefined handlers.
|