Skip to content

Commit

Permalink
Merge pull request #5 from Ottermatics/release
Browse files Browse the repository at this point in the history
Release Change Numbering | Application Testing | 0.0.9
  • Loading branch information
SoundsSerious authored Sep 11, 2024
2 parents 5e1c38b + d7dbf41 commit 8cebafe
Show file tree
Hide file tree
Showing 47 changed files with 1,215 additions and 523 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ jobs:

- uses: psf/black@stable
with:
version: "24.8.0"
options: "--check --verbose"
src: "./engforge"
41 changes: 23 additions & 18 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,54 @@

import os
import sys
sys.path.insert(0, os.path.abspath('..'))
#Source code dir relative to this file

project = 'engforge'
copyright = '2024, Kevin Russell'
author = 'Kevin Russell'
sys.path.insert(0, os.path.abspath(".."))
# Source code dir relative to this file

release = '1.0'
project = "engforge"
copyright = "2024, Kevin Russell"
author = "Kevin Russell"

release = "1.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"myst_parser",
"sphinx_autodoc_typehints"
"sphinx_autodoc_typehints",
]

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = "alabaster"
html_static_path = ["_static"]

autosummary_generate = True # Turn on sphinx.ext.autosummary
autoclass_content = "both" # Add __init__ doc (ie. params) to class summaries
html_show_sourcelink = False # Remove 'view source code' from top of page (for html, not python)
html_show_sourcelink = (
False # Remove 'view source code' from top of page (for html, not python)
)
autodoc_inherit_docstrings = True # If no docstring, inherit from base class
set_type_checking_flag = True # Enable 'expensive' imports for sphinx_autodoc_typehints
#nbsphinx_allow_errors = True # Continue through Jupyter errors
autodoc_typehints = "description" # Sphinx-native method. Not as good as sphinx_autodoc_typehints
add_module_names = False # Remove namespaces from class/method signatures
# nbsphinx_allow_errors = True # Continue through Jupyter errors
autodoc_typehints = (
"description" # Sphinx-native method. Not as good as sphinx_autodoc_typehints
)
add_module_names = False # Remove namespaces from class/method signatures

html_theme = "sphinx_rtd_theme"
html_css_files = ["readthedocs-custom.css"] # Override some CSS settings
html_css_files = ["readthedocs-custom.css"] # Override some CSS settings

#Set Assertion Bypass
os.environ['SPHINX_BUILD']='true'
# Set Assertion Bypass
os.environ["SPHINX_BUILD"] = "true"
2 changes: 1 addition & 1 deletion engforge.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: engforge
Version: 0.9.2
Version: 0.0.9
Summary: The Engineer's Framework
Home-page: https://github.com/SoundsSerious/engforge
Author: Kevin russell
Expand Down
14 changes: 8 additions & 6 deletions engforge.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
LICENSE
README.md
setup.cfg
setup.py
engforge/__init__.py
engforge/_testing_components.py
engforge/analysis.py
engforge/attr_dynamics.py
engforge/attr_plotting.py
Expand Down Expand Up @@ -33,7 +35,6 @@ engforge/typing.py
engforge.egg-info/PKG-INFO
engforge.egg-info/SOURCES.txt
engforge.egg-info/dependency_links.txt
engforge.egg-info/entry_points.txt
engforge.egg-info/not-zip-safe
engforge.egg-info/requires.txt
engforge.egg-info/top_level.txt
Expand All @@ -52,12 +53,8 @@ engforge/eng/solid_materials.py
engforge/eng/structure.py
engforge/eng/structure_beams.py
engforge/eng/thermodynamics.py
engforge/examples/__init__.py
engforge/examples/air_filter.py
engforge/examples/spring_mass.py
engforge/test/__init__.py
engforge/test/report_testing.py
engforge/test/solver_testing_components.py
engforge/test/test_airfilter.py
engforge/test/test_analysis.py
engforge/test/test_comp_iter.py
Expand All @@ -74,4 +71,9 @@ engforge/test/test_problem_deepscoping.py
engforge/test/test_slider_crank.py
engforge/test/test_solver.py
engforge/test/test_structures.py
engforge/test/test_tabulation.py
engforge/test/test_tabulation.py
examples/__init__.py
examples/air_filter.py
examples/field_area.py
examples/spring_mass.py
test/test_problem.py
2 changes: 0 additions & 2 deletions engforge.egg-info/entry_points.txt

This file was deleted.

1 change: 1 addition & 0 deletions engforge.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
engforge
examples
2 changes: 1 addition & 1 deletion engforge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from engforge.analysis import Analysis
from engforge.env_var import EnvVariable
from engforge.problem_context import ProblemExec

from engforge.system_reference import Ref
from engforge.env_var import EnvVariable
from engforge.logging import LoggingMixin, change_all_log_levels

Expand Down
2 changes: 0 additions & 2 deletions engforge/attr_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ class Solver(ATTR_BASE):
active: bool
instance_class = SolverInstance

define = None

