Skip to content

Commit

Permalink
Rename package to MetaTracker (#7)
Browse files Browse the repository at this point in the history
* Rename package to metatracker

* rename folder

* Fix linting
  • Loading branch information
dbarrous authored Dec 4, 2024
1 parent 24c464b commit e8ebb0a
Show file tree
Hide file tree
Showing 23 changed files with 97 additions and 95 deletions.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.230"
hooks:
- id: ruff

- repo: https://github.com/psf/black
rev: "22.8.0"
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Types of Contributions
Report Bugs
~~~~~~~~~~~

Report bugs at https://github.com/dbarrous/CDFTracker/issues
Report bugs at https://github.com/dbarrous/MetaTracker/issues

If you are reporting a bug, please include:

Expand Down Expand Up @@ -44,7 +44,7 @@ Submit Feedback
~~~~~~~~~~~~~~~

The best way to send feedback is to file an issue at
https://github.com/dbarrous/CDFTracker/issues.
https://github.com/dbarrous/MetaTracker/issues.

If you are proposing a new feature:

Expand All @@ -56,25 +56,25 @@ If you are proposing a new feature:
Get Started!
------------

Ready to contribute? Here's how to set up `CDFTracker` for local
Ready to contribute? Here's how to set up `MetaTracker` for local
development. Please note this documentation assumes you already have
`poetry` and `Git` installed and ready to go.

| 1. Fork the `CDFTracker` repo on GitHub.
| 1. Fork the `MetaTracker` repo on GitHub.
| 2. Clone your fork locally:
.. code-block:: bash
cd <directory_in_which_repo_should_be_created>
git clone git@github.com:YOUR_NAME/CDFTracker.git
git clone git@github.com:YOUR_NAME/MetaTracker.git
| 3. Now we need to install the environment. Navigate into the directory
.. code-block:: bash
cd CDFTracker
cd MetaTracker
If you are using ``pyenv``, select a version to use locally. (See installed versions with ``pyenv versions``)

Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# CDFTracker
# MetaTracker


![GitHub issues](https://img.shields.io/github/issues/HERMES-SOC/CDFTracker)
[![Build status](https://img.shields.io/github/actions/workflow/status/HERMES-SOC/CDFTracker/main.yml?branch=main)](https://github.com/HERMES-SOC/CDFTracker/actions/workflows/main.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/HERMES-SOC/CDFTracker/branch/main/graph/badge.svg)](https://codecov.io/gh/HERMES-SOC/CDFTracker)
[![Commit activity](https://img.shields.io/github/commit-activity/m/HERMES-SOC/CDFTracker)](https://img.shields.io/github/commit-activity/m/HERMES-SOC/CDFTracker)
[![License](https://img.shields.io/github/license/HERMES-SOC/CDFTracker)](https://img.shields.io/github/license/HERMES-SOC/CDFTracker)
![GitHub issues](https://img.shields.io/github/issues/HERMES-SOC/MetaTracker)
[![Build status](https://img.shields.io/github/actions/workflow/status/HERMES-SOC/MetaTracker/main.yml?branch=main)](https://github.com/HERMES-SOC/MetaTracker/actions/workflows/main.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/HERMES-SOC/MetaTracker/branch/main/graph/badge.svg)](https://codecov.io/gh/HERMES-SOC/MetaTracker)
[![Commit activity](https://img.shields.io/github/commit-activity/m/HERMES-SOC/MetaTracker)](https://img.shields.io/github/commit-activity/m/HERMES-SOC/MetaTracker)
[![License](https://img.shields.io/github/license/HERMES-SOC/MetaTracker)](https://img.shields.io/github/license/HERMES-SOC/MetaTracker)

This is a python package that helps keep track of both Raw Binary and CDF Files in a Relational Database.

- **Github repository**: <https://github.com/HERMES-SOC/CDFTracker/>
- **Github repository**: <https://github.com/HERMES-SOC/MetaTracker/>

## Features
- Track both Raw Binary and CDF Files
Expand All @@ -28,16 +28,16 @@ To install the library and its dependencies, follow these steps:
1. Install with dependency manager of your choice:
```bash
# Install with pip
pip install git+https://github.com/HERMES-SOC/CDFTracker.git
pip install git+https://github.com/HERMES-SOC/MetaTracker.git

# Install with poetry
poetry add git+https://github.com/HERMES-SOC/CDFTracker.git
poetry add git+https://github.com/HERMES-SOC/MetaTracker.git
```


2. Create both the engine and the session, with your RDBMS of choice connection string. For example, to create a session with a SQLite database, you can do the following:
```python
from cdftracker.database import create_engine, create_session
from metatracker.database import create_engine, create_session
# Create a database engine and session
engine = create_engine("sqlite:///test.db")
Expand All @@ -46,7 +46,7 @@ To install the library and its dependencies, follow these steps:

3. If this is your first time using the library, you will need to create the database tables. To do so, run the following command:
```python
from cdftracker.database.tables import set_up_tables
from metatracker.database.tables import set_up_tables
# Set up tables
set_up_tables(engine, session)
Expand All @@ -71,13 +71,13 @@ To install the library and its dependencies, follow these steps:
parser = util.parse_science_filename
```
5. Now you can instantiate a `CDFTracker` object with the engine and science file parser function you defined:
5. Now you can instantiate a `MetaTracker` object with the engine and science file parser function you defined:
```python
from cdftracker.tracker import tracker
from metatracker.tracker import tracker
from pathlib import Path
# Instantiate the tracker
tracker = tracker.CDFTracker(engine, parser)
tracker = tracker.MetaTracker(engine, parser)
# Path of the science file to be tracked (for example)
file = Path("./hermes_MAG_l0_2022259-030002_v01.bin")
Expand All @@ -89,7 +89,7 @@ To install the library and its dependencies, follow these steps:
```

## Database Schema
This is the database schema for the CDFTracker database. The database schema is defined in the `cdftracker.database.tables` module.
This is the database schema for the MetaTracker database. The database schema is defined in the `metatracker.database.tables` module.

## Contributing
### How to set-up Development Environment
Expand All @@ -98,9 +98,9 @@ This project makes use of [Poetry](https://python-poetry.org/) to manage depende
1. Clone the repository

```bash
git clone https://github.com/HERMES-SOC/CDFTracker.git
git clone https://github.com/HERMES-SOC/MetaTracker.git
cd CDFTracker
cd MetaTracker
```

2. Set-up your development environment
Expand Down
15 changes: 0 additions & 15 deletions cdftracker/config/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion cdftracker/__init__.py → metatracker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set up logging
import logging

from cdftracker.config import load_config
from metatracker.config import load_config

# Set up basic config for logging
logging.basicConfig(level=logging.INFO)
Expand Down
15 changes: 15 additions & 0 deletions metatracker/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from . import config


def load_config(new_config=None) -> config.MetaTrackerConfiguration:
"""
Load configuration
Args:
config (Dict[str, Any], optional): Configuration. Defaults to None.
Returns:
config.MetaTrackerConfiguration: Configuration
"""

return config.MetaTrackerConfiguration(new_config)
4 changes: 2 additions & 2 deletions cdftracker/config/config.py → metatracker/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}


class CDFTrackerConfiguration:
class MetaTrackerConfiguration:
db_host: str
mission_name: str
instruments: List[Dict[str, Any]]
Expand Down Expand Up @@ -132,7 +132,7 @@ def __init__(self, config: Dict[str, Any]) -> None:

def __repr__(self) -> str:
return (
f"CDFTrackerConfiguration(db_host={self.db_host}, mission_name={self.mission_name},"
f"MetaTrackerConfiguration(db_host={self.db_host}, mission_name={self.mission_name},"
f" instruments={self.instruments}, instrument_configurations={self.instrument_configurations},"
f" file_levels={self.file_levels}, file_types={self.file_types})"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
Setup Tables
"""


from sqlalchemy import inspect

from cdftracker import CONFIGURATION, log
from cdftracker.database import create_session
from metatracker import CONFIGURATION, log
from metatracker.database import create_session

from . import file_level_table as FileLevelTable
from . import file_type_table as FileTypeTable
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from sqlalchemy import Column, String

from cdftracker import CONFIGURATION
from metatracker import CONFIGURATION

from . import base_table as Base

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from sqlalchemy import Column, String

from cdftracker import CONFIGURATION
from metatracker import CONFIGURATION

from . import base_table as Base

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from sqlalchemy import Column, ForeignKey, Integer

from cdftracker import CONFIGURATION
from metatracker import CONFIGURATION

from . import base_table as Base

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from sqlalchemy import Column, Integer, String

from cdftracker import CONFIGURATION
from metatracker import CONFIGURATION

from . import base_table as Base

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.orm import relationship

from cdftracker import CONFIGURATION
from metatracker import CONFIGURATION

from . import base_table as Base

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.orm import relationship

from cdftracker import CONFIGURATION
from metatracker import CONFIGURATION

from . import base_table as Base

Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions cdftracker/tracker/tracker.py → metatracker/tracker/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
from pathlib import Path
from typing import Callable

from cdftracker import log
from cdftracker.database import check_connection, create_session
from cdftracker.database.tables.file_level_table import FileLevelTable
from cdftracker.database.tables.file_type_table import FileTypeTable
from cdftracker.database.tables.instrument_configuration_table import InstrumentConfigurationTable
from cdftracker.database.tables.instrument_table import InstrumentTable
from cdftracker.database.tables.science_file_table import ScienceFileTable
from cdftracker.database.tables.science_product_table import ScienceProductTable
from metatracker import log
from metatracker.database import check_connection, create_session
from metatracker.database.tables.file_level_table import FileLevelTable
from metatracker.database.tables.file_type_table import FileTypeTable
from metatracker.database.tables.instrument_configuration_table import InstrumentConfigurationTable
from metatracker.database.tables.instrument_table import InstrumentTable
from metatracker.database.tables.science_file_table import ScienceFileTable
from metatracker.database.tables.science_product_table import ScienceProductTable


class CDFTracker:
class MetaTracker:
def __init__(self, engine, science_file_parser: Callable):
self.engine = engine

Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "cdftracker"
name = "metatracker"
version = "0.1.0"
description = "This is a python package that helps keep track of both Raw Binary and CDF Files in a Relational Database."
authors = ["Damian Barrous-Dume <fdamianbarrous@gmail.com>"]
repository = "https://github.com/dbarrous/CDFTracker"
documentation = "https://dbarrous.github.io/CDFTracker/"
repository = "https://github.com/dbarrous/MetaTracker"
documentation = "https://dbarrous.github.io/MetaTracker/"
readme = "README.md"
license = "Apache 2.0"
packages = [
{include = "cdftracker"}
{include = "metatracker"}
]

[tool.poetry.dependencies]
Expand Down Expand Up @@ -40,7 +40,7 @@ target-version = ['py37']
preview = true

[tool.mypy]
files = ["cdftracker"]
files = ["metatracker"]
disallow_untyped_defs = "True"
disallow_any_unimported = "True"
no_implicit_optional = "True"
Expand Down Expand Up @@ -100,6 +100,6 @@ skip_empty = true

[tool.coverage.run]
branch = true
source = ["cdftracker"]
source = ["metatracker"]


2 changes: 1 addition & 1 deletion tests/test_cdftracker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from cdftracker import get_config, log, set_config
from metatracker import get_config, log, set_config


def test_log() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_database/test_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from cdftracker.database import check_connection, create_engine, create_session
from metatracker.database import check_connection, create_engine, create_session


# Test create database engine
Expand Down
13 changes: 10 additions & 3 deletions tests/test_database/test_tables/test_tables.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from sqlalchemy import Column, Integer
from sqlalchemy.orm import declarative_base

from cdftracker import CONFIGURATION
from cdftracker.database import create_engine, create_session
from cdftracker.database.tables import create_table, create_tables, get_columns, get_tables, remove_tables, table_exists
from metatracker import CONFIGURATION
from metatracker.database import create_engine, create_session
from metatracker.database.tables import (
create_table,
create_tables,
get_columns,
get_tables,
remove_tables,
table_exists,
)

MISSION_NAME = CONFIGURATION.mission_name

Expand Down
Loading

0 comments on commit e8ebb0a

Please sign in to comment.