diff --git a/envision/server.py b/envision/server.py index 8069a6177f..065b898940 100644 --- a/envision/server.py +++ b/envision/server.py @@ -50,9 +50,6 @@ from envision.web import dist as web_dist from smarts.core.utils.file import path2hash -logging.basicConfig(level=logging.WARNING) - - # Mapping of simulation IDs to a set of web client run loops WEB_CLIENT_RUN_LOOPS = {} diff --git a/examples/e2_single_agent.py b/examples/e2_single_agent.py index 07d34570c1..da3d223761 100644 --- a/examples/e2_single_agent.py +++ b/examples/e2_single_agent.py @@ -1,11 +1,17 @@ """This example shows how you might run a SMARTS environment for single-agent work. SMARTS is natively multi-agent so a single-agent wrapper is used.""" import argparse +import logging import random import sys +import warnings from pathlib import Path from typing import Final +logging.basicConfig(level=logging.ERROR) +warnings.filterwarnings("ignore") + + import gymnasium as gym SMARTS_REPO_PATH = Path(__file__).parents[1].absolute() diff --git a/examples/replay/replay_klws_agent.py b/examples/replay/replay_klws_agent.py index b94c92c459..ae2abfeb34 100644 --- a/examples/replay/replay_klws_agent.py +++ b/examples/replay/replay_klws_agent.py @@ -14,8 +14,6 @@ from smarts.env.utils.observation_conversion import ObservationOptions from smarts.zoo.registry import make as zoo_make -logging.basicConfig(level=logging.INFO) - AGENT_ID = "Agent-007" @@ -116,6 +114,7 @@ def main(scenarios, sim_name, headless, seed, speed, max_steps, save_dir, write) if __name__ == "__main__": + logging.basicConfig(level=logging.INFO) parser = default_argument_parser("klws-agent-example") parser.add_argument( "--speed", diff --git a/smarts/__init__.py b/smarts/__init__.py index 607d6c6631..23907bd163 100644 --- a/smarts/__init__.py +++ b/smarts/__init__.py @@ -18,8 +18,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +try: + from importlib.metadata import version -import pkg_resources + VERSION = version("smarts") +except: + # This is now deprecated `https://setuptools.pypa.io/en/latest/pkg_resources.html` + import pkg_resources -# The full version, including alpha/beta/rc tags -VERSION = pkg_resources.get_distribution("smarts").version + # The full version, including alpha/beta/rc tags + VERSION = pkg_resources.get_distribution("smarts").version diff --git a/smarts/core/agent.py b/smarts/core/agent.py index 0116125067..9b0b3bee37 100644 --- a/smarts/core/agent.py +++ b/smarts/core/agent.py @@ -21,8 +21,6 @@ import warnings from typing import Any, Callable -warnings.simplefilter("once") - logger = logging.getLogger(__name__) diff --git a/smarts/zoo/agent_spec.py b/smarts/zoo/agent_spec.py index b44f23e4f6..70a0505fe5 100644 --- a/smarts/zoo/agent_spec.py +++ b/smarts/zoo/agent_spec.py @@ -27,8 +27,6 @@ from smarts.core.agent import Agent from smarts.core.agent_interface import AgentInterface -warnings.simplefilter("once") - @dataclass class AgentSpec(object):