Skip to content

Commit

Permalink
Merge pull request #24 from gizatechxyz/feature/giza_namespace
Browse files Browse the repository at this point in the history
add Giza as a namespace package
  • Loading branch information
alejandromartinezgotor authored May 22, 2024
2 parents 8315e4d + 3b4da3f commit 1a42c0d
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/onpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
poetry install
- name: Lint with ruff
run: |
poetry run ruff giza_datasets
poetry run ruff giza
# Bring back when tests area working
# - name: Testing
# run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/onrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
poetry install
- name: Lint with ruff
run: |
poetry run ruff giza_datasets
poetry run ruff giza
- name: Build dist
run: poetry build
- name: Publish a Python distribution to PyPI
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To get started with Giza Datasets, follow the steps below:
```
2. Import the `DatasetsLoader` class and initialize it:
```python
from giza_datasets import DatasetsLoader
from giza.datasets import DatasetsLoader
loader = DatasetsLoader()
```
3. Optional: Depending on your device's configuration, it may be necessary to provide SSL certificates to verify the authenticity of HTTPS connections. You can ensure that all these certifications are correct by executing the following line of code:
Expand Down Expand Up @@ -56,7 +56,7 @@ To get started with the `DatasetsHub` class, follow the steps below:

1. Import the `DatasetsHub` class and initialize it:
```python
from giza_datasets import DatasetsHub
from giza.datasets import DatasetsHub
hub = DatasetsHub()
```
2. Use the `show` method to print a table of all datasets in the hub:
Expand Down
4 changes: 4 additions & 0 deletions giza/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from giza.datasets.hub import DatasetsHub
from giza.datasets.loaders import DatasetsLoader

__all__ = ["DatasetsLoader", "DatasetsHub"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import polars as pl
import pyarrow.dataset as ds
import os


class CacheManager:
Expand Down
7 changes: 3 additions & 4 deletions giza_datasets/constants.py → giza/datasets/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from giza_datasets.defillama_constants import DEFILLAMA_SUPPORTED_PROJECTS
from giza_datasets.models import Dataset
from giza.datasets.defillama_constants import DEFILLAMA_SUPPORTED_PROJECTS
from giza.datasets.models import Dataset

APPLICATION_TAGS = ["Liquid Staking", "Dexes", "Yield", "Lending", "Yield Aggregator"]

Expand Down Expand Up @@ -2284,7 +2284,7 @@
name="curve-daily-volume-fees",
path="gs://datasets-giza/Curve/curve_daily_volume_fees.parquet",
description="Daily Curve trade volume and fees generated in USD, per pool",
tags=["Curve","Trade Volume","Fees" ,"daily", "DeFi", "DEX"],
tags=["Curve", "Trade Volume", "Fees", "daily", "DeFi", "DEX"],
documentation="https://datasets.gizatech.xyz/hub/curve/daily-trade-volume-and-fees",
),
Dataset(
Expand All @@ -2302,4 +2302,3 @@
documentation="",
),
]

File renamed without changes.
2 changes: 1 addition & 1 deletion giza_datasets/hub.py → giza/datasets/hub.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from rich.console import Console
from rich.table import Table

from giza_datasets.constants import DATASET_HUB
from giza.datasets.constants import DATASET_HUB


class DatasetsHub:
Expand Down
10 changes: 6 additions & 4 deletions giza_datasets/loaders.py → giza/datasets/loaders.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os

import gcsfs
import polars as pl
import os
from giza_datasets.constants import DATASET_HUB
from giza_datasets.cache_manager import CacheManager

from giza.datasets.cache_manager import CacheManager
from giza.datasets.constants import DATASET_HUB


class DatasetsLoader:
Expand All @@ -18,7 +20,7 @@ def __init__(self, use_cache=True, cache_dir=None):
self.cache_dir = (
cache_dir
if cache_dir is not None
else os.path.join(os.path.expanduser("~"), ".cache/giza_datasets")
else os.path.join(os.path.expanduser("~"), ".cache/giza.datasets")
)
self.cache_manager = CacheManager(self.cache_dir) if use_cache else None

Expand Down
4 changes: 2 additions & 2 deletions giza_datasets/models.py → giza/datasets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from pydantic import BaseModel

from giza_datasets.defillama_constants import DEFILLAMA_SUPPORTED_PROJECTS
from giza.datasets.defillama_constants import DEFILLAMA_SUPPORTED_PROJECTS

sector_tags = ["DeFi","Social"]
sector_tags = ["DeFi", "Social"]
application_tags = ["Liquid Staking", "DEX", "Yield", "Lending", "Yield Aggregator"]
protocol_tags = DEFILLAMA_SUPPORTED_PROJECTS + [
"Aave-v2",
Expand Down
4 changes: 0 additions & 4 deletions giza_datasets/__init__.py

This file was deleted.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ description = ""
authors = ["Fran Algaba <f.algaba@outlook.es>"]
readme = "README.md"
license = "MIT"
include = ["datasets/*"]

packages = [{include = "giza"}]

[tool.poetry.dependencies]
python = "^3.11"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import polars as pl
import pytest

from giza_datasets import DatasetsLoader
from giza.datasets import DatasetsLoader


def test_load_dataset_eager():
Expand Down

0 comments on commit 1a42c0d

Please sign in to comment.