Skip to content

Commit

Permalink
Merge pull request #16 from mlexchange/organize
Browse files Browse the repository at this point in the history
Organize
  • Loading branch information
taxe10 authored Jun 5, 2024
2 parents a5f59b2 + 3688e19 commit 12fc662
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 33 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: mlex_latent_explorer

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*.py[cod]
*$py.class
test.py
**cache**

# output dir
results/
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.9
LABEL maintainer="THE MLEXCHANGE TEAM"

RUN ls

RUN pip3 install --upgrade pip &&\
pip3 install -r .

WORKDIR /app/work
ENV HOME /app/work
COPY src src

CMD ["bash"]
CMD python3 src/frontend.py
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@ To run this demo:
- clone this repo and then run `docker-compose up` in the main folder.
- Go to `http://0.0.0.0:8070/` in a brower.

## Developer Setup
If you are developing this library, there are a few things to note.

1. Install development dependencies:

```
pip install .
pip install ".[dev]"
```

2. Install pre-commit
This step will setup the pre-commit package. After this, commits will get run against flake8, black, isort.

```
pre-commit install
```

3. (Optional) If you want to check what pre-commit would do before commiting, you can run:

```
pre-commit run --all-files
```

4. To run test cases:

```
python -m pytest
```


## Copyright
MLExchange Copyright (c) 2023, The Regents of the University of California,
Expand Down
17 changes: 0 additions & 17 deletions docker/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions docker/requirements.txt

This file was deleted.

52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[project]
name = "mlex_latent_explorer"
version = "0.0.1"
authors = [
{ name="Runbo Jiang", email="[email protected]"}
]
description = "A web app to visualize latent vectors in 2D or 3D, supporting PCA and UMAP for dimension reduction."
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]

dependencies = [
"dash==2.9.3",
"dash-core-components==2.0.0",
"dash-bootstrap-components==1.0.2",
"dash-html-components==2.0.0",
"dash-iconify==0.1.2",
"plotly==5.14.1",
"scikit-learn==1.3.0",
"dash-uploader==0.6.0",
"requests==2.26.0",
"pyarrow==11.0.0",
"diskcache==5.6.3",
"dash_component_editor@git+https://github.com/mlexchange/mlex_dash_component_editor",
"mlex_file_manager@git+https://github.com/mlexchange/mlex_file_manager",
"Pillow",
"pandas",
"numpy",
"python-dotenv",
"prefect-client==2.14.21"
]

[project.optional-dependencies]
# These are required for developing the package (running the tests, building
# the documentation) but not necessarily required for _using_ it.
dev = [
"dash[testing]",
"flake8",
"pre-commit",
"pytest-mock",
"tiled[all]",
]

[project.urls]
Homepage = "https://github.com/mlexchange/mlex_latent_explorer"
Issues = "https://github.com/mlexchange/mlex_latent_explorer/issues/"

[tool.isort]
profile = "black"
Empty file added src/__init__.py
Empty file.
Empty file added src/assets/__init__.py
Empty file.
Empty file added src/test/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions src/test/layout_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from src.frontend import show_clustering_gui_layouts


def test_clustering_layout():
layout = show_clustering_gui_layouts("KMeans")
assert layout is not None
layout = show_clustering_gui_layouts("DBSCAN")
assert layout is not None
layout = show_clustering_gui_layouts("HDBSCAN")
assert layout is not None

0 comments on commit 12fc662

Please sign in to comment.