RatInABox-Lab/RatInABox

Package structuring

TomGeorge1234 opened this issue · 8 comments

Long run we will probably look to changing the package structure of ratinabox so that Environments Agents and Neurons are modules. Each module should contain its one contribs folder (tidier this way rather than one global contribs containing loads of stuff). The package structure will eventually look something like this:

├── demos
├── dist
├── figures
└── ratinabox
    ├── README.md
    ├── __init__.py
    ├── Environments
    │   ├── __init__.py
    │   ├── Environment.py
    │   ├── SubEnvironment.py
    │   └── contribs
    ├── Agents
    │   ├── __init__.py
    │   ├── Agent.py
    │   ├── SubAgent.py
    │   └── contribs
    ├── Neurons
    │   ├── __init__.py
    │   ├── Neurons.py
    │   ├── PlaceCells.py
    │   ├── GridCells.py
    │   ├── ...
    │   └── contribs
    ├── data
    └── utils.py

I guess there are many ways to structure the python packages as there is not strict rule that python does follow. But I do particularly like the following article and a stack over flow answer:-

According to which we can structure the project in the following way :-

├── README.md
├── LICENSE.md
├── demos
├── dist
├── figures
└── ratinabox  
    ├── __init__.py
    ├── Environments
    │   ├── __init__.py
    │   ├── Environment.py
    │   ├── SubEnvironment.py
    │   └── contribs
    ├── Agents
    │   ├── __init__.py
    │   ├── Agent.py
    │   ├── SubAgent.py
    │   └── contribs
    ├── Neurons
    │   ├── __init__.py
    │   ├── Neurons.py
    │   ├── PlaceCells.py
    │   ├── GridCells.py
    │   ├── ...
    │   └── contribs
    ├── data
    └── utils.py
└── .gitignore

What do you think?

I guess there are many ways to structure the python packages as there is not strict rule that python does follow. But I do particularly like the following article and a stack over flow answer:-

* https://stackoverflow.com/a/19871661

* https://dev.to/codemouse92/dead-simple-python-project-structure-and-imports-38c6

According to which we can structure the project in the following way :-

├── README.md
├── LICENSE.md
├── demos
├── dist
├── figures
└── ratinabox  
    ├── __init__.py
    ├── Environments
    │   ├── __init__.py
    │   ├── Environment.py
    │   ├── SubEnvironment.py
    │   └── contribs
    ├── Agents
    │   ├── __init__.py
    │   ├── Agent.py
    │   ├── SubAgent.py
    │   └── contribs
    ├── Neurons
    │   ├── __init__.py
    │   ├── Neurons.py
    │   ├── PlaceCells.py
    │   ├── GridCells.py
    │   ├── ...
    │   └── contribs
    ├── data
    └── utils.py
└── .gitignore

What do you think?

The top level can also have the requirements.py , setup.py, ...

I can't quite tell the difference between this and what I put in the first one. But looks good to me, I agree

Closing and continuing discussion on PR #58

Just linking this to #64 re changing module names to lower-case to avoid import problems.

This could be backwards compatible if in each __init__ we import cells and list them in __all__ = PlaceCells, GridCells,...

Updated design:

├── README.md
├── LICENSE.md
├── .gitignore
├── demos
├── dist
├── figures
└── ratinabox  
    ├── __init__.py
    ├── ends
    │   ├── __init__.py
    │   ├── Environment.py
    │   ├── SubEnvironment.py
    │   └── contribs
    ├── agents
    │   ├── __init__.py
    │   ├── Agent.py
    │   ├── SubAgent.py
    │   └── contribs
    ├── neurons
    │   ├── __init__.py
    │   ├── Neurons.py
    │   ├── PlaceCells.py
    │   ├── GridCells.py
    │   ├── ...
    │   └── contribs
    ├── data
    └── utils.py

closing this for now