Skip to content

Commit

Permalink
Rename package from datalogger to datalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Apr 16, 2024
1 parent cfe7d3b commit bd77626
Show file tree
Hide file tree
Showing 23 changed files with 75 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
POETRY_VERSION: "1.8.2"
MAIN_PYTHON_VERSION: "3.9"
PACKAGE_NAME: "datalogger"
PACKAGE_NAME: "datalogs"

jobs:
ci:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: workflow_dispatch
env:
POETRY_VERSION: "1.8.2"
PYTHON_VERSION: "3.9"
PACKAGE_NAME: "datalogger"
PACKAGE_NAME: "datalogs"
PACKAGE_VERSION: "0.3.2"

jobs:
Expand Down
18 changes: 11 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Rename package from `datalogger` to `datalogs` (since datalogger was taken on PyPI).

## [0.3.2] (Mar 27 2024)

### Changed
Expand Down Expand Up @@ -64,10 +68,10 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Function `load_log()` to load log files.
- Initial documentation website.

[unreleased]: https://github.com/PainterQubits/datalogger/compare/v0.3.2...main
[0.3.2]: https://github.com/PainterQubits/datalogger/releases/tag/v0.3.2
[0.3.1]: https://github.com/PainterQubits/datalogger/releases/tag/v0.3.1
[0.3.0]: https://github.com/PainterQubits/datalogger/releases/tag/v0.3.0
[0.2.0]: https://github.com/PainterQubits/datalogger/releases/tag/v0.2.0
[0.1.1]: https://github.com/PainterQubits/datalogger/releases/tag/v0.1.1
[0.1.0]: https://github.com/PainterQubits/datalogger/releases/tag/v0.1.0
[unreleased]: https://github.com/PainterQubits/datalogs/compare/v0.3.2...main
[0.3.2]: https://github.com/PainterQubits/datalogs/releases/tag/v0.3.2
[0.3.1]: https://github.com/PainterQubits/datalogs/releases/tag/v0.3.1
[0.3.0]: https://github.com/PainterQubits/datalogs/releases/tag/v0.3.0
[0.2.0]: https://github.com/PainterQubits/datalogs/releases/tag/v0.2.0
[0.1.1]: https://github.com/PainterQubits/datalogs/releases/tag/v0.1.1
[0.1.0]: https://github.com/PainterQubits/datalogs/releases/tag/v0.1.0
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DataLogger
# DataLogs

<!-- start introduction -->

Expand All @@ -10,17 +10,17 @@ Python package for logging data from scientific experiments.

<!-- start installation -->

Install the latest version of DataLogger using pip:
Install the latest version of DataLogs using pip:

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

To install along with [ParamDB] for support for tagging logs with the latest commit ID,
DataLogger can be installed with the `paramdb` extra:
DataLogs can be installed with the `paramdb` extra:

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

[ParamDB]: https://paramdb.readthedocs.io/en/stable/
Expand Down
17 changes: 0 additions & 17 deletions datalogger/__init__.py

This file was deleted.

