Skip to content

Commit 28268b2

Browse files
committed
Remove legacy autocompletion with Kibana spec
1 parent aa79e80 commit 28268b2

14 files changed

Lines changed: 36 additions & 1931 deletions

File tree

HISTORY.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
History
33
=======
44

5+
0.3.0 (unreleased)
6+
------------------
7+
8+
* Drop legacy Kibana autocompletion support
9+
* Drop Python 3.8 and 3.9 support
10+
* Support Python 3.11 to 3.14
11+
512
0.2.2 (2021-02-28)
613
------------------
714

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ get-specs:
3030
mkdir -p peek/specs
3131
curl -L https://raw.githubusercontent.com/elastic/elasticsearch-specification/8.2/output/schema/schema.json -o peek/specs/schema.json
3232

33-
get-specs-legacy:
34-
rm -rf $$TMPDIR/kibana-7.8.1.zip
35-
curl -L https://github.com/elastic/kibana/archive/v7.8.1.zip -o $$TMPDIR/kibana-7.8.1.zip
36-
mkdir -p peek/specs
37-
unzip -o $$TMPDIR/kibana-7.8.1.zip -d peek/specs '*/lib/spec_definitions/j*'
38-
rm -rf $$TMPDIR/kibana-7.8.1.zip
39-
4033
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
4134

4235
clean-build: ## remove build artifacts

docs/usage.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,6 @@ Peek however does not ship with the spec file. Use the builtin function, ``_down
141141
to download and initialize the spec file from its GitHub official repository.
142142
The spec file is saved in Peek's config folder so you only need to run the function once.
143143

144-
Legacy auto-completion with Kibana spec files
145-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146-
Prior to v0.3.0, autocompletion uses API spec files published by the
147-
`Kibana project <https://github.com/elastic/kibana>`_. This is disabled by default.
148-
It can still be enabled (*NOT recommended*) by setting
149-
``prefer_elasticsearch_specification = False``. This also changes the behaviour of
150-
``_download_api_specs`` to download Kibana spec files instead.
151-
152-
153144
Functions
154145
---------
155146

peek/completer.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -149,35 +149,18 @@ def init_api_completer(self):
149149
from peek import __file__ as package_root
150150

151151
package_root = os.path.dirname(package_root)
152-
if self.app.config.as_bool('prefer_elasticsearch_specification'):
153-
_logger.info('Use elasticsearch-specification schema for autocompletion')
154-
from peek.es_api_spec.api_completer import SchemaESApiCompleter
155-
156-
schema_filepath = os.path.join(config_location(), 'schema.json')
157-
if not os.path.exists(schema_filepath):
158-
schema_filepath = os.path.join(package_root, 'specs', 'schema.json')
159-
if os.path.exists(schema_filepath):
160-
return SchemaESApiCompleter(schema_filepath)
161-
else:
162-
from peek.es_api_spec.api_completer import NoopESApiCompleter
163-
164-
return NoopESApiCompleter()
152+
_logger.info('Use elasticsearch-specification schema for autocompletion')
153+
from peek.es_api_spec.api_completer import SchemaESApiCompleter
154+
155+
schema_filepath = os.path.join(config_location(), 'schema.json')
156+
if not os.path.exists(schema_filepath):
157+
schema_filepath = os.path.join(package_root, 'specs', 'schema.json')
158+
if os.path.exists(schema_filepath):
159+
return SchemaESApiCompleter(schema_filepath)
165160
else:
166-
kibana_dir = self.app.config['kibana_dir']
167-
if not kibana_dir:
168-
config_dir = config_location()
169-
if os.path.exists(config_dir):
170-
kibana_dirs = [
171-
os.path.join(config_dir, d) for d in os.listdir(config_dir) if d.startswith('kibana-')
172-
]
173-
if kibana_dirs:
174-
kibana_dir = kibana_dirs[0]
175-
if not kibana_dir:
176-
kibana_dir = os.path.join(package_root, 'specs', 'kibana-7.8.1')
177-
_logger.info(f'Attempt to build Elasticsearch API specs from: {kibana_dir}')
178-
from peek.es_api_spec.kspec import KibanaSpecESApiCompleter
179-
180-
return KibanaSpecESApiCompleter(self.app, kibana_dir)
161+
from peek.es_api_spec.api_completer import NoopESApiCompleter
162+
163+
return NoopESApiCompleter()
181164

182165
def get_completions(self, document: Document, complete_event: CompleteEvent) -> Iterable[Completion]:
183166
_logger.debug(f'Document: {document}, Event: {complete_event}')

0 commit comments

Comments
 (0)