Skip to content

Commit

Permalink
updating README based on new github flow (#30)
Browse files Browse the repository at this point in the history
* updating README based on new github flow

* Update makefile, readme

* Update README.md

---------

Co-authored-by: David Chanin <chanindav@gmail.com>
Co-authored-by: Daniel CH Tan <dtch1997@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 6, 2023
1 parent e8dd92b commit 62658d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ IMAGE_TAG ?= latest
default: help

update-deps: # update dependency lock files
python -m pip install --upgrade pip-tools pip wheel
python -m piptools compile --upgrade --resolver backtracking -o requirements/main.txt requirements/main.in pyproject.toml
python -m piptools compile --upgrade --resolver backtracking -o requirements/dev.txt requirements/dev.in
pdm run python -m pip install --upgrade pip-tools pip wheel
pdm run python -m piptools compile --upgrade --resolver backtracking -o requirements/main.txt requirements/main.in pyproject.toml
pdm run python -m piptools compile --upgrade --resolver backtracking -o requirements/dev.txt requirements/dev.in

init: # initialize project in a virtualenv
rm -rf .tox
python -m pip install --upgrade pip wheel
python -m pip install --upgrade -r requirements/main.txt -r requirements/dev.txt -e .
python -m pip check
pdm run python -m pip install --upgrade pip wheel
pdm run python -m pip install --upgrade -r requirements/main.txt -r requirements/dev.txt -e .
pdm run python -m pip check

update: update-deps init # update dependencies and reinitialize project

.PHONY: update-deps init update

style: # check code style
ruff .
black --check --diff .
pdm run ruff .
pdm run black --check --diff .

fmt: # run code formatter
black .
ruff --fix .
pdm run black .
pdm run ruff --fix .

typecheck: # run pyright
pyright
pdm run pyright

test: # run tests
pytest
pdm run pytest

.PHONY: style fmt test
.PHONY: style fmt test typecheck

.PHONY: build-docker
build-docker: # build docker container
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

Codebase for benchmarking Representation Engineering

## Installation
## Quickstart

### Dependencies

We use [PDM](https://github.com/pdm-project/pdm) to manage dependencies. We recommend `pipx`` installation. The documentation describes alternative installation methods.
```bash
pipx install pdm
```

### Installation

Setup is as simple as:
```bash
pdm install
pdm run pre-commit install
```

This creates a virtual environment in `.venv` with the appropriate libraries, installed from the PDM lock file.
This creates a virtual environment in `.venv` with the appropriate libraries, installed from the PDM lock file. We support Python >=3.10

The python interpreter can be accessed with `pdm run`. Scripts can be run with `pdm run <my_script.py>`.

Expand All @@ -25,20 +29,20 @@ If you cannot install the dependencies, try re-compiling with `pdm lock`.

## Development

branch structure:
`main` -> `dev` -> `[insert-name]-dev`

To update dependencies, modify `requirements/main.in`.

Then compile and freeze dependencies:
```bash
make update-deps
Activate the virtual environment with:
``` bash
source .venv/bin/activate
```
This will enable the pre-commit hooks to run on commit.

This creates frozen requirements in `requirements/main.txt` and `requirements.dev/txt` for reproducible installs.
Branching follows [Github workflow](https://githubflow.github.io/)

### Code Style

Run `make check` to check code format.

Run `make fmt` to run Black, Ruff linters.

Run `make typecheck` to run Pyright type checking

Run `make test` to run Pytest

0 comments on commit 62658d2

Please sign in to comment.