Skip to content
Merged

Peprs #159

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Lint

on: [pull_request]
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: psf/black@stable
with:
python-version: "3.12"
- run: pip install ruff
- run: ruff check .
- run: ruff format --check .
10 changes: 4 additions & 6 deletions .github/workflows/cli-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
cli-coverage-report:
strategy:
matrix:
python-version: [ "3.11" ]
python-version: [ "3.10" ]
os: [ ubuntu-latest ] # can't use macOS when using service containers or container jobs
r: [ release ]
runs-on: ${{ matrix.os }}
Expand All @@ -31,10 +31,8 @@ jobs:
with:
python-version: '3.10'

- name: Install dev dependancies
run: if [ -f requirements/requirements-dev.txt ]; then pip install -r requirements/requirements-dev.txt; fi

- run: pip install .
- name: Install package with test dependencies
run: pip install ".[test]"

- name: Run tests
run: coverage run -m pytest
Expand All @@ -49,4 +47,4 @@ jobs:
SMOKESHOW_GITHUB_CONTEXT: coverage
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}
9 changes: 3 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
pytest:
strategy:
matrix:
python-version: ["3.9", "3.13"]
python-version: ["3.10", "3.13"]
os: [ubuntu-latest] # can't use macOS when using service containers or container jobs
r: [release]
runs-on: ${{ matrix.os }}
Expand All @@ -33,11 +33,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dev dependencies
run: if [ -f requirements/requirements-dev.txt ]; then pip install -r requirements/requirements-dev.txt; fi

- name: Install package
run: python -m pip install .
- name: Install package with test dependencies
run: python -m pip install ".[test]"

- name: Run pytest tests
run: pytest tests -x -vv
15 changes: 7 additions & 8 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ jobs:
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
- name: Install build dependencies
run: python -m pip install --upgrade pip build
- name: Build package
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

10 changes: 10 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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.13.0] -- 2026-07-01
- Migrated from `peppy` to `peprs` across all modules (project, sample, view, models, utils)
- Updated subsample key constant: `SUBSAMPLE_RAW_LIST_KEY` → `SUBSAMPLE_RAW_DICT_KEY`
- Added alembic database migration support; `run_migrations` parameter added to `PEPDatabaseAgent` and `BaseEngine`
- Fixed nullable fields in schema models (`SchemaVersionAnnotation`, `SchemaRecordAnnotation`, `UpdateSchemaRecordFields`, `UpdateSchemaVersionFields`)
- Added support for `"latest"` schema version resolution when uploading/updating projects
- Moved `SAMPLE_NAME_ATTR` and `SAMPLE_TABLE_INDEX_KEY` constants into `pepdbagent/const.py`
- Performed code cleanup and refactoring across modules, including modernization of the codestyle, installation and dependencies.

## [0.12.4] -- 2026-01-26
- Added project search by tag in annotation module
- Updated github actions workflows
Expand Down
5 changes: 0 additions & 5 deletions pep_db/Dockerfile

This file was deleted.

17 changes: 15 additions & 2 deletions pepdbagent/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
"""Package-level data"""
"""Package-level data."""

from importlib.metadata import version

import coloredlogs
import logmuse

from pepdbagent._version import __version__
from pepdbagent.pepdbagent import PEPDatabaseAgent

__version__ = version("pepdbagent")

__all__ = ["__version__", "PEPDatabaseAgent"]

_LOGGER = logmuse.init_logger("pepdbagent")
coloredlogs.install(
logger=_LOGGER,
datefmt="%H:%M:%S",
fmt="[%(levelname)s] [%(asctime)s] %(message)s",
)
1 change: 0 additions & 1 deletion pepdbagent/_version.py

This file was deleted.

4 changes: 1 addition & 3 deletions pepdbagent/alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from logging.config import fileConfig

from sqlalchemy import engine_from_config
from sqlalchemy import pool

from alembic import context
from sqlalchemy import engine_from_config, pool

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down
26 changes: 19 additions & 7 deletions pepdbagent/alembic/versions/44cb1e7a80de_initial_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import FetchedValue

