Closed julianharty closed 4 months ago
There are a several approaches that have been proposed in Find the root of the git repository where the file lives. They include:
To get something working I've decided to encapsulate the third of these, that uses pathlib
. I've tested it and at least one of the ones that uses GitPython. Both worked, it doesn't rely on us requiring GitPython so reduces the dependencies slightly.
The code also needs to be able to find other code modules we've created. https://stackoverflow.com/questions/7850908/what-exactly-should-be-set-in-pythonpath provides some possible approaches to addressing this dilemma e.g. using PYTHONPATH
or using pip
to install local packages. TBD what approach would work well for us and for this project.
Added the blocked below in the README:
After the nlnet
repository has been cloned, two options are available for configuring the repository structure based on the intended use of the provided .tsv
file:
.tsv
file should be placed directly in the data
folder within the project repository. This setup allows the scripts to be run without additional configuration..tsv
file. For example, a directory named nlnet_data
may be created. Once the .tsv
file is placed in this new directory, the path must be specified when running the script. The --input-file
flag should be used followed by the relative path to the .tsv file
, as shown below:
--input-file nlnet_data/tsv_file_name.tsv
Informative docstrings detailing the functionality and the supported command-line arguments have been provided at the beginning of each script. Additionally, the Scripts
section in the README.md offers further guidance on using these arguments.
There is a script utils/git_utils.py
--> Utility module for working with Git repositories in Python scripts.
Provides functions to determine the root of the current Git repository
and to handle decisions related to repository processing tasks.
input files and output file locations can be set to the default defined in the argparse
flags or can be provided as flags.
Context
The project does not contain the data file, this is provided separately. It's important to document the structure and expected location of that file in the repo so that others can use it successfully. The script should also be able to find the correct folder regardless of where it's run from. I ran the code from the root of the project and that means the folder is at
./data
rather than../data
.Changes requested
../data/
)pwd
in the python code may be sufficient to find thedata
folder relative to thesrc
folder.