datactive / bigbang

Scientific analysis of collaborative communities
http://datactive.github.io/bigbang/
MIT License
149 stars 52 forks source link

Suggestion for dynamic path management #407

Closed Christovis closed 3 years ago

Christovis commented 3 years ago

In this PR I suggest a more dynamic path management. As a result of you can, i.e. run single tests within the test folder as opposed to running all the test from the root/project folder.

I introduced the pathlib library as it is in most cases syntactically shorter and easier to read than os.path.

In another step I would actually suggest to move the part of the code that sets ups the paths into /bigbang/ itself instead of having it in the /config/ folder. As the project structure should ideally change little, the part that manages the orientation within it (indicating the paths), shouldn't need to be changed either.

Let me know what you think.

sbenthall commented 3 years ago

The way we were trying to build around this before was with the config file, where paths in the file system are hard-coded.

https://github.com/datactive/bigbang/blob/master/config/config.yml

How does this system improve on that other system? interact with it?

Christovis commented 3 years ago

One benefit I see from incorporating absolute paths to the directory where the user is in (I have called the the working_directory), is that does not matter from where one executes a test. E.g. as it is now, one has to execute the test from the project directory, as the test_data_path is fixed to be /tests/data/. But with this PR on can be inside the /tests/ folder and the test_data_path would dynamically change to /data/. Does it make sense?

sbenthall commented 3 years ago

Is that the only use case? I think there may be a simpler way to solve that problem.

The code you are introducing does a lot; maybe it should be its own package on PyPI? It seems like a lot of functionality which is much more general than BigBang.

sbenthall commented 3 years ago

I gather we decided not to proceed with this one. Closing.