Skip to content

Commit

Permalink
Add post-install script
Browse files Browse the repository at this point in the history
  • Loading branch information
jopetty committed May 17, 2024
1 parent 78d5077 commit a3be66c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# ml-research-kit
# PROJECT_NAME

A template for developing an ML experimentation framework.

## Setup

The first think you should do is run the `post-install.sh` script to configure the name
of the project; this script will change every instance of `PROJECT_NAME` to be
whatever you pass as an argument:

```bash
bash scripts/post-install.sh my_project
```

In particular, this will change the name of the project in the `pyproject.toml` file and
the name of the associated Conda environment.

## Local Installation

All python dependencies are provided in `pyproject.toml`. Install using `uv`:
Expand All @@ -17,6 +30,14 @@ To generate a set of locked dependencies, run
uv pip compile pyproject.toml -o requirements.txt
```

If you need to use Conda instead, you can do so by creating a new environment from
the provided `environment.yml` file, which will just wrap the `pyproject.toml` file with
pip:

```bash
conda env create -f environment.yml
```


## Docker / Devcontainer

Expand Down
8 changes: 8 additions & 0 deletions scripts/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

OLD_PROJECT_NAME="PROJECT_NAME"
SEARCH_DIR=$( cd "$(dirname $(dirname "${BASH_SOURCE[0]}"))" ; pwd -P )

# Replace the value of OLD_PROJECT_NAME with $1 in every file in the project
# except for the post-install.sh script
grep $OLD_PROJECT_NAME $SEARCH_DIR -lr --exclude="*post-install.sh" | xargs sed -i '' -e 's/'$OLD_PROJECT_NAME'/'$1'/g'

0 comments on commit a3be66c

Please sign in to comment.