simpeg / discretize

Discretization tools for finite volume and inverse problems.
http://discretize.simpeg.xyz/
MIT License
165 stars 34 forks source link

Reorganize from "Flat Layout" to "SRC Layout" #334

Closed omid-b closed 1 year ago

omid-b commented 1 year ago

Motivation

I am a Geophysicist at BHP Toronto and wanted to install and test SimPEG on my work machine. My work machine is a Windows laptop and there are various limitations when it comes to installation of anything on it. A work-around is to install on WSL (~Linux for Windows) and it gives full access to the drive enabling me to install SimPEG. When I tried pip install . to install SimPEG from the source code downloaded from the main repository, it did throw a bunch of errors, most of which related to compilation of the Cython and C extensions from discretize. These all happened despite the fact that I have the necessary compilers installed. Using the same approach on my personal old MacBook and Windows (WSL) machines, I faced similar issues. So, the main motivation was to fix my problem, but I realized that I could be more useful, and contribute to fix a couple of more issues for discretize on the way.

Main changes and tested task list

Note: the Azure testing configuration files perhaps should be modified now!

jcapriot commented 1 year ago

Thanks for putting work into this. We need to get discretize switched over to a pyproject.toml file as we consistently get errors due to people missing numpy and cython during a discretize installation from pip in fresh environments.

As you might have noticed, the full tests did not run as it failed the style checks. Check out https://docs.simpeg.xyz/content/getting_started/contributing/code-style.html for hints on the style.

I know I said this on slack, but seeing this here again solidifies my opinion. The change to a pyproject.toml file should be a PR all on its own. It will be faster to deal with build issues there (I can already see a few places where there will be issues considering the cpp std=17 flag not being correctly dealt with on windows systems).

Changing discretize to a src_layout is a differently scoped thing. Separating these two will allow us to deal with those problems specifically. There's several places in configuration files that assume the current folder layout.

omid-b commented 1 year ago

Thanks for taking the time to review this PR. Following your recommendation, I will close this PR and will break-down the tasks into two upcoming PRs. But before that, isn't the Azure's style check fails due to the relocation of files into src as I did not touch the source codes?