diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3df18ff --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish to PyPI + +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install uv + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + + - run: uv build + + - run: uv publish + env: + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b17065b..758cda1 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -3,7 +3,7 @@ # # ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: openapi_client Python package +name: kagi_client Python package on: [push, pull_request] @@ -31,4 +31,4 @@ jobs: pip install -r test-requirements.txt - name: Test with pytest run: | - pytest --cov=openapi_client + pytest --cov=kagi_client diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c03684..729d6cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ stages: script: - pip install -r requirements.txt - pip install -r test-requirements.txt - - pytest --cov=openapi_client + - pytest --cov=kagi_client pytest-3.10: extends: .pytest diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index cce0926..6223f15 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -24,59 +24,39 @@ docs/SearchRequestPersonalizationsRegexesInner.md docs/SearchResult.md docs/SearchResultImage.md git_push.sh -openapi_client/__init__.py -openapi_client/api/__init__.py -openapi_client/api/extract_api.py -openapi_client/api/search_api.py -openapi_client/api_client.py -openapi_client/api_response.py -openapi_client/configuration.py -openapi_client/exceptions.py -openapi_client/models/__init__.py -openapi_client/models/error_detail.py -openapi_client/models/error_envelope.py -openapi_client/models/extract_request.py -openapi_client/models/extract_response.py -openapi_client/models/meta.py -openapi_client/models/page_input.py -openapi_client/models/page_output.py -openapi_client/models/search200_response.py -openapi_client/models/search200_response_data.py -openapi_client/models/search_request.py -openapi_client/models/search_request_extract.py -openapi_client/models/search_request_filters.py -openapi_client/models/search_request_lens.py -openapi_client/models/search_request_personalizations.py -openapi_client/models/search_request_personalizations_domains_inner.py -openapi_client/models/search_request_personalizations_regexes_inner.py -openapi_client/models/search_result.py -openapi_client/models/search_result_image.py -openapi_client/py.typed -openapi_client/rest.py +kagi_client/__init__.py +kagi_client/api/__init__.py +kagi_client/api/extract_api.py +kagi_client/api/search_api.py +kagi_client/api_client.py +kagi_client/api_response.py +kagi_client/configuration.py +kagi_client/exceptions.py +kagi_client/models/__init__.py +kagi_client/models/error_detail.py +kagi_client/models/error_envelope.py +kagi_client/models/extract_request.py +kagi_client/models/extract_response.py +kagi_client/models/meta.py +kagi_client/models/page_input.py +kagi_client/models/page_output.py +kagi_client/models/search200_response.py +kagi_client/models/search200_response_data.py +kagi_client/models/search_request.py +kagi_client/models/search_request_extract.py +kagi_client/models/search_request_filters.py +kagi_client/models/search_request_lens.py +kagi_client/models/search_request_personalizations.py +kagi_client/models/search_request_personalizations_domains_inner.py +kagi_client/models/search_request_personalizations_regexes_inner.py +kagi_client/models/search_result.py +kagi_client/models/search_result_image.py +kagi_client/py.typed +kagi_client/rest.py pyproject.toml requirements.txt setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_error_detail.py -test/test_error_envelope.py -test/test_extract_api.py -test/test_extract_request.py -test/test_extract_response.py -test/test_meta.py -test/test_page_input.py -test/test_page_output.py -test/test_search200_response.py -test/test_search200_response_data.py -test/test_search_api.py -test/test_search_request.py -test/test_search_request_extract.py -test/test_search_request_filters.py -test/test_search_request_lens.py -test/test_search_request_personalizations.py -test/test_search_request_personalizations_domains_inner.py -test/test_search_request_personalizations_regexes_inner.py -test/test_search_result.py -test/test_search_result_image.py tox.ini diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index f7962df..696eaac 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.22.0-SNAPSHOT +7.22.0 diff --git a/.travis.yml b/.travis.yml index a58e1c9..c987764 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,4 @@ install: - "pip install -r requirements.txt" - "pip install -r test-requirements.txt" # command to run tests -script: pytest --cov=openapi_client +script: pytest --cov=kagi_client diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..919bb71 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +SPEC_URL := https://kagi.redocly.app/_spec/openapi.yaml + +generate: + openapi-generator-cli generate \ + -i $(SPEC_URL) \ + -g python \ + -o . \ + -c config.yaml \ + -t templates/ diff --git a/README.md b/README.md index a43f841..326f8f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# openapi-client +# kagi-client The Kagi API provides programmatic access to data that powers our search results & more. Get started on the [API Dashboard](https://kagi.com/api) to set up billing, manage API keys, and more. @@ -40,8 +40,8 @@ Join our [Discord](https://kagi.com/discord)! Good for quick questions or chatti This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1 -- Package version: 1.0.0 -- Generator version: 7.22.0-SNAPSHOT +- Package version: 1.0.0rc3 +- Generator version: 7.22.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://kagi.com/support](https://kagi.com/support) @@ -50,32 +50,31 @@ For more information, please visit [https://kagi.com/support](https://kagi.com/s Python 3.10+ ## Installation & Usage -### pip install - -If the python package is hosted on a repository, you can install directly using: +### PyPI ```sh -pip install git+https://github.com/kagisearch/kagi-openapi-python.git +pip install kagi-client ``` -(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/kagisearch/kagi-openapi-python.git`) + +> **Note:** If you're installing a prerelease version, add the `--pre` flag: +> ```sh +> pip install --pre kagi-client +> ``` Then import the package: ```python -import openapi_client +import kagi_client ``` -### Setuptools - -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). +### From source ```sh -python setup.py install --user +pip install git+https://github.com/kagisearch/kagi-openapi-python.git ``` -(or `sudo python setup.py install` to install the package for all users) Then import the package: ```python -import openapi_client +import kagi_client ``` ### Tests @@ -88,13 +87,13 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python -import openapi_client -from openapi_client.rest import ApiException +import kagi_client +from kagi_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://kagi.com/api/v1 # See configuration.py for a list of all supported configuration parameters. -configuration = openapi_client.Configuration( +configuration = kagi_client.Configuration( host = "https://kagi.com/api/v1" ) @@ -104,15 +103,15 @@ configuration = openapi_client.Configuration( # satisfies your auth use case. # Configure Bearer authorization: kagi -configuration = openapi_client.Configuration( +configuration = kagi_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client -with openapi_client.ApiClient(configuration) as api_client: +with kagi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = openapi_client.ExtractApi(api_client) + api_instance = kagi_client.ExtractApi(api_client) extract_request = {"pages":[{"url":"https://example.com/article1"},{"url":"https://example.com/article2"}],"timeout":1.337,"format":"json"} # ExtractRequest | try: diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..ebf488c --- /dev/null +++ b/config.yaml @@ -0,0 +1,5 @@ +packageName: kagi_client +projectName: kagi-client +packageVersion: 1.0.0rc3 +gitUserId: kagisearch +gitRepoId: kagi-openapi-python diff --git a/docs/ErrorDetail.md b/docs/ErrorDetail.md index e30569a..873cfe3 100644 --- a/docs/ErrorDetail.md +++ b/docs/ErrorDetail.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.error_detail import ErrorDetail +from kagi_client.models.error_detail import ErrorDetail # TODO update the JSON string below json = "{}" diff --git a/docs/ErrorEnvelope.md b/docs/ErrorEnvelope.md index ef70c67..cd2426e 100644 --- a/docs/ErrorEnvelope.md +++ b/docs/ErrorEnvelope.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.error_envelope import ErrorEnvelope +from kagi_client.models.error_envelope import ErrorEnvelope # TODO update the JSON string below json = "{}" diff --git a/docs/ExtractApi.md b/docs/ExtractApi.md index 6427b27..164c7d6 100644 --- a/docs/ExtractApi.md +++ b/docs/ExtractApi.md @@ -1,4 +1,4 @@ -# openapi_client.ExtractApi +# kagi_client.ExtractApi All URIs are relative to *https://kagi.com/api/v1* @@ -21,15 +21,15 @@ and the extracted content is returned in the response. * Bearer Authentication (kagi): ```python -import openapi_client -from openapi_client.models.extract_request import ExtractRequest -from openapi_client.models.extract_response import ExtractResponse -from openapi_client.rest import ApiException +import kagi_client +from kagi_client.models.extract_request import ExtractRequest +from kagi_client.models.extract_response import ExtractResponse +from kagi_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://kagi.com/api/v1 # See configuration.py for a list of all supported configuration parameters. -configuration = openapi_client.Configuration( +configuration = kagi_client.Configuration( host = "https://kagi.com/api/v1" ) @@ -39,14 +39,14 @@ configuration = openapi_client.Configuration( # satisfies your auth use case. # Configure Bearer authorization: kagi -configuration = openapi_client.Configuration( +configuration = kagi_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client -with openapi_client.ApiClient(configuration) as api_client: +with kagi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = openapi_client.ExtractApi(api_client) + api_instance = kagi_client.ExtractApi(api_client) extract_request = {"pages":[{"url":"https://example.com/article1"},{"url":"https://example.com/article2"}],"timeout":1.337,"format":"json"} # ExtractRequest | try: diff --git a/docs/ExtractRequest.md b/docs/ExtractRequest.md index 378f5bc..f1f3b18 100644 --- a/docs/ExtractRequest.md +++ b/docs/ExtractRequest.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.extract_request import ExtractRequest +from kagi_client.models.extract_request import ExtractRequest # TODO update the JSON string below json = "{}" diff --git a/docs/ExtractResponse.md b/docs/ExtractResponse.md index 3b80b81..a0c735b 100644 --- a/docs/ExtractResponse.md +++ b/docs/ExtractResponse.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.extract_response import ExtractResponse +from kagi_client.models.extract_response import ExtractResponse # TODO update the JSON string below json = "{}" diff --git a/docs/Meta.md b/docs/Meta.md index 301ec2b..1971339 100644 --- a/docs/Meta.md +++ b/docs/Meta.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.meta import Meta +from kagi_client.models.meta import Meta # TODO update the JSON string below json = "{}" diff --git a/docs/PageInput.md b/docs/PageInput.md index 8ea05c5..9d658b0 100644 --- a/docs/PageInput.md +++ b/docs/PageInput.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.page_input import PageInput +from kagi_client.models.page_input import PageInput # TODO update the JSON string below json = "{}" diff --git a/docs/PageOutput.md b/docs/PageOutput.md index b6e41ea..574028c 100644 --- a/docs/PageOutput.md +++ b/docs/PageOutput.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.page_output import PageOutput +from kagi_client.models.page_output import PageOutput # TODO update the JSON string below json = "{}" diff --git a/docs/Search200Response.md b/docs/Search200Response.md index 8c4fa09..907aada 100644 --- a/docs/Search200Response.md +++ b/docs/Search200Response.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search200_response import Search200Response +from kagi_client.models.search200_response import Search200Response # TODO update the JSON string below json = "{}" diff --git a/docs/Search200ResponseData.md b/docs/Search200ResponseData.md index 576bf08..248902c 100644 --- a/docs/Search200ResponseData.md +++ b/docs/Search200ResponseData.md @@ -28,7 +28,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search200_response_data import Search200ResponseData +from kagi_client.models.search200_response_data import Search200ResponseData # TODO update the JSON string below json = "{}" diff --git a/docs/SearchApi.md b/docs/SearchApi.md index 80e25ec..3bf4544 100644 --- a/docs/SearchApi.md +++ b/docs/SearchApi.md @@ -1,4 +1,4 @@ -# openapi_client.SearchApi +# kagi_client.SearchApi All URIs are relative to *https://kagi.com/api/v1* @@ -17,15 +17,15 @@ Perform a web search * Bearer Authentication (kagi): ```python -import openapi_client -from openapi_client.models.search200_response import Search200Response -from openapi_client.models.search_request import SearchRequest -from openapi_client.rest import ApiException +import kagi_client +from kagi_client.models.search200_response import Search200Response +from kagi_client.models.search_request import SearchRequest +from kagi_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://kagi.com/api/v1 # See configuration.py for a list of all supported configuration parameters. -configuration = openapi_client.Configuration( +configuration = kagi_client.Configuration( host = "https://kagi.com/api/v1" ) @@ -35,14 +35,14 @@ configuration = openapi_client.Configuration( # satisfies your auth use case. # Configure Bearer authorization: kagi -configuration = openapi_client.Configuration( +configuration = kagi_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client -with openapi_client.ApiClient(configuration) as api_client: +with kagi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = openapi_client.SearchApi(api_client) + api_instance = kagi_client.SearchApi(api_client) search_request = {"query":"steve jobs","workflow":"search"} # SearchRequest | try: diff --git a/docs/SearchRequest.md b/docs/SearchRequest.md index dc7ba55..df5c8b3 100644 --- a/docs/SearchRequest.md +++ b/docs/SearchRequest.md @@ -22,7 +22,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request import SearchRequest +from kagi_client.models.search_request import SearchRequest # TODO update the JSON string below json = "{}" diff --git a/docs/SearchRequestExtract.md b/docs/SearchRequestExtract.md index 756b8eb..a46d3ec 100644 --- a/docs/SearchRequestExtract.md +++ b/docs/SearchRequestExtract.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request_extract import SearchRequestExtract +from kagi_client.models.search_request_extract import SearchRequestExtract # TODO update the JSON string below json = "{}" diff --git a/docs/SearchRequestFilters.md b/docs/SearchRequestFilters.md index 28f38be..7784fb6 100644 --- a/docs/SearchRequestFilters.md +++ b/docs/SearchRequestFilters.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request_filters import SearchRequestFilters +from kagi_client.models.search_request_filters import SearchRequestFilters # TODO update the JSON string below json = "{}" diff --git a/docs/SearchRequestLens.md b/docs/SearchRequestLens.md index 5641b53..2668bde 100644 --- a/docs/SearchRequestLens.md +++ b/docs/SearchRequestLens.md @@ -19,7 +19,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request_lens import SearchRequestLens +from kagi_client.models.search_request_lens import SearchRequestLens # TODO update the JSON string below json = "{}" diff --git a/docs/SearchRequestPersonalizations.md b/docs/SearchRequestPersonalizations.md index 80b221c..997a368 100644 --- a/docs/SearchRequestPersonalizations.md +++ b/docs/SearchRequestPersonalizations.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request_personalizations import SearchRequestPersonalizations +from kagi_client.models.search_request_personalizations import SearchRequestPersonalizations # TODO update the JSON string below json = "{}" diff --git a/docs/SearchRequestPersonalizationsDomainsInner.md b/docs/SearchRequestPersonalizationsDomainsInner.md index 5459186..d4d6c0c 100644 --- a/docs/SearchRequestPersonalizationsDomainsInner.md +++ b/docs/SearchRequestPersonalizationsDomainsInner.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request_personalizations_domains_inner import SearchRequestPersonalizationsDomainsInner +from kagi_client.models.search_request_personalizations_domains_inner import SearchRequestPersonalizationsDomainsInner # TODO update the JSON string below json = "{}" diff --git a/docs/SearchRequestPersonalizationsRegexesInner.md b/docs/SearchRequestPersonalizationsRegexesInner.md index a9d4806..436a6bf 100644 --- a/docs/SearchRequestPersonalizationsRegexesInner.md +++ b/docs/SearchRequestPersonalizationsRegexesInner.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_request_personalizations_regexes_inner import SearchRequestPersonalizationsRegexesInner +from kagi_client.models.search_request_personalizations_regexes_inner import SearchRequestPersonalizationsRegexesInner # TODO update the JSON string below json = "{}" diff --git a/docs/SearchResult.md b/docs/SearchResult.md index 6a900f2..38f0f5d 100644 --- a/docs/SearchResult.md +++ b/docs/SearchResult.md @@ -16,7 +16,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_result import SearchResult +from kagi_client.models.search_result import SearchResult # TODO update the JSON string below json = "{}" diff --git a/docs/SearchResultImage.md b/docs/SearchResultImage.md index 9081c96..d9db306 100644 --- a/docs/SearchResultImage.md +++ b/docs/SearchResultImage.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes ## Example ```python -from openapi_client.models.search_result_image import SearchResultImage +from kagi_client.models.search_result_image import SearchResultImage # TODO update the JSON string below json = "{}" diff --git a/pyproject.toml b/pyproject.toml index 8dc4c4d..aa566fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] -name = "openapi_client" -version = "1.0.0" +name = "kagi_client" +version = "1.0.0rc3" description = "Kagi API" authors = [ {name = "API Support",email = "support@kagi.com"}, @@ -41,7 +41,7 @@ extension-pkg-whitelist = "pydantic" [tool.mypy] files = [ - "openapi_client", + "kagi_client", #"test", # auto-generated tests "tests", # hand-written tests ] @@ -79,7 +79,7 @@ disallow_any_generics = true [[tool.mypy.overrides]] module = [ - "openapi_client.configuration", + "kagi_client.configuration", ] warn_unused_ignores = true strict_equality = true diff --git a/setup.py b/setup.py index c018b0b..6754a6b 100644 --- a/setup.py +++ b/setup.py @@ -19,8 +19,8 @@ # # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -NAME = "openapi-client" -VERSION = "1.0.0" +NAME = "kagi-client" +VERSION = "1.0.0rc3" PYTHON_REQUIRES = ">= 3.10" REQUIRES = [ "urllib3 >= 2.1.0, < 3.0.0", @@ -45,5 +45,5 @@ long_description="""\ The Kagi API provides programmatic access to data that powers our search results & more. Get started on the [API Dashboard](https://kagi.com/api) to set up billing, manage API keys, and more. ### Official Client Libraries We offer the following libraries you can use to interact with the Kagi API. These are generated from an OpenAPI spec. If you have a language you would like to use and it's not in the list, send us a message and we will add it to the list if it is supported. Or you can use the [spec](https://kagi.redocly.app/_spec/openapi.yaml?download) to build your own custom library. - [Golang](https://github.com/kagisearch/kagi-openapi-golang) - [Python](https://github.com/kagisearch/kagi-openapi-python) - [TypeScript](https://github.com/kagisearch/kagi-openapi-typescript) - [Rust](https://github.com/kagisearch/kagi-openapi-rust) ### API Status **The v1 API is currently in preview to early access testers.** Our existing API, the \"v0\" beta API, is being replaced with a new version that will be available publicly soon. As changes are made, we will be updating the documentation below when the new features become available. See the [Support and Community](https://help.kagi.com/kagi/support-and-community/) section for details. ### Pricing See our [API Pricing](https://kagi.com/api/pricing) page for standard rates. ### GitHub Discussions This is the preferred venue for bug reports and feature requests. - [Bug Reports](https://github.com/kagisearch/kagi-docs/issues/new/choose) - [Q&A Forum](https://github.com/kagisearch/kagi-docs/discussions/categories/q-a?discussions_q=category%3AQ%26A+label%3Aproduct%3Akagi_search_api) - [API Feature Requests](https://github.com/kagisearch/kagi-docs/discussions/categories/kagi-search-api-feature-requests-ideas) ### Discord Join our [Discord](https://kagi.com/discord)! Good for quick questions or chatting about things you've made with our APIs! """, # noqa: E501 - package_data={"openapi_client": ["py.typed"]}, + package_data={"kagi_client": ["py.typed"]}, ) diff --git a/tox.ini b/tox.ini index 1a9028b..6dd08b5 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=openapi_client + pytest --cov=kagi_client