Skip to content

Commit

Permalink
Merge branch 'main' into interaction-matrix-of-user
Browse files Browse the repository at this point in the history
  • Loading branch information
jhanley634 authored Nov 9, 2024
2 parents 3f6bc40 + 1b94f49 commit 08459c1
Show file tree
Hide file tree
Showing 19 changed files with 549 additions and 87 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,24 @@ jobs:
- name: Run tests
run: pipenv run pytest

ruff:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
# Update output format to enable automatic inline annotations.
- name: Run Ruff
run: ruff check --output-format=github .

8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"charliermarsh.ruff"
],
"unwantedRecommendations": [

]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
}
}
10 changes: 6 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ verify_ssl = true
name = "pypi"

[packages]
requests = "==2.26.0"
python-dotenv = "==1.0.1"
pytest = "==8.3.3"
pytest-cov = "==5.0.0"
python-dotenv = "~=1.0"
requests = "~=2.26"
ruff = "~=0.7"
tqdm = "~=4.66"

[dev-packages]
pytest = "~=8.3"
pytest-cov = "~=5.0"

[requires]
python_version = "3.12"
281 changes: 266 additions & 15 deletions Pipfile.lock

Large diffs are not rendered by default.

32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,43 @@ Currently, we are only accepting contributions from members of the project who m

## Development

This code uses Python 3, probably at least 3.9.
This code uses Python 3. It is tested on Python 3.12, but will probably work on versions back to 3.9.

To install the project dependencies, first install pipenv globally with `pip install pipenv`. Then create a virtual env/install dependencies with `pipenv install`.
To install the project dependencies, first install pipenv globally with `pip install pipenv`. Then create a virtual env/install dependencies with `pipenv install --dev`.

To run code in the project, prefix your command with `pipenv run`, a la `pipenv run python -m mediabridge.main`.

## Running main

The "main.py" script is part of the `mediabridge` module. Additionally, running it requires `pipenv run` as mentioned above. So the full command to run the main script (or any other script in the `mediabridge` module) is:

```
pipenv run python -m mediabridge.main
```

This should be run from the root of the project directory.

### Running from VSCode

To fix import errors and other Intellisense features, make sure you've let VSCode know about your pipenv environment. To do that:

1. Open the VSCode command palette (Control/Command+SHIFT+P)
2. Search for and select the "Python: Select Interpreter" command
3. Choose the option that starts with `MediaBridge`

## Testing

To run unit tests,

1. Ensure `pipenv` is installed
2. Run `pipenv run pytest`

There is a GitHub actions "check" for passing tests, which must pass for you to be able to merge your PR.

## Code formatting

We use [ruff](https://docs.astral.sh/ruff/) for code formatting, linting, and import sorting. If you've installed the project with the instructions above, you should have access to the `ruff` binary.

The repo comes with a `.vscode` directory that contains a recommended ruff extension, as well as settings to set ruff as your Python formatter and to format code and sort imports on save. If you're not using VSCode, you can run `ruff format` from the project root directory to format all Python code.

There is a GitHub actions "check" for code formatting, which will fail if you have unformatted code in your PR.
2 changes: 1 addition & 1 deletion mediabridge/config/setting.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Configuration settings (e.g., MongoDB URI, paths)
# Configuration settings (e.g., MongoDB URI, paths)
2 changes: 1 addition & 1 deletion mediabridge/data_processing/build_matrices.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Scripts to build interaction and feature matrices
# Scripts to build interaction and feature matrices
2 changes: 1 addition & 1 deletion mediabridge/data_processing/preprocess.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Data preprocessing scripts (e.g., feature extraction)
# Data preprocessing scripts (e.g., feature extraction)
Loading

0 comments on commit 08459c1

Please sign in to comment.