Pythonic way to read csv files from a folder in repository Background
In one of our repositories we have a folder called player_test where we store all player_test related .py files. We realized that there are certain static csv files we use to do some processing. So we decided to create a folder called player_test_input inside the player_test folder. The player_test_input should store all the csv files.
CODE
def get_player_call_logic_df() -&gt; pd.DataFrame:
    df = pd.read_csv(
        &quot;../dev/player-assignment/src/player_test/player_test_input/player_call_logic.csv&quot;
    )
    return df

Issue
In the above function get_player_call_logic_df I read the csv using relative path.
However I am not sure if there is a more pythonic way to do this?
We use pathlib quite a bit in our codebase and avoid using relative path but was not sure how that would apply in this case. I am always trying to figure out how i can use the modern python features and best practices more.
It seems to me that: 1) the path should be a function argument 2) but the function as it stands is very short and does only one thing - you actually don't need a function for this because there is nothing particular that can be reused.
Since the file is going to reside in a specific path, use a constant, it can be defined inside a config file. Quite likely, you may have other options or hardcoded stuff, so it's good to use a config file to keep it all in the same place.
eg:
config.py
PLAYER_FILES_DIR = &quot;/dev/player-assignment/src/player_test/player_test_input/&quot;

And then in your code you import the config file and you can refer to the location path as config.PLAYER_FILES_DIR:
import config

df = pd.read_csv(config.PLAYER_FILES_DIR...)
# do something

pathlib can still possibly be used if you intend to read multiple files from the directory.