Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slipmap #1

Merged
merged 11 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m pip install --upgrade pip build
- name: Build package
run: |
python -m build
python -c "import os, glob; assert os.path.getsize(sorted(glob.glob('dist/*-*.whl'))[-1]) > 10_000"
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
run: python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
42 changes: 32 additions & 10 deletions .github/workflows/python-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,57 @@
name: tests

on:
workflow_dispatch:
push:
branches: [master, main]
paths: ["**.py"]
pull_request:
paths: ["**.py"]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest build
python -m pip install --editable .
python -m pip install xiplot pytest pytest-cov
python -m pip install -e .
- name: Test with pytest
run: |
pytest --cov-report term --cov=slisemap_interactive --cov-fail-under=70

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: python -m pip install --upgrade pip build
- name: Build package
run: |
rm -f dist/*.whl
python -m build
python -c "import os, glob; assert os.path.getsize(sorted(glob.glob('dist/*-*.whl'))[-1]) > 10_000"
- name: Test with pytest
python -c "import os, glob; assert os.path.getsize(glob.glob('dist/*.whl')[-1]) > 10_000"

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: python -m pip install --upgrade pip ruff
- name: Lint with Ruff
run: |
pytest
ruff check --output-format=github
ruff format --check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ poetry.toml
*.sm
*.tmp
*.txt
!*requitements*.txt
*.sp
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ To use the plugin, just install the package in the same Python environment as [

## Installation

To install __slisemap_interactive__ without manually downloading the repository run:
To install __slisemap_interactive__ run one of the following commands:

```bash
pip install slisemap_interactive
pip install slisemap_interactive[xiplot]
pip install git+https://github.com/edahelsinki/slisemap_interactive
```

Expand Down
51 changes: 48 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "slisemap_interactive"
version = "0.5.0"
version = "0.6.0"
description = "Interactive plots for Slisemap using Dash"
readme = "README.md"
license = { text = "MIT" }
Expand All @@ -29,13 +29,14 @@ dependencies = [

[project.optional-dependencies]
xiplot = ["xiplot"]
dev = ["pytest", "black[jupyter]", "pylint", "jupyter", "IPython"]
dev = ["pytest", "pytest-cov", "black[jupyter]", "ruff", "jupyter", "IPython"]

[project.urls]
github = "https://github.com/edahelsinki/slisemap_interactive"

[project.entry-points."xiplot.plugin.read"]
xiplot_plugin_load = "slisemap_interactive.xiplot:plugin_load"
xiplot_plugin_load_slisemap = "slisemap_interactive.xiplot:load_slisemap"
xiplot_plugin_load_slipmap = "slisemap_interactive.xiplot:load_slipmap"

[project.entry-points."xiplot.plugin.plot"]
xiplot_plugin_embeddingplot = "slisemap_interactive.xiplot:SlisemapEmbeddingPlot"
Expand All @@ -50,3 +51,47 @@ slisemap_interactive = "slisemap_interactive.app:cli"

[tool.setuptools]
packages = ["slisemap_interactive"]

[tool.coverage.run]
branch = true

[tool.coverage.report]
exclude_also = ["print", "ImportError"]

[tool.ruff.lint]
select = [
"I",
"E",
"F",
"B",
"C4",
"W",
"D",
"UP",
"ANN",
"SIM",
"RUF",
"S",
"N",
]
ignore = [
"E501",
"B006",
"D105",
"D203",
"D204",
"D406",
"D213",
"D407",
"D413",
"ANN101",
"ANN102",
"ANN401",
"S101",
"N802",
"N803",
"N806",
]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["D", "ANN"]
44 changes: 23 additions & 21 deletions slisemap_interactive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
"""
Slisemap - Interactive: A Dash app for interactively visualising Slisemap objects
=================================================================================
"""Slisemap - Interactive: A Dash app for interactively visualising Slisemap objects.
=================================================================================

Use the `plot` function for non-blocking interactive plots in notebooks and interactive interpreters.
In (non-Python) terminals you can call `slisemap_interactive` to start a standalone application.
Finally, this package also integrates into χiplot as a plugin.
Use the `plot` function for non-blocking interactive plots in notebooks and interactive interpreters.
In (non-Python) terminals you can call `slisemap_interactive` to start a standalone application.
Finally, this package also integrates into χiplot as a plugin.

Relevant links:
---------------
Relevant links:
---------------

- [GitHub repository](https://github.com/edahelsinki/slisemap_interactive)
- [Slisemap](https://github.com/edahelsinki/slisemap)
- [χiplot](https://github.com/edahelsinki/xiplot)
- [Dash](https://dash.plotly.com/)
"""
- [GitHub repository](https://github.com/edahelsinki/slisemap_interactive)
- [Slisemap](https://github.com/edahelsinki/slisemap)
- [χiplot](https://github.com/edahelsinki/xiplot)
- [Dash](https://dash.plotly.com/)
""" # noqa: D205

from slisemap_interactive.app import plot, shutdown, BackgroundApp, ForegroundApp
from slisemap_interactive.load import load, slisemap_to_dataframe


def __version__():
from importlib.metadata import version

return version("slisemap_interactive")
from slisemap_interactive.app import ( # noqa: F401
BackgroundApp,
ForegroundApp,
plot,
shutdown,
)
from slisemap_interactive.load import ( # noqa: F401
load,
slipmap_to_dataframe,
slisemap_to_dataframe,
)
3 changes: 3 additions & 0 deletions slisemap_interactive/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Run the slisemap_interactive app."""

import sys

from slisemap_interactive.app import cli

# This script is only called when there is a local copy of the repository,
Expand Down
Loading