diff --git a/py_tgx.egg-info/PKG-INFO b/py_tgx.egg-info/PKG-INFO index 3a297e1..f5aff51 100644 --- a/py_tgx.egg-info/PKG-INFO +++ b/py_tgx.egg-info/PKG-INFO @@ -13,6 +13,17 @@ Requires-Python: >=3.6 Description-Content-Type: text/markdown License-File: LICENSE +# Temporal Graph Analysis with TGX (to appear in WSDM 2024) + + +### Example Usage ### +TGX provides many built in datasets as well as supporting TGB datasets. In addition, TGX provides dataset discretization and visualization. +To get started, see our [starting example](https://github.com/ComplexData-MILA/TGX/blob/master/starting_example.py) +``` +python starting_example.py -d tgbl-wiki -t daily +``` + + ### Install dependency Our implementation works with python >= 3.9 and can be installed as follows @@ -27,10 +38,27 @@ source ~/tgx_env/bin/activate pip install -r requirements.txt ``` - 3. install local dependencies under root directory `/TGX` -``` + +``` +pip install -e . +``` + + + +3. [alternatively] install from test-pypi + +``` +pip install -i https://test.pypi.org/simple/ py-tgx +``` +You can specify the version with `==`, note that the pypi version might not always be the most updated version + + +4. [optional] install mkdocs dependencies to serve the documentation locally +``` +pip install mkdocs-glightbox ``` ### Creating new branch ### diff --git a/requirements.txt b/requirements.txt index dd40dc6..8edcd10 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +requests>=2.28.2 appdirs==1.4.4 args==0.1.0 certifi==2022.12.7 @@ -60,4 +61,4 @@ tzdata==2023.3 urllib3==1.26.15 virtualenv==20.0.18 wandb==0.16.3 -zipp==3.15.0 +zipp==3.15.0 \ No newline at end of file diff --git a/tgx/data/builtin.py b/tgx/data/builtin.py index fb9f005..4572c65 100644 --- a/tgx/data/builtin.py +++ b/tgx/data/builtin.py @@ -1,11 +1,14 @@ import pandas as pd import zipfile import urllib +import requests + __all__ = ["data"] root_path = "." + DataPath={ 'USLegis' : "/data/USLegis/ml_USLegis.csv", 'CanParl' : "/data/CanParl/ml_CanParl.csv", @@ -36,6 +39,18 @@ 'lastfm' : {'discretize' : True, 'time_scale': 'monthly'} } +def download(url: str, output_path: str): + get_response = requests.get(url,stream=True) + file_name = url.split("/")[-1] + fpath = output_path + file_name + with open(output_path + file_name, 'wb') as f: + for chunk in get_response.iter_content(chunk_size=1024): + if chunk: # filter out keep-alive new chunks + f.write(chunk) + return fpath + + + class builtin(object): def __init__(self): """ @@ -85,8 +100,8 @@ def download_file(self): print(path_download) print(url) if inp == 'y': - print(f"Download started, this might take a while . . .") - zip_path, _ = urllib.request.urlretrieve(url) + print(f"Downloading {self.name} dataset . . .") + zip_path = download(url, path_download) with zipfile.ZipFile(zip_path, "r") as f: f.extractall(path_download) print("Download completed")