17 changes: 17 additions & 0 deletions datalogs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Data logger for scientific experiments."""

from datalogs._variables import Coord, DataVar
from datalogs._logs import LogMetadata, DataLog, DictLog
from datalogs._logger import LoggedProp, Logger
from datalogs._load_log import load_log

__all__ = [
"Coord",
"DataVar",
"LogMetadata",
"DataLog",
"DictLog",
"LoggedProp",
"Logger",
"load_log",
]
File renamed without changes.
2 changes: 1 addition & 1 deletion datalogger/_load_log.py → datalogs/_load_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations
import os
from datalogger._logs import DataLog, DictLog
from datalogs._logs import DataLog, DictLog


def load_log(path: str) -> DataLog | DictLog:
Expand Down
8 changes: 4 additions & 4 deletions datalogger/_logger.py → datalogs/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from datetime import datetime, timezone
import numpy as np
import pandas as pd # type: ignore
from datalogger._variables import Coord, DataVar
from datalogger._logs import LogMetadata, DataLog, DictLog
from datalogger._get_filename import get_filename
from datalogs._variables import Coord, DataVar
from datalogs._logs import LogMetadata, DataLog, DictLog
from datalogs._get_filename import get_filename

try:
from paramdb import ParamDB
Expand Down Expand Up @@ -277,7 +277,7 @@ def log_props(
a JSON file, and return a :py:class:`DictLog` with this data and metadata.
Only properties that have been marked with a
:py:const:`~datalogger._logger.LoggedProp` type hint at the top of the class
:py:const:`~datalogs._logger.LoggedProp` type hint at the top of the class
definition will be saved. For example::
class Example:
Expand Down
4 changes: 2 additions & 2 deletions datalogger/_logs.py → datalogs/_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from textwrap import indent
from typing_extensions import Self
import xarray as xr
from datalogger._variables import Coord, DataVar
from datalogger._get_filename import get_filename
from datalogs._variables import Coord, DataVar
from datalogs._get_filename import get_filename


_T = TypeVar("_T")
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# API Reference

```{py:currentmodule} datalogger
```{py:currentmodule} datalogs
```

All of the following can be imported from `datalogger`.
All of the following can be imported from `datalogs`.

## Logger

```{eval-rst}
.. autoclass:: Logger
.. py:currentmodule:: datalogger._logger
.. py:currentmodule:: datalogs._logger
.. autoclass:: LoggedProp
.. py:currentmodule:: datalogger
.. py:currentmodule:: datalogs
```

## Load Log
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://www.sphinx-doc.org/en/master/usage/configuration.html for all options

# Project information
project = "DataLogger"
project = "DataLogs"
copyright = "2023–2024, California Institute of Technology"
author = "Alex Hadley"
release = "0.3.2"
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DataLogger
# DataLogs

```{include} ../README.md
:start-after: <!-- start introduction -->
Expand Down
27 changes: 13 additions & 14 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Usage

```{py:currentmodule} datalogger
```{py:currentmodule} datalogs
```

Expand All @@ -19,13 +19,12 @@ os.chdir(tmp_dir.name)

## Background

DataLogger is Python package to log array and dictionary data from scientific
experiments. These logs are stored in files (netCDF for array data and JSON for
dictionary data). The log files are organized within a nested directory structure and
tagged with metadata, such as timestamp or optionally a commit ID from a [ParamDB]
database.
DataLogs is Python package to log array and dictionary data from scientific experiments.
These logs are stored in files (netCDF for array data and JSON for dictionary data). The
log files are organized within a nested directory structure and tagged with metadata, such
as timestamp or optionally a commit ID from a [ParamDB] database.

The original purpose of DataLogger was to store logs from graph calibration experiments,
The original purpose of DataLogs was to store logs from graph calibration experiments,
where directories correspond to nodes in a graph, so the examples below are based on this
application. However, the core functionality is very general.

Expand All @@ -38,7 +37,7 @@ To log data, we first have to create a root {py:class}`Logger` object, passing t
does not exist.

```{jupyter-execute}
from datalogger import Logger
from datalogs import Logger
root_logger = Logger("data_logs")
```
Expand Down Expand Up @@ -107,12 +106,12 @@ To learn more about Xarray data, see [Data Structures] in the Xarray user guide.
```

To aid in creating [`xarray.Dataset`] objects and to enforce certain conventions,
DataLogger provides {py:class}`Coord` as a wrapper for an Xarray coordinate and
DataLogs provides {py:class}`Coord` as a wrapper for an Xarray coordinate and
{py:class}`DataVar` as a wrapper for a Xarray data variable. We can create a data log
using these objects and {py:meth}`Logger.log_data`.

```{jupyter-execute}
from datalogger import Coord, DataVar
from datalogs import Coord, DataVar
times = [1, 2, 3]
signal = [10, 20, 30]
Expand Down Expand Up @@ -158,7 +157,7 @@ display_tree("data_logs")
### Property Logs

Property logs automatically store the properties of an object within a dictionary log.
Only properties marked with the type hint {py:class}`~datalogger._logger.LoggedProp` will
Only properties marked with the type hint {py:class}`~datalogs._logger.LoggedProp` will
be saved. We can create a property log using {py:meth}`Logger.log_props`.

```{note}
Expand All @@ -168,7 +167,7 @@ the variable, which is only used by code analysis tools.

```{jupyter-execute}
from typing import Optional
from datalogger import LoggedProp
from datalogs import LoggedProp
class SpecNode:
_element: LoggedProp
Expand Down Expand Up @@ -201,7 +200,7 @@ Logs can be loaded by passing a file path to {py:func}`load_log`. We can also us
also be passed in directly if known.)

```{jupyter-execute}
from datalogger import load_log
from datalogs import load_log
q1_spec_signal_log = load_log(node_logger.file_path("q1_spec_signal.nc"))
q1_spec_frequency_log = load_log(node_logger.file_path("q1_spec_frequency.json"))
Expand All @@ -214,7 +213,7 @@ already infers the log type from the file extension, but is useful for static ty
checking when the log type is known.

```{jupyter-execute}
from datalogger import DataLog, DictLog
from datalogs import DataLog, DictLog
q1_spec_signal_log = DataLog.load(node_logger.file_path("q1_spec_signal.nc"))
q1_spec_frequency_log = DictLog.load(node_logger.file_path("q1_spec_frequency.json"))
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "datalogger"
name = "datalogs"
version = "0.3.2"
description = "Python package for logging data from scientific experiments."
authors = ["Alex Hadley <[email protected]>"]
license = "BSD-3-Clause"
readme = "README.md"
repository = "https://github.com/PainterQubits/datalogger"
repository = "https://github.com/PainterQubits/datalogs"

[tool.poetry.dependencies]
python = "^3.9"
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import xarray as xr
import pytest
from paramdb import ParamDB
from datalogger import Coord, DataVar, LogMetadata, DataLog, DictLog, Logger
from datalogs import Coord, DataVar, LogMetadata, DataLog, DictLog, Logger


@pytest.fixture(name="cd_tempdir")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_get_filename.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Tests for datalogger._get_filename."""
"""Tests for datalogs._get_filename."""

