Skip to content

Commit

Permalink
Merge pull request #264 from nlesc-nano/pkg
Browse files Browse the repository at this point in the history
MAINT: Get rid `pkg_resources`
  • Loading branch information
BvB93 authored May 8, 2023
2 parents b8349e6 + d8b7b4f commit 843ec89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
20 changes: 14 additions & 6 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/conf.py

# Configuration for the documentation build process.
# This allows you to specify the base Read the Docs image used to build the documentation,
# and control the versions of several tools: Python, Node.js, Rust, and Go.
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Optionally build your docs in additional formats such as PDF
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
install:
- method: pip
path: .
extra_requirements:
- doc
install:
- method: pip
path: .
extra_requirements:
- doc
7 changes: 4 additions & 3 deletions CAT/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import threading
import functools
import pprint
import pkg_resources as pkg
from types import MappingProxyType, TracebackType
from shutil import rmtree
from logging import Logger
Expand All @@ -60,6 +59,7 @@
from_smiles, AMSJob, ADFJob, Cp2kJob, DiracJob, GamessJob, CRSJob
)

from . import __file__ as _cat_file
from .logger import logger
from .mol_utils import to_atnum
from .gen_job_manager import GenJobManager
Expand Down Expand Up @@ -140,8 +140,9 @@ def get_template(template_name: str, from_cat_data: bool = True) -> Settings:
"""Grab a yaml template and return it as Settings object."""
if from_cat_data:
path = join('data/templates', template_name)
xs = pkg.resource_string('CAT', path)
return Settings(yaml.load(xs.decode(), Loader=yaml.FullLoader))
xs = os.path.dirname(_cat_file)
with open(os.path.join(xs, path), "r", encoding="utf8") as f:
return Settings(yaml.load(f.read(), Loader=yaml.FullLoader))
with open(template_name, 'r') as file:
return Settings(yaml.load(file, Loader=yaml.FullLoader))

Expand Down

0 comments on commit 843ec89

Please sign in to comment.