Skip to content

Commit

Permalink
Merge pull request #87 from PainterQubits/develop
Browse files Browse the repository at this point in the history
Merge develop into main
  • Loading branch information
alexhad6 authored Jun 10, 2023
2 parents 7a34cc8 + 4140a4e commit a677eb4
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 121 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2
updates:
- package-ecosystem: "pip"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
target-branch: "develop"

- package-ecosystem: "github-actions"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

env:
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.5.0"
POETRY_VERSION: "1.5.1"

jobs:
ci:
Expand All @@ -31,7 +31,7 @@ jobs:
cache: poetry

- name: Install dependencies
run: poetry install --all-extras
run: poetry install --all-extras --without docs

- name: Check Formatting (Black)
run: poetry run black paramdb tests --check
Expand All @@ -54,4 +54,7 @@ jobs:
run: poetry run mypy paramdb tests

- name: Test (Pytest)
run: poetry run pytest
run: poetry run pytest --cov=paramdb --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
76 changes: 0 additions & 76 deletions .github/workflows/github-pages.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish

on:
release:
types: [published]

env:
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.5.1"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}

- name: Build package
run: poetry build

- name: Upload package artifact
uses: actions/upload-artifact@v3
with:
name: paramdb-release
path: dist

publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/paramdb
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: paramdb-release
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ __pycache__/
.mypy_cache/
.pytest_cache/
.coverage
coverage.xml

# Data files
# Database files
*.db
*.db-journal
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"
jobs:
post_create_environment:
- pip install poetry==1.5.1
- poetry config virtualenvs.create false
post_install:
- poetry install --without dev

sphinx:
configuration: docs/conf.py
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.8.0] (June 9 2023)

### Changed

- Documentation website moved to Read the Docs.

### Added

- Badges for latest PyPI version, license, CI status, Codecov, and docs website build.

## [0.7.0] (May 19 2023)

### Changed
Expand Down Expand Up @@ -89,7 +99,8 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Database class `ParamDB` to store parameters in a SQLite file
- Ability to retrieve the commit history as `CommitEntry` objects

[unreleased]: https://github.com/PainterQubits/paramdb/compare/v0.7.0...main
[unreleased]: https://github.com/PainterQubits/paramdb/compare/v0.8.0...develop
[0.8.0]: https://github.com/PainterQubits/paramdb/releases/tag/v0.8.0
[0.7.0]: https://github.com/PainterQubits/paramdb/releases/tag/v0.7.0
[0.6.0]: https://github.com/PainterQubits/paramdb/releases/tag/v0.6.0
[0.5.0]: https://github.com/PainterQubits/paramdb/releases/tag/v0.5.0
Expand Down
5 changes: 2 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ authors:
- family-names: "Hadley"
given-names: "Alex"
title: "ParamDB"
version: 0.7.0
# doi: 10.5281/zenodo.xxxx
date-released: 2023-05-19
version: 0.8.0
date-released: 2023-06-09
url: "https://github.com/PainterQubits/paramdb"
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# ParamDB