from __future__ import annotations
import os
from datetime import datetime
import pytest
from datalogger._get_filename import get_filename
from datalogs._get_filename import get_filename


def new_file(path: str) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_load_log.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Tests for datalogger._load_log."""
"""Tests for datalogs._load_log."""

from __future__ import annotations
from typing import Any
import xarray.testing
import pytest
from datalogger import Logger, Coord, DataVar, DataLog, DictLog, load_log
from datalogs import Logger, Coord, DataVar, DataLog, DictLog, load_log


@pytest.mark.usefixtures("cd_tempdir")
Expand Down
6 changes: 3 additions & 3 deletions tests/test_logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for datalogger._logger."""
"""Tests for datalogs._logger."""

# pylint: disable=too-few-public-methods
# pylint: disable=missing-class-docstring
Expand All @@ -17,8 +17,8 @@
import pytest
from freezegun import freeze_time
from paramdb import ParamDB
from datalogger._get_filename import get_filename
from datalogger import Coord, DataVar, LoggedProp, Logger
from datalogs._get_filename import get_filename
from datalogs import Coord, DataVar, LoggedProp, Logger

PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"

Expand Down
4 changes: 2 additions & 2 deletions tests/test_logs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for datalogger._logs."""
"""Tests for datalogs._logs."""

from __future__ import annotations
from typing import Any
Expand All @@ -10,7 +10,7 @@
import xarray as xr
import xarray.testing
import pytest
from datalogger import Coord, DataVar, LogMetadata, DataLog, DictLog
from datalogs import Coord, DataVar, LogMetadata, DataLog, DictLog


def test_log_metadata_properties(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_variables.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Tests for datalogger._variables."""
"""Tests for datalogs._variables."""

from __future__ import annotations
from numpy.testing import assert_array_equal
import xarray as xr
from datalogger import Coord, DataVar
from datalogs import Coord, DataVar


def test_coord_name(coord: Coord) -> None:
Expand Down

0 comments on commit bd77626

Please sign in to comment.