Expand Down Expand Up @@ -64,7 +64,9 @@ def upgrade() -> None:
sa.UniqueConstraint("namespace", "name"),
)
op.create_index(op.f("ix_schema_groups_id"), "schema_groups", ["id"], unique=False)
op.create_index(op.f("ix_schema_groups_name"), "schema_groups", ["name"], unique=False)
op.create_index(
op.f("ix_schema_groups_name"), "schema_groups", ["name"], unique=False
)
op.create_index(
op.f("ix_schema_groups_namespace"), "schema_groups", ["namespace"], unique=False
)
Expand All @@ -87,7 +89,9 @@ def upgrade() -> None:
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("namespace", "name"),
)
op.create_index(op.f("ix_schemas_description"), "schemas", ["description"], unique=False)
op.create_index(
op.f("ix_schemas_description"), "schemas", ["description"], unique=False
)
op.create_index(op.f("ix_schemas_id"), "schemas", ["id"], unique=False)
op.create_index(op.f("ix_schemas_name"), "schemas", ["name"], unique=False)
op.create_table(
Expand All @@ -113,7 +117,9 @@ def upgrade() -> None:
sa.Column("schema_id", sa.Integer(), nullable=True),
sa.Column("pop", sa.Boolean(), nullable=True),
sa.Column("forked_from_id", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["forked_from_id"], ["projects.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(
["forked_from_id"], ["projects.id"], ondelete="SET NULL"
),
sa.ForeignKeyConstraint(["namespace"], ["users.namespace"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["schema_id"], ["schemas.id"], ondelete="SET NULL"),
sa.PrimaryKeyConstraint("id"),
Expand Down Expand Up @@ -225,7 +231,9 @@ def upgrade() -> None:
sa.Enum("UPDATE", "INSERT", "DELETE", name="updatetypes"),
nullable=False,
),
sa.ForeignKeyConstraint(["history_id"], ["project_history.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(
["history_id"], ["project_history.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
Expand All @@ -249,8 +257,12 @@ def downgrade() -> None:
op.drop_table("stars")
op.drop_table("samples")
op.drop_table("project_history")
op.drop_index(op.f("ix_schema_group_relations_schema_id"), table_name="schema_group_relations")
op.drop_index(op.f("ix_schema_group_relations_group_id"), table_name="schema_group_relations")
op.drop_index(
op.f("ix_schema_group_relations_schema_id"), table_name="schema_group_relations"
)
op.drop_index(
op.f("ix_schema_group_relations_group_id"), table_name="schema_group_relations"
)
op.drop_table("schema_group_relations")
op.drop_table("projects")
op.drop_index(op.f("ix_schemas_name"), table_name="schemas")
Expand Down
47 changes: 35 additions & 12 deletions pepdbagent/alembic/versions/8a037f13b4e5_upgrading_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import FetchedValue

Expand Down Expand Up @@ -52,7 +52,9 @@ def upgrade() -> None:
sa.Column("last_update_date", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("contributors", sa.String(), nullable=True),
sa.Column("release_notes", sa.String(), nullable=True),
sa.ForeignKeyConstraint(["schema_id"], ["schema_records.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(
["schema_id"], ["schema_records.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("schema_id", "version"),
)
Expand All @@ -62,7 +64,9 @@ def upgrade() -> None:
sa.Column("tag_name", sa.String(), nullable=False),
sa.Column("tag_value", sa.String(), nullable=True),
sa.Column("schema_version_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(["schema_version_id"], ["schema_versions.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(
["schema_version_id"], ["schema_versions.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
)
op.drop_index("ix_schemas_description", table_name="schemas")
Expand All @@ -76,16 +80,22 @@ def upgrade() -> None:
op.drop_index("ix_schema_groups_namespace", table_name="schema_groups")
# op.drop_table('schema_groups')
op.execute("DROP TABLE schema_groups CASCADE;")
op.drop_index("ix_schema_group_relations_group_id", table_name="schema_group_relations")
op.drop_index("ix_schema_group_relations_schema_id", table_name="schema_group_relations")
op.drop_index(
"ix_schema_group_relations_group_id", table_name="schema_group_relations"
)
op.drop_index(
"ix_schema_group_relations_schema_id", table_name="schema_group_relations"
)
op.drop_table("schema_group_relations")

op.execute("UPDATE projects SET schema_id = NULL;")
op.create_foreign_key(
None, "projects", "schema_versions", ["schema_id"], ["id"], ondelete="SET NULL"
)
op.drop_column("projects", "pep_schema")
op.add_column("users", sa.Column("number_of_schemas", sa.Integer(), nullable=True, default=0))
op.add_column(
"users", sa.Column("number_of_schemas", sa.Integer(), nullable=True, default=0)
)
# ### end Alembic commands ###


Expand All @@ -94,7 +104,8 @@ def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("users", "number_of_schemas")
op.add_column(
"projects", sa.Column("pep_schema", sa.VARCHAR(), autoincrement=False, nullable=True)
"projects",
sa.Column("pep_schema", sa.VARCHAR(), autoincrement=False, nullable=True),
)
op.drop_constraint(None, "projects", type_="foreignkey")
op.create_foreign_key(
Expand All @@ -121,7 +132,9 @@ def downgrade() -> None:
name="schema_group_relations_schema_id_fkey",
ondelete="CASCADE",
),
sa.PrimaryKeyConstraint("schema_id", "group_id", name="schema_group_relations_pkey"),
sa.PrimaryKeyConstraint(
"schema_id", "group_id", name="schema_group_relations_pkey"
),
)
op.create_index(
"ix_schema_group_relations_schema_id",
Expand All @@ -130,7 +143,10 @@ def downgrade() -> None:
unique=False,
)
op.create_index(
"ix_schema_group_relations_group_id", "schema_group_relations", ["group_id"], unique=False
"ix_schema_group_relations_group_id",
"schema_group_relations",
["group_id"],
unique=False,
)
op.create_table(
"schema_groups",
Expand All @@ -145,9 +161,13 @@ def downgrade() -> None:
ondelete="CASCADE",
),
sa.PrimaryKeyConstraint("id", name="schema_groups_pkey"),
sa.UniqueConstraint("namespace", "name", name="schema_groups_namespace_name_key"),
sa.UniqueConstraint(
"namespace", "name", name="schema_groups_namespace_name_key"
),
)
op.create_index(
"ix_schema_groups_namespace", "schema_groups", ["namespace"], unique=False
)
op.create_index("ix_schema_groups_namespace", "schema_groups", ["namespace"], unique=False)
op.create_index("ix_schema_groups_name", "schema_groups", ["name"], unique=False)
op.create_index("ix_schema_groups_id", "schema_groups", ["id"], unique=False)
op.create_table(
Expand Down Expand Up @@ -176,7 +196,10 @@ def downgrade() -> None:
nullable=True,
),
sa.ForeignKeyConstraint(
["namespace"], ["users.namespace"], name="schemas_namespace_fkey", ondelete="CASCADE"
["namespace"],
["users.namespace"],
name="schemas_namespace_fkey",
ondelete="CASCADE",
),
sa.PrimaryKeyConstraint("id", name="schemas_pkey"),
sa.UniqueConstraint("namespace", "name", name="schemas_namespace_name_key"),
Expand Down
Loading