@classmethod
def configure_for_system(cls, name, config_class, cb=None, **kwargs):
"""add the config class, and perform checks with `class_validate)
Expand Down
48 changes: 40 additions & 8 deletions engforge/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,35 @@ def property_changed(instance, variable, value):
if log.log_level <= 2:
log.debug(f"already property changed {instance}{variable.name} {value}")
return value

# elif session:
# notify session that this variable has changed
# log.info(f'property changed {variable.name} {value}')
# TODO: notify change input system here, perhaps with & without a session
# session.change_sys_var(variable,value,doset=False)

attrs = attr.fields(instance.__class__) # check identity of variable
cur = getattr(instance, variable.name)
is_different = value != cur
is_var = variable in attrs
chgnw = instance._anything_changed

if log.log_level <= 6:
log.debug(f"checking property changed {instance}{variable.name} {value}")
log.debug(
f"checking property changed {instance}{variable.name} {value}|invar: {is_var}| nteqval: {is_different}"
)

# Check if should be updated
cur = getattr(instance, variable.name)
attrs = attr.fields(instance.__class__) # check identity of variable
if not instance._anything_changed and variable in attrs and value != cur:
if not chgnw and is_var and is_different:
if log.log_level < 5:
log.debug(f"changing variables: {variable.name} {value}")
instance._anything_changed = True

elif log.log_level < 4 and variable in attrs:
log.warning(f"didnt change variables {variable.name}| {value} == {cur}")
elif log.log_level < 4 and is_var and not is_different:
log.warning(f"variables same {variable.name}| {value} == {cur}")

# If active session in dynamic mode and the component is dynamic, flag for matrix update
# TODO: determine if dynamic matricies affected by this.

if session and session.dynamic_solve and instance.is_dynamic:
# log.info(f'dynamics changed')
session.dynamics_updated = True # flag for update
Expand All @@ -209,6 +219,23 @@ def signals_slots_handler(

log.debug(f"transforming signals and slots for {cls.__name__}")

# add attrs attributes from mro parent class
# TODO: work on this to allow attrs from non attrs classes
# fd = {f.name:f for f in fields}
# has_fields = set(list(fd.keys()))
#
# if cls._inherit_parent_attributres:
# non_dec_attrs = {} #get all attrs variables from non-decorated mixins
# for icls in cls.mro():
# if attrs.has(icls):
# print(icls,str(list(attrs.fields_dict(icls).keys()))[:100])
# atr_dict = {k:v.evolve(icls) for k,v in icls.__dict__.items() if isinstance(v,attrs.Attribute)}
# non_dec_attrs.update({k:v for k,v in atr_dict.items() if k not in non_dec_attrs and k not in has_fields})
# if non_dec_attrs:
# log.info(f'adding non decorated attrs: {list(non_dec_attrs.keys())}')
# fields = fields + list(non_dec_attrs.values())

# Fields
for t in fields:
if t.name in PROTECTED_NAMES:
raise Exception(f"cannot use {t.name} as a field name, its protected")
Expand Down Expand Up @@ -353,6 +380,7 @@ class Configuration(AttributedBaseMixin):
kw_only=True,
)

_inherit_parent_attributres = True
log_fmt = "[%(name)-24s]%(message)s"
log_silo = True

Expand Down Expand Up @@ -516,7 +544,7 @@ def __attrs_post_init__(self):
for compnm, comp in self.internal_configurations(False).items():
if isinstance(comp, Component):
# TODO: allow multiple parents
if (not hasattr(comp, "parent")) and (comp.parent is not None):
if (hasattr(comp, "parent")) and (comp.parent is not None):
self.warning(
f"Component {compnm} already has a parent {comp.parent} copying, and assigning to {self}"
)
Expand All @@ -528,14 +556,18 @@ def __attrs_post_init__(self):

# subclass instance instance init causes conflicts in structures
self.__on_init__()
runs = set((self.__class__.__on_init__,)) # keep track of unique functions
if self._subclass_init:
try:
for comp in self.__class__.mro():
if (
hasattr(comp, "__on_init__")
and comp.__on_init__ != Configuration.__on_init__
and comp.__on_init__ not in runs
):
comp.__on_init__(self)
runs.add(comp.__on_init__)

except Exception as e:
self.error(e, f"error in __on_init__")

Expand Down
2 changes: 1 addition & 1 deletion engforge/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def split_dataframe(df: pandas.DataFrame) -> tuple:
for s in df:
c = df[s]
if is_uniform(c):
uniform[s] = c[0]
uniform[s] = c.iloc[0]

df_unique = df.copy().drop(columns=list(uniform))
return uniform, df_unique if len(df_unique) > 0 else df_unique
Expand Down
4 changes: 2 additions & 2 deletions engforge/datastores/datastores_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ pydrive2==1.8.1
boto3

#deco
ray[default]~=2.7.1
ray[tune]~=2.7.1
ray[default]~=2.35.0
ray[tune]~=2.35.0
sqlalchemy-batch-inserts
2 changes: 2 additions & 0 deletions engforge/eng/costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ def _gather_cost_references(self, parent: "System"):
child = comps[kbase]
if (
isinstance(child, CostModel)
and hasattr(child.parent, "_slot_costs")
and child.parent._slot_costs
and comp_key in child.parent._slot_costs
):
self.debug(f"adding cost for {kbase}.{comp_key}")
Expand Down
Loading

0 comments on commit 8cebafe

Please sign in to comment.