To make things clearer, code should be separated into folders based on where it's used and what are its dependencies.
In order, from "code that can be used everywhere in the package" to "code that can depend on all other code in the package":
folder tools/ with modules that depend on pandas, matplotlib etc. - no dependence on PfLine or PfState or tools2 or any other code in the package.
folder core/pfline/ with modules that depend on tools - no dependencies on pfstate or tools2.
folder core/pfstate/ with modules that depend on tools and pfline - no dependencies on tools2.
folder tools2/ with modules that depend on tools, pfline and pfstate.
Some remarks:
The shared/ folder inside core/ should not depend on pfline/ or pfstate/. It might be necessary to split these files up and move one part into pfline/ and one part into pfstate/.
The functions in visualise/ should be moved into the tools/ if they can comply to the rules above.
The folder tools2/ might contain similar functions as tools/, but generalised to also work for PfLine and PfState.
The most important functions in tools/ and tools2/ are exported to the root of the project in the __init__.py file.
To make things clearer, code should be separated into folders based on where it's used and what are its dependencies.
In order, from "code that can be used everywhere in the package" to "code that can depend on all other code in the package":
tools/
with modules that depend onpandas
,matplotlib
etc. - no dependence onPfLine
orPfState
ortools2
or any other code in the package.core/pfline/
with modules that depend ontools
- no dependencies onpfstate
ortools2
.core/pfstate/
with modules that depend ontools
andpfline
- no dependencies ontools2
.tools2/
with modules that depend ontools
,pfline
andpfstate
.Some remarks:
The
shared/
folder insidecore/
should not depend onpfline/
orpfstate/
. It might be necessary to split these files up and move one part intopfline/
and one part intopfstate/
.The functions in
visualise/
should be moved into thetools/
if they can comply to the rules above.The folder
tools2/
might contain similar functions astools/
, but generalised to also work forPfLine
andPfState
.The most important functions in
tools/
andtools2/
are exported to the root of the project in the__init__.py
file.Refactoring might help with https://github.com/rwijtvliet/portfolyo/issues/73