Skip to content

Commit

Permalink
Move import of egoio to if statement to avoid import on rtd
Browse files Browse the repository at this point in the history
  • Loading branch information
birgits committed Sep 6, 2023
1 parent 2a99b40 commit 47b0404
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion etrago/tools/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"""
Constraints.py includes additional constraints for eTraGo-optimizations
"""
import os
import logging

from egoio.tools import db
from pyomo.environ import Constraint
from pypsa.descriptors import expand_series
from pypsa.linopt import define_constraints, define_variables, get_var, linexpr
Expand All @@ -32,6 +32,9 @@
import pandas as pd
import pyomo.environ as po

if "READTHEDOCS" not in os.environ:
from egoio.tools import db

logger = logging.getLogger(__name__)

__copyright__ = (
Expand Down
5 changes: 4 additions & 1 deletion etrago/tools/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
Define class Etrago
"""

import os
import logging

from egoio.tools import db
from pypsa.components import Network
from sqlalchemy.orm import sessionmaker
import pandas as pd

if "READTHEDOCS" not in os.environ:
from egoio.tools import db

from etrago import __version__
from etrago.cluster.disaggregation import run_disaggregation
from etrago.cluster.electrical import ehv_clustering, run_spatial_clustering
Expand Down
4 changes: 3 additions & 1 deletion etrago/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import math
import os

from egoio.tools import db
from pyomo.environ import Constraint, PositiveReals, Var
from shapely.geometry import Point
import geopandas as gpd
Expand All @@ -38,6 +37,9 @@
import pypsa
import sqlalchemy.exc

if "READTHEDOCS" not in os.environ:
from egoio.tools import db

logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 47b0404

Please sign in to comment.