[![PyPI Latest Release](https://img.shields.io/pypi/v/paramdb)](https://pypi.org/project/paramdb/)
[![License](https://img.shields.io/pypi/l/paramdb)](https://github.com/PainterQubits/paramdb/blob/main/LICENSE)
[![CI](https://github.com/PainterQubits/paramdb/actions/workflows/ci.yml/badge.svg)](https://github.com/PainterQubits/paramdb/actions/workflows/ci.yml)
[![Codecov](https://codecov.io/github/PainterQubits/paramdb/branch/main/graph/badge.svg?token=PQEJWLBTBK)](https://codecov.io/github/PainterQubits/paramdb)
[![Documentation Status](https://readthedocs.org/projects/paramdb/badge/?version=stable)](https://paramdb.readthedocs.io/en/stable/?badge=stable)

<!-- start intro -->

Python library for storing and retrieving experiment parameters.
Python package for storing and retrieving experiment parameters.

<!-- end intro -->

Expand All @@ -13,28 +19,16 @@ Python library for storing and retrieving experiment parameters.
Install the latest version of ParamDB using pip:

```
pip install -U paramdb --extra-index-url https://painterqubits.github.io/paramdb/releases
pip install -U paramdb
```

To install along with [Astropy] for support for storing [`astropy.units.Quantity`]
To install along with [Astropy] for support for storing scalar [`astropy.units.Quantity`]
objects in the database, ParamDB can be installed with the `astropy` extra:

```
pip install -U paramdb[astropy] --extra-index-url https://painterqubits.github.io/paramdb/releases
```

The `extra-index-url` parameter is needed since ParamDB is not published to PyPI yet. If
you are using a Python package manager, add
`https://painterqubits.github.io/paramdb/releases` as a secondary source. For example, for
[Poetry] the command is

```
poetry source add --secondary paramdb https://painterqubits.github.io/paramdb/releases
pip install -U paramdb[astropy]
```

Then the package can be installed like any other (e.g. `poetry add paramdb`).

[poetry]: https://python-poetry.org
[astropy]: https://docs.astropy.org/en/stable/index.html
[`astropy.units.quantity`]: https://docs.astropy.org/en/stable/api/astropy.units.Quantity.html#astropy.units.Quantity

Expand All @@ -52,6 +46,6 @@ ParamDB has two main components:

See the [api reference] for more information.

[**parameter data**]: https://painterqubits.github.io/paramdb/parameter-data.html
[**database**]: https://painterqubits.github.io/paramdb/database.html
[api reference]: https://painterqubits.github.io/paramdb/api-reference
[**parameter data**]: https://paramdb.readthedocs.io/en/stable/parameter-data.html
[**database**]: https://paramdb.readthedocs.io/en/stable/database.html
[api reference]: https://paramdb.readthedocs.io/en/stable/api-reference.html
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
project = "ParamDB"
copyright = "2023, California Institute of Technology"
author = "Alex Hadley"
release = "0.7.0"
release = "0.8.0"

# General configuration
extensions = [
Expand Down
4 changes: 2 additions & 2 deletions paramdb/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ def commit(self, message: str, data: T) -> int:
@overload
def load(
self, commit_id: int | None = None, *, load_classes: Literal[True] = True
) -> T:
) -> T: # pragma: no cover
...

@overload
def load(
self, commit_id: int | None = None, *, load_classes: Literal[False]
) -> dict[str, Any]:
) -> dict[str, Any]: # pragma: no cover
...

def load(self, commit_id: int | None = None, *, load_classes: bool = True) -> Any:
Expand Down
8 changes: 4 additions & 4 deletions paramdb/_param_data/_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ def __init__(self, iterable: Iterable[T] | None = None) -> None:
self._add_child(item)

@overload
def __getitem__(self, index: SupportsIndex) -> T:
def __getitem__(self, index: SupportsIndex) -> T: # pragma: no cover
...

@overload
def __getitem__(self, index: slice) -> list[T]:
def __getitem__(self, index: slice) -> list[T]: # pragma: no cover
...

def __getitem__(self, index: Any) -> Any:
return self._contents[index]

@overload
def __setitem__(self, index: SupportsIndex, value: T) -> None:
def __setitem__(self, index: SupportsIndex, value: T) -> None: # pragma: no cover
...

@overload
def __setitem__(self, index: slice, value: Iterable[T]) -> None:
def __setitem__(self, index: slice, value: Iterable[T]) -> None: # pragma: no cover
...

def __setitem__(self, index: SupportsIndex | slice, value: Any) -> None:
Expand Down
2 changes: 1 addition & 1 deletion paramdb/_param_data/_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __setitem__(self, name: str, value: Any) -> None:

@property
@abstractmethod
def last_updated(self) -> datetime | None:
def last_updated(self) -> datetime | None: # pragma: no cover
...

def to_dict(self) -> dict[str, Any]:
Expand Down
Loading

0 comments on commit a677eb4

Please sign in to comment.