Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class iterators #78

Merged
merged 46 commits into from
Feb 12, 2024
Merged

Class iterators #78

merged 46 commits into from
Feb 12, 2024

Conversation

PMeira
Copy link
Member

@PMeira PMeira commented Mar 13, 2020

Extensive changes:

  • migrate to classes
  • add support for multiple DSSContexts
  • use more enums
  • update documentation in general, and migrate to MyST and autodoc2 (required some monkey-patching for the time being) -- docs are fully Markdown now, including docstrings
  • migrate to PyProject.toml, with hatchling and versioningit instead of setuptools
  • add NumPy support; although installing Pandas already installs NumPy, and optionally SciPy, we added

Closes #55, closes #56, closes #60, closes #70, closes #103.

@PMeira
Copy link
Member Author

PMeira commented Mar 13, 2020

At the moment this would work for most classes:

image

I need to test some other things to be sure everything planned in #55 can be done without issues.

@PMeira PMeira force-pushed the class_iterators branch 3 times, most recently from d6753b1 to 6cea0c2 Compare August 3, 2020 14:13
@PMeira PMeira mentioned this pull request Mar 9, 2022
@PMeira PMeira mentioned this pull request Jul 6, 2022
@PMeira PMeira force-pushed the class_iterators branch from 6cea0c2 to e504ee0 Compare July 15, 2022 21:26
@PMeira
Copy link
Member Author

PMeira commented Jul 15, 2022

In [1]: from opendssdirect import Loads

In [2]: import opendssdirect as odd

In [3]: odd.Text.Command('redirect ../electricdss-tst/Distrib/EPRITestCircuits/ckt5/Master_ckt5.dss')

In [4]: len(Loads)
Out[4]: 1379

In [5]: from opendssdirect.Loads import Name

In [6]: Name()
Out[6]: 'mdv201_hn_2_133_abc8083-1a3'

This current version is almost there. The only change in the tests was changing the asserts for modules, since they're not anymore in the final names. The modules still exist though (as shown in from opendssdirect.Loads import Name), so we should be safe if users imported only parts.

A few modules like YMatrix and Monitors will still be migrated. After that, we can introduce DSS contexts without too much hassle.

@PMeira PMeira force-pushed the class_iterators branch 2 times, most recently from 79768ce to 4bb762e Compare July 16, 2022 13:25
@PMeira PMeira changed the title [WIP] Class iterators Class iterators Jul 16, 2022
@PMeira
Copy link
Member Author

PMeira commented Jul 16, 2022

Still needs some final clean-up (some __slots__ shouldn't exist) and some work from #103 could be merged too (especially updated tests).

The docs seem to be generated without issues already, I thought it would need more work.

@PMeira PMeira marked this pull request as ready for review July 16, 2022 13:40
@PMeira PMeira requested a review from kdheepak July 16, 2022 13:43
@PMeira PMeira force-pushed the class_iterators branch from 60df7a0 to faa5e3b Compare July 16, 2022 14:58
@PMeira
Copy link
Member Author

PMeira commented Mar 29, 2023

I have to rebase, document and update this. After that, this should be v0.9.0

@PMeira PMeira force-pushed the class_iterators branch from faa5e3b to 5969c5f Compare April 2, 2023 07:04
@PMeira
Copy link
Member Author

PMeira commented Apr 2, 2023

Remaining steps:

  • implement toggling ndarray vs list (that's why some of the tests are failing), per Use environment variable for numpy version #103
  • decide (added) if we want to toggle complex and shaped arrays too (the DSS.AdvancedTypes in DSS-Python).
    • needs tests
  • check/test some third-party modules that use ODD.py to see what issues users can expect
    • try to work around the most common issues
    • DiTTo
    • PyDSS
  • add DSSContexts
  • update the docs/tests/examples to use the new iterators

… recent pytest versions.

FPC uses exception, including Windows native exceptions, in ways that the fault handler doesn't like. This is normal and expected though, so we can disable the handler during import, when FPC's runtime is being initialized.
@PMeira
Copy link
Member Author

PMeira commented Dec 14, 2023

  • For DiTTo, the only mandatory change was actually related to the property naming styles, which isn't directly related to this PR but the changes in DSS C-API.

This will enough to handle that (needs latest commits here and from DSS-Python):

from opendssdirect import dss, enums as dss_enums
dss.Settings.SetPropertyNameStyle(dss_enums.DSSPropertyNameStyle.Legacy)

@PMeira PMeira merged commit 4f4457c into master Feb 12, 2024
15 checks passed
@PMeira PMeira deleted the class_iterators branch February 12, 2024 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant