diff --git a/.github/Dockerfile b/.github/Dockerfile index 039d691..a914e9b 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -4,7 +4,7 @@ FROM python:${PYTHON_VERSION} WORKDIR /code/elasticsearch-serverless-python RUN mkdir -p /code/elasticsearch-serverless-python/build -COPY pyproject.toml README.rst . +COPY pyproject.toml README.md . RUN python -m pip install \ -U --no-cache-dir \ --disable-pip-version-check \ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5cfd15a..a311242 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,10 +34,8 @@ jobs: - name: "Check packages" run: | - python -m pip install -U pip setuptools wheel build twine rstcheck + python -m pip install -U pip setuptools wheel build twine python -m build - # Our Python example shows a REPL and is not valid Python - rstcheck --ignore-languages python README.rst python -m twine check dist/* docs: diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b121fc --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# Elasticsearch Serverless Python Client + +

+ PyPI Version + Python Versions + Downloads + Documentation Status +

+ +> [!WARNING] +> Starting with the release of the Elastic Stack 9.0.0, this client will be discontinued. Instead, you can use the latest version of the [Elasticsearch Python Client](https://github.com/elastic/elasticsearch-py) to build your Elasticsearch Serverless Python applications. + +## Features + +* Translating basic Python data types to and from JSON +* Configurable automatic discovery of cluster nodes +* Persistent connections +* Load balancing (with pluggable selection strategy) across available nodes +* Failed connection penalization (time based - failed connections won't be + retried until a timeout is reached) +* Support for TLS and HTTP authentication +* Thread safety across requests +* Pluggable architecture +* Helper functions for idiomatically using APIs together + +## Quick Start + + +```python +# Import the client from the 'elasticsearch' module +# Import the client from the 'elasticsearch' module +>>> from elasticsearch_serverless import Elasticsearch + +# Instantiate a client instance +>>> client = Elasticsearch("http://localhost:9200") + +# Call an API, in this example `info()` +>>> resp = client.info() + +# View the result +>>> resp +{ +"name" : "instance-name", +"cluster_name" : "cluster-name", +"cluster_uuid" : "cluster-uuid", +"version" : { + "number" : "7.14.0", + ... +}, +"tagline" : "You know, for Search" +} +``` + +## License + +This software is licensed under the [Apache License 2.0](./LICENSE). See [NOTICE](./NOTICE). diff --git a/README.rst b/README.rst deleted file mode 100644 index 7bffe47..0000000 --- a/README.rst +++ /dev/null @@ -1,103 +0,0 @@ -Elasticsearch Serverless Python Client -====================================== - -.. image:: https://img.shields.io/pypi/v/elasticsearch-serverless - :target: https://pypi.org/project/elasticsearch-serverless - -.. image:: https://img.shields.io/conda/vn/conda-forge/elasticsearch-serverless?color=blue - :target: https://anaconda.org/conda-forge/elasticsearch-serverless - -.. image:: https://static.pepy.tech/badge/elasticsearch-serverless - :target: https://pepy.tech/project/elasticsearch-serverless?versions=* - -.. image:: https://clients-ci.elastic.co/job/elastic+elasticsearch-serverless-python+main/badge/icon - :target: https://clients-ci.elastic.co/job/elastic+elasticsearch-serverless-python+main - -.. image:: https://readthedocs.org/projects/elasticsearch-serverless-python/badge/?version=latest&style=flat - :target: https://elasticsearch-serverless-python.readthedocs.io - -*The official Python client for Elasticsearch Serverless.* - - -Features --------- - -* Translating basic Python data types to and from JSON -* Configurable automatic discovery of cluster nodes -* Persistent connections -* Load balancing (with pluggable selection strategy) across available nodes -* Failed connection penalization (time based - failed connections won't be - retried until a timeout is reached) -* Support for TLS and HTTP authentication -* Thread safety across requests -* Pluggable architecture -* Helper functions for idiomatically using APIs together - - -Installation ------------- - -Install the ``elasticsearch-serverless`` package with `pip -`_:: - - $ python -m pip install elasticsearch-serverless - -If your application uses async/await in Python you can install with -the ``async`` extra:: - - $ python -m pip install elasticsearch-serverless[async] - -Read more about `how to use asyncio with this project `_. - - -Compatibility -------------- - -TODO - - -Documentation -------------- - -Documentation for the client is `available on elastic.co`_ and `Read the Docs`_. - -.. _available on elastic.co: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/index.html -.. _Read the Docs: https://elasticsearch-serverless-python.readthedocs.io - -Quick Start ------------ - -.. code-block:: python - - # Import the client from the 'elasticsearch' module - >>> from elasticsearch_serverless import Elasticsearch - - # Instantiate a client instance - >>> client = Elasticsearch("http://localhost:9200") - - # Call an API, in this example `info()` - >>> resp = client.info() - - # View the result - >>> resp - { - "name" : "instance-name", - "cluster_name" : "cluster-name", - "cluster_uuid" : "cluster-uuid", - "version" : { - "number" : "7.14.0", - ... - }, - "tagline" : "You know, for Search" - } - - -You can read more about `configuring the client`_ in the documentation. - -.. _configuring the client: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/connecting.html - - -License -------- - -Copyright 2023 Elasticsearch B.V. Licensed under the Apache License, Version 2.0. diff --git a/catalog-info.yaml b/catalog-info.yaml index 347e0ee..10cba24 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -39,8 +39,4 @@ spec: provider_settings: build_pull_requests: true build_branches: true - cancel_intermediate_builds: false - schedules: - main_daily: - branch: 'main' - cronline: '0 2 * * *' + cancel_intermediate_builds: false \ No newline at end of file diff --git a/elasticsearch_serverless/__init__.py b/elasticsearch_serverless/__init__.py index 723b3a2..447c8f5 100644 --- a/elasticsearch_serverless/__init__.py +++ b/elasticsearch_serverless/__init__.py @@ -42,6 +42,14 @@ logger = logging.getLogger("elasticsearch") logger.addHandler(logging.NullHandler()) +warnings.warn( + "elasticsearch-serverless is deprecated and will be discontinued with the 9.0.0 release of the Elastic Stack. " + "Please migrate to the official elasticsearch-py package for continued support and improved features: " + "https://github.com/elastic/elasticsearch-py", + category=DeprecationWarning, + stacklevel=2, +) + from ._async.client import AsyncElasticsearch as AsyncElasticsearch from ._sync.client import Elasticsearch as Elasticsearch from .exceptions import ElasticsearchDeprecationWarning # noqa: F401 diff --git a/pyproject.toml b/pyproject.toml index fcb886c..5c8084d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" name = "elasticsearch-serverless" version = "0.7.0.20231031" description = "Python client for Elasticsearch Serverless" -readme = "README.rst" +readme = "README.md" license = "Apache-2.0" requires-python = ">=3.9" authors = [ @@ -90,7 +90,7 @@ include = [ "/CONTRIBUTING.md", "/LICENSE", "/NOTICE", - "/README.rst", + "/README.md", "/setup.cfg", "/docs/sphinx", ]