Skip to content

Commit

Permalink
Use importlib for resources
Browse files Browse the repository at this point in the history
  • Loading branch information
GraysonBellamy committed Jun 11, 2024
1 parent 0178c0d commit 731d021
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pyalicat/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
dict: The dictionary of devices with the updated values.
"""

import importlib
import json
import re
import warnings
Expand All @@ -24,8 +25,11 @@ class VersionError(Exception):
pass


with open("codes.json") as f:
codes = importlib.resources.files("pyalicat").joinpath("codes.json")
with open(codes) as f:
codes = json.load(f)


statistics = codes["statistics"][0]
units = codes["units"][0]
gases = codes["gases"][0]
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pyAlicat"
version = "0.0.5"
version = "0.0.6"
description = "Python API for acquisition and control of Alicat mass flow meters and controllers."
packages = [{include = "pyalicat"}]
include = [{path = "pyalicat/codes.json", format = ["sdist", "wheel"]}]
readme = "README.md"
authors = ["ulfsri <[email protected]>"]
Expand Down

0 comments on commit 731d021

Please sign in to comment.