diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 052e2ec..79ec0bb 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -6,6 +6,6 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 - uses: psf/black@stable diff --git a/.github/workflows/cli-coverage.yml b/.github/workflows/cli-coverage.yml index e33fcda..cbd7cfe 100644 --- a/.github/workflows/cli-coverage.yml +++ b/.github/workflows/cli-coverage.yml @@ -25,9 +25,9 @@ jobs: options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v6 with: python-version: '3.10' diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 3733738..7771b34 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -26,10 +26,10 @@ jobs: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index b120129..1aa6b6a 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -11,9 +11,9 @@ jobs: permissions: id-token: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v6 with: python-version: '3.x' - name: Install dependencies diff --git a/README.md b/README.md index 56c3910..c9b91df 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ to increase readability, maintainability, and user experience of pepdbagent, whi - Sample: Handles the creation, modification, and deletion of samples, without modification of the entire project. - View: Manages the creation, modification, and deletion of views for specific projects. - User: Contains user-related information such as favorites and other user-related data. +- Schema: Provides information and functions related to the user schemas. ## Example: diff --git a/docs/changelog.md b/docs/changelog.md index 98493fe..96b6a03 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format. +## [0.12.4] -- 2026-01-26 +- Added project search by tag in annotation module +- Updated github actions workflows + + ## [0.12.3] -- 2025-04-03 - Fixed models for schema records and versions diff --git a/pepdbagent/_version.py b/pepdbagent/_version.py index 8e1395b..6dd4954 100644 --- a/pepdbagent/_version.py +++ b/pepdbagent/_version.py @@ -1 +1 @@ -__version__ = "0.12.3" +__version__ = "0.12.4" diff --git a/pepdbagent/modules/annotation.py b/pepdbagent/modules/annotation.py index 6481796..7159ece 100644 --- a/pepdbagent/modules/annotation.py +++ b/pepdbagent/modules/annotation.py @@ -106,6 +106,7 @@ def get( count=self._count_projects( namespace=namespace, search_str=query, + tag=tag, admin=admin, filter_by=filter_by, filter_end_date=filter_end_date, @@ -115,6 +116,7 @@ def get( results=self._get_projects( namespace=namespace, search_str=query, + tag=tag, admin=admin, offset=offset, limit=limit, @@ -235,6 +237,7 @@ def _count_projects( self, namespace: str = None, search_str: str = None, + tag: str = None, admin: Union[str, List[str]] = None, filter_by: Optional[Literal["submission_date", "last_update_date"]] = None, filter_start_date: Optional[str] = None, @@ -246,6 +249,7 @@ def _count_projects( :param namespace: namespace where to search for a project :param search_str: search string. will be searched in name, tag and description information + :param tag: tag of the projects (find projects with specific tag) :param admin: string or list of admins [e.g. "Khoroshevskyi", or ["doc_adin","Khoroshevskyi"]] :param filter_by: data to use filter on. Options: ["submission_date", "last_update_date"] @@ -270,6 +274,8 @@ def _count_projects( ) if pep_type: statement = statement.where(Projects.pop.is_(pep_type == "pop")) + if tag: + statement = statement.where(Projects.tag == tag) result = self._pep_db_engine.session_execute(statement).first() try: @@ -280,6 +286,7 @@ def _count_projects( def _get_projects( self, namespace: str = None, + tag: str = None, search_str: str = None, admin: Union[str, List[str]] = None, limit: int = DEFAULT_LIMIT, @@ -295,6 +302,7 @@ def _get_projects( Get projects by providing search string. :param namespace: namespace where to search for a project + :param tag: tag of the projects (find projects with specific tag) :param search_str: search string that has to be found in the name or tag :param admin: True, if user is admin of the namespace [Default: False] :param limit: limit of return results @@ -322,6 +330,7 @@ def _get_projects( namespace=namespace, search_str=search_str, admin_list=admin, + tag=tag, ) statement = self._add_date_filter_if_provided( statement, filter_by, filter_start_date, filter_end_date @@ -406,6 +415,7 @@ def _add_condition( namespace: str = None, search_str: str = None, admin_list: Union[str, List[str]] = None, + tag: str = None, ) -> Select: """ Add where clause to sqlalchemy statement (in project search) @@ -414,6 +424,7 @@ def _add_condition( :param namespace: project namespace sql:(where namespace = "") :param search_str: search string that has to be found in the name or tag :param admin_list: list or string of admin rights to namespace + :param tag: tag of the projects (find projects with specific tag) :return: sqlalchemy representation of a SELECT statement with where clause. """ admin_list = tuple_converter(admin_list) @@ -428,6 +439,9 @@ def _add_condition( if namespace: statement = statement.where(Projects.namespace == namespace) + if tag: + statement = statement.where(Projects.tag == tag) + statement = statement.where( or_(Projects.private.is_(False), Projects.namespace.in_(admin_list)) )