Skip to content

Commit

Permalink
Merge commit '5eb3c20c3d98e0563a00dcf632e42baa7ee81c15'
Browse files Browse the repository at this point in the history
* commit '5eb3c20c3d98e0563a00dcf632e42baa7ee81c15':
  chore: replace references to Lyft with Amundsen (amundsen-io#133)
  chore: fix docker push action (amundsen-io#132)
  chore: add docker publish action and remove travis (amundsen-io#131)
  chore: add pypi publish action (amundsen-io#130)
  ci: add dependabot config (amundsen-io#128)
  chore: apply license headers to all the source files (amundsen-io#116)
  chore: update the email for the project (amundsen-io#114)

# Conflicts:
#	README.md
#	setup.py
  • Loading branch information
Jerry Zhu committed Aug 20, 2020
2 parents 2c95475 + 5eb3c20 commit a42d89c
Show file tree
Hide file tree
Showing 52 changed files with 221 additions and 41 deletions.
5 changes: 5 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 1
update_configs:
- package_manager: "python"
directory: "/"
update_schedule: "monthly"
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

on: pull_request
jobs:
pre-commit:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
test-unit:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: ['3.6.x', '3.7.x']
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip3 install -r requirements.txt && pip3 install .[all] && pip3 install codecov
- name: Run python unit tests
run: make test
40 changes: 40 additions & 0 deletions .github/workflows/pypipublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

name: Build and Deploy
on:
push:
branches:
- master
tags:
- '*'
jobs:
build-and-publish-python-module:
name: Build and publish python module to pypi
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Add wheel dependency
run: pip install wheel
- name: Generate dist
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
build-and-publish-docker-image:
name: Build and publish docker image
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login with docker
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Publish to Registry
if: success()
run: make build-push-image
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This project is governed by [Lyft's code of conduct](https://github.com/lyft/code-of-conduct).
This project is governed by [Amundsen's code of conduct](https://github.com/amundsen-io/amundsen/blob/master/CODE_OF_CONDUCT.md).
All contributors and participants agree to abide by its terms.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

Amundsen Search service serves a Restful API and is responsible for searching metadata. The service leverages [Elasticsearch](https://www.elastic.co/products/elasticsearch "Elasticsearch") for most of it's search capabilites.

For information about Amundsen and our other services, visit the [main repository](https://github.com/lyft/amundsen#amundsen) `README.md`. Please also see our instructions for a [quick start](https://github.com/lyft/amundsen/blob/master/docs/installation.md#bootstrap-a-default-version-of-amundsen-using-docker) setup of Amundsen with dummy data, and an [overview of the architecture](https://github.com/lyft/amundsen/blob/master/docs/architecture.md#architecture).
For information about Amundsen and our other services, visit the [main repository](https://github.com/amundsen-io/amundsen#amundsen) `README.md`. Please also see our instructions for a [quick start](https://github.com/amundsen-io/amundsen/blob/master/docs/installation.md#bootstrap-a-default-version-of-amundsen-using-docker) setup of Amundsen with dummy data, and an [overview of the architecture](https://github.com/amundsen-io/amundsen/blob/master/docs/architecture.md#architecture).

## Requirements

- Python >= 3.6
- elasticsearch 6.x (currently it doesn't support 7.x)

## Doc
- https://lyft.github.io/amundsen/
- https://www.amundsen.io/amundsen


## Instructions to start the Search service from distribution
Expand Down
3 changes: 3 additions & 0 deletions search_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import ast
import importlib
import os
Expand Down
2 changes: 2 additions & 0 deletions search_service/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions search_service/api/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Any, Dict, Iterable # noqa: F401

Expand Down
4 changes: 4 additions & 0 deletions search_service/api/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from http import HTTPStatus
from typing import Iterable, Any
Expand Down Expand Up @@ -64,6 +67,7 @@ class SearchDashboardFilterAPI(BaseFilterAPI):
"""
Search Filter for Dashboard
"""

def __init__(self) -> None:
super().__init__(schema=SearchDashboardResultSchema,
index=DASHBOARD_INDEX)
Expand Down
3 changes: 3 additions & 0 deletions search_service/api/document.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging

from http import HTTPStatus
Expand Down
3 changes: 3 additions & 0 deletions search_service/api/healthcheck.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Tuple
from flasgger import swag_from

Expand Down
4 changes: 4 additions & 0 deletions search_service/api/table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Any, Iterable # noqa: F401

Expand Down Expand Up @@ -58,6 +61,7 @@ class SearchTableFilterAPI(BaseFilterAPI):
"""
Search Filter for table
"""

def __init__(self) -> None:
super().__init__(schema=SearchTableResultSchema,
index=TABLE_INDEX)
Expand Down
3 changes: 3 additions & 0 deletions search_service/api/user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Iterable, Any

Expand Down
3 changes: 3 additions & 0 deletions search_service/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

ELASTICSEARCH_INDEX_KEY = 'ELASTICSEARCH_INDEX'
Expand Down
4 changes: 4 additions & 0 deletions search_service/exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0


class NotFoundException(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)
2 changes: 2 additions & 0 deletions search_service/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions search_service/models/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from abc import ABCMeta, abstractmethod
from typing import Set

Expand Down
7 changes: 5 additions & 2 deletions search_service/models/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Set, List

import attr
Expand Down Expand Up @@ -46,8 +49,8 @@ class Meta:

@attr.s(auto_attribs=True, kw_only=True)
class SearchDashboardResult:
total_results: int = attr.ib()
results: List[Dashboard] = attr.ib(factory=list)
total_results: int = attr.ib()
results: List[Dashboard] = attr.ib(factory=list)


class SearchDashboardResultSchema(AttrsSchema):
Expand Down
3 changes: 3 additions & 0 deletions search_service/models/search_result.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Any, List


Expand Down
7 changes: 5 additions & 2 deletions search_service/models/table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import List, Optional, Set

import attr
Expand Down Expand Up @@ -65,8 +68,8 @@ class Meta:

@attr.s(auto_attribs=True, kw_only=True)
class SearchTableResult:
total_results: int = attr.ib()
results: List[Table] = attr.ib(factory=list)
total_results: int = attr.ib()
results: List[Table] = attr.ib(factory=list)


class SearchTableResultSchema(AttrsSchema):
Expand Down
3 changes: 3 additions & 0 deletions search_service/models/tag.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import attr

from marshmallow_annotations.ext.attrs import AttrsSchema
Expand Down
7 changes: 5 additions & 2 deletions search_service/models/user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0


from typing import Optional, Set, List

Expand Down Expand Up @@ -47,8 +50,8 @@ class Meta:

@attr.s(auto_attribs=True, kw_only=True)
class SearchUserResult:
total_results: int = attr.ib()
results: List[User] = attr.ib(factory=list)
total_results: int = attr.ib()
results: List[User] = attr.ib(factory=list)


class SearchUserResultSchema(AttrsSchema):
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from threading import Lock

from flask import current_app
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/atlas.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from re import sub
from typing import Any, List, Dict, Tuple, Optional
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from abc import ABCMeta, abstractmethod
from typing import Any, Dict, List, Union

Expand Down
7 changes: 5 additions & 2 deletions search_service/proxy/elasticsearch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
import uuid
import itertools
Expand Down Expand Up @@ -87,7 +90,7 @@ def __init__(self, *,
def _get_search_result(self, page_index: int,
client: Search,
model: Any,
search_result_model: Any=SearchResult) -> Any:
search_result_model: Any = SearchResult) -> Any:
"""
Common helper function to get result.
Expand Down Expand Up @@ -140,7 +143,7 @@ def _search_helper(self, page_index: int,
client: Search,
query_name: dict,
model: Any,
search_result_model: Any =SearchResult) -> Any:
search_result_model: Any = SearchResult) -> Any:
"""
Constructs Elasticsearch Query DSL to:
1. Use function score to customize scoring of search result. It currently uses "total_usage" field to score.
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/statsd_utilities.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from threading import Lock
from typing import Any, Dict, Callable # noqa: F401
Expand Down
3 changes: 3 additions & 0 deletions search_service/search_wsgi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

from search_service import create_app
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

from setuptools import setup, find_packages
Expand All @@ -13,8 +16,8 @@
version=__version__,
description='Search Service for Amundsen',
url='https://github.com/kylg/amundsensearchlibrary.git',
maintainer='Lyft',
maintainer_email='dp-tools@lyft.com',
maintainer='kylg',
maintainer_email='info@kylg.org',
packages=find_packages(exclude=['tests*']),
include_package_data=True,
zip_safe=False,
Expand Down
2 changes: 2 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions tests/unit/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions tests/unit/api/dashboard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions tests/unit/api/dashboard/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from search_service.models.dashboard import Dashboard


Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/dashboard/test_search_dashboard_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from unittest import TestCase

Expand Down
Loading

0 comments on commit a42d89c

Please sign in to comment.