Skip to content

Commit

Permalink
Merge pull request #41 from databio/dev
Browse files Browse the repository at this point in the history
Release 0.4.1
  • Loading branch information
khoroshevskyi authored Feb 28, 2024
2 parents 50a6af9 + 9039abd commit b17b8f9
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 785 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/cli-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: test coverage

on:
push:
branches: [master, dev]

jobs:
cli-coverage-report:
strategy:
matrix:
python-version: ["3.10"]
os: [ ubuntu-latest ] # can't use macOS when using service containers or container jobs
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: dockerpassword
POSTGRES_DB: pipestat-test
POSTGRES_HOST: localhost
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v1
with:
python-version: '3.10'

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

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

- run: pip install .

- name: Run tests
run: coverage run -m pytest

- name: build coverage
run: coverage html -i

- run: smokeshow upload htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50
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 }}
16 changes: 7 additions & 9 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
Expand All @@ -11,21 +8,22 @@ jobs:
deploy:

runs-on: ubuntu-latest
name: upload release to PyPI
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# bbconf
<h1 align="center">bbconf</h1>

![Run pytests](https://github.com/databio/bbconf/workflows/Run%20pytests/badge.svg)
[![codecov](https://codecov.io/gh/databio/bbconf/branch/master/graph/badge.svg)](https://codecov.io/gh/databio/bbconf)
[![pypi-badge](https://img.shields.io/pypi/v/bbconf?color=%2334D058)](https://pypi.org/batabio/bbconf)
[![pypi-version](https://img.shields.io/pypi/pyversions/bbconf.svg?color=%2334D058)](https://pypi.org/databio/bbconf)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Github badge](https://img.shields.io/badge/source-github-354a75?logo=github)](https://github.com/databio/bbconf)
[![coverage](https://coverage-badge.samuelcolvin.workers.dev/databio/bbconf.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/databio/bbconf)


*BEDBASE* project configuration package
*BEDBASE* project configuration package (agent)

## What is this?

`bbconf` standardizes reporting of [bedstat](https://github.com/databio/bedstat) and [bedbuncher](https://github.com/databio/bedsbuncher) results. It formalizes a way for these pipelines and downstream tools to communicate -- the produced results can easily and reliably become an
input for the server ([bedhost](https://github.com/databio/bedhost)). The object exposes API for interacting with the results and is backed by a [PostgreSQL](https://www.postgresql.org/) database.
`bbconf` is a configuration and management tool for BEDbase, facilitating the reading of configuration files,
setting up connections to PostgreSQL and Qdrant databases, managing file paths, and storing transformer models.
It formalizes communication pathways for pipelines and downstream tools, ensuring seamless interaction."

## Installation
---

**Documentation**: <a href="https://docs.bedbase.org/bedboss" target="_blank">https://docs.bedbase.org/bedboss</a>

**Source Code**: <a href="https://github.com/databio/bbconf" target="_blank">https://github.com/databio/bbconf</a>

---

Install from [GitHub releases](https://github.com/databio/bbconf/releases) or from PyPI using `pip`:
## Installation
To install `bbclient` use this command:
```
pip install bbclient
```
or install the latest version from the GitHub repository:
```
pip install --user bbconf
pip install git+https://github.com/databio/bbconf.git
```

## Documentation
- [Bedbase configuration file](docs/config.ipynb)
- [Usage demonstration](docs/demo.ipynb)
- [Python API](docs/bbc_api.md)
11 changes: 11 additions & 0 deletions bbconf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import logging
import coloredlogs

from bbconf.bbconf import BedBaseConf, get_bedbase_cfg
from ._version import __version__
from .const import PKG_NAME

__all__ = ["BedBaseConf", "get_bedbase_cfg", "__version__"]

_LOGGER = logging.getLogger(PKG_NAME)
coloredlogs.install(
logger=_LOGGER,
datefmt="%H:%M:%S",
fmt="[%(levelname)s] [%(asctime)s] [BBCONF] %(message)s",
)
11 changes: 6 additions & 5 deletions bbconf/bbconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
DEFAULT_VEC2VEC_MODEL,
DEFAULT_REGION2_VEC_MODEL,
CFG_ACCESS_METHOD_KEY,
PKG_NAME,
)
from bbconf.exceptions import (
BedBaseConfError,
Expand All @@ -56,7 +57,7 @@
from geniml.region2vec import Region2VecExModel
from geniml.io import RegionSet

_LOGGER = getLogger(__name__)
_LOGGER = getLogger(PKG_NAME)


class BedBaseConf:
Expand Down Expand Up @@ -440,17 +441,17 @@ def select_bedfiles_from_bedset(
self.BedsetORM.record_identifier == bedset_record_id
)
results = session.exec(statement).one().bedfiles
bedfile_list = [bedfile.dict() for bedfile in results]
bedfile_list = [bedfile.model_dump() for bedfile in results]
else:
# Probably we can do it in more simple way
with self.bed.backend.session as session:
statement = select(self.BedfileORM.record_identifier).where(
self.BedfileORM.id.in_(
select(self.rel_table.bedfile_id).where(
self.rel_table.bedset_id
== select(self.BedsetORM.id).where(
self.BedsetORM.record_identifier == bedset_record_id
)
== select(self.BedsetORM.id)
.where(self.BedsetORM.record_identifier == bedset_record_id)
.scalar_subquery()
)
)
)
Expand Down
6 changes: 6 additions & 0 deletions bbconf/schemas/bedfiles_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ properties:
genome:
type: object
description: genome assembly of the BED files
bed_type:
type: string
description: type of BED file, eg. "bed3", "bed6+4"
bed_format:
type: string
description: format type of BED file, narrowpeak, broadpeak, or bed
bedfile:
$ref: "#/$defs/file"
label: bedfile
Expand Down
3 changes: 0 additions & 3 deletions docs/README.md

This file was deleted.

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

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.4.2] - 2024-XX-XX
### Change
- Updated logger
- Updated requirements


## [0.4.1] - 2024-01-01
### Fix
- Requirements
Expand Down
149 changes: 0 additions & 149 deletions docs/config.ipynb

This file was deleted.

Loading

0 comments on commit b17b8f9

Please sign in to comment.