Closed rbturnbull closed 2 years ago
@rbturnbull That makes sense to me. If I want the components of the package to be importable via statements like
from teiphy import Collation
do I leave the teiphy.py
script in place and add something to it to export these variables?
we can sort that out in the __init__.py
. I've already added some code for that and we can adapt it when the files are split.
Okay, I've separated teiphy.py
into common.py
(containing shared variables like xml_ns
and tei_ns
), witness.py
, reading.py
, variation_unit.py
, and collation.py
, and I've separated the test scripts similarly. How should I change __init__.py
so that I can import these classes in the unit tests?
Great work. You now need to add this to __init__.py
:
from .witness import Witness from .variation_unit import VariationUnit from .collation import Collation from .reading import Reading
All right, I have it split up with all tests passing! The old teiphy.py
script is empty now; can it be removed since the teiphy
package is now exposed via the __init__.py
script?
yep - that's right
Hi @jjmccollum - the teiphy.py file is quite big. I think it would be good to split it up into separate files. How about one file per class. i.e. Collation can be in collation.py and Witness can be in witness.py.
I'd do the same with the tests and have a test_witness.py and a test_collation.py etc.
What do you think?