mapping-commons / sssom-py

Python toolkit for SSSOM mapping format
https://mapping-commons.github.io/sssom-py/index.html#
MIT License
49 stars 12 forks source link

Complex initialization should not be performed at time of imports #481

Closed cmungall closed 8 months ago

cmungall commented 8 months ago

sssom-py is doing too much object initialization at time of imports. As a rule, imports should only define functions, classes, constants, etc. And constants should only be defined using simple atomic terms, no function invocation.

@hrshdhgd and I spent some time getting rid of this a year or so ago, but it seems to have crept back in.

Specifically _get_sssom_schema_object is called at the top level here:

https://github.com/mapping-commons/sssom-py/blob/f4256047f75f8d0a286b7255f76ab884d16e049d/src/sssom/parsers.py#L333

I don't understand the need for this. Keep it simple. Set these things at run time, not at import time.

Overall I think the way sssom-py is approaching schema introspection is way too complex in general

cmungall commented 8 months ago

It seems this reversion is new - I don't get it with 0.4.1, this complexity was introduced with 0.4.2