diff --git a/cvrplib/list_names.py b/cvrplib/list_names.py index 836f7dac..32ff2975 100644 --- a/cvrplib/list_names.py +++ b/cvrplib/list_names.py @@ -1,3 +1,4 @@ +import importlib.resources as pkg_resource from functools import lru_cache from typing import Optional @@ -44,7 +45,7 @@ def list_names( @lru_cache() def _parse_instance_data(): - with open("cvrplib/instance_data.csv", "r") as fi: - instances = [line.strip().split(",") for line in fi.readlines()] + fi = pkg_resource.read_text(__package__, "instance_data.csv") + instances = [line.strip().split(",") for line in fi.split()] return [{"name": inst[0], "n_customers": int(inst[1])} for inst in instances] diff --git a/pyproject.toml b/pyproject.toml index 2a2e25de..f1bcfc27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cvrplib" -version = "1.0.0" +version = "0.1.1" description = "Python library for reading and downloading CVRPLIB instances." authors = ["Leon Lan "] license = "MIT"