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

v0.2 - refactoring, fixes, and enhancements #155

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 14 additions & 13 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,24 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tools
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install uv
uv venv
source .venv/bin/activate
uv pip install ruff pytest
uv pip install .[dev,test,atac]
- name: Install dev dependencies
run: >
pip install
".[test]"
uv pip install
git+https://github.com/bioFAM/mofapy2
git+https://github.com/scverse/mudata
- name: List dependencies
run: |
pip list
- name: Lint with flake8
- name: Ruff check
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
source .venv/bin/activate
ruff check src/muon
- name: Test with pytest
run: |
pytest
source .venv/bin/activate
python -m pytest
16 changes: 0 additions & 16 deletions muon/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions muon/_atac/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions muon/_prot/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion muon/atac.py

This file was deleted.

1 change: 0 additions & 1 deletion muon/prot.py

This file was deleted.

1 change: 0 additions & 1 deletion muon/rna.py

This file was deleted.

113 changes: 85 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"
build-backend = "hatchling.build"
requires = ["hatchling", "hatch-vcs"]

[tool.flit.metadata]
module = "muon"
author = "Danila Bredikhin"
author-email = "[email protected]"
description-file = "README.md"
home-page = "https://github.com/scverse/muon"
[project]
name = "muon"
description = "Multimodal omics analysis framework"
requires-python = ">= 3.10"
license = "BSD-3-Clause"
authors = [
{ name = "Danila Bredikhin" },
]
maintainers = [
{ name = "Danila Bredikhin", email = "[email protected]" },
]
readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
Expand All @@ -16,14 +22,13 @@ classifiers = [
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Intended Audience :: Science/Research"
]
requires-python = ">= 3.10"
requires = [
dependencies = [
"numpy",
"pandas",
"matplotlib",
"seaborn",
"h5py",
"anndata",
"anndata >= 0.10.8",
"scanpy",
"scikit-learn",
"umap-learn",
Expand All @@ -32,33 +37,85 @@ requires = [
"tqdm",
"mudata",
]
dynamic = ["version"]

[tool.flit.metadata.requires-extra]
[project.urls]
Documentation = "https://muon.readthedocs.io/en/latest/"
Source = "https://github.com/scverse/muon"
Home-page = "https://muon.scverse.org/"

[project.optional-dependencies]
dev = [
"setuptools_scm",
]
docs = [
"sphinx >= 4.0",
"pydata-sphinx-theme==0.8.1",
"sphinx-book-theme==0.3.3",
"sphinx",
"sphinx-book-theme",
"pydata-sphinx-theme",
"readthedocs-sphinx-search",
"nbsphinx",
"sphinx_automodapi"
]
atac = [
"pybedtools",
"pysam"
"sphinx_automodapi",
"recommonmark"
]
test = [
"pytest",
"flake8",
"mofapy2",
"zarr",
]
# TODO: replace by a single depencency - chame
atac = [
"pybedtools",
"pysam",
]

[tool.flit.metadata.urls]
Documentation = "https://muon.readthedocs.io/en/latest/"

[tool.flit.sdist]
exclude = [".github", "docs/build"]

[tool.pytest.ini_options]
python_files = "test_*.py"
testpaths = [
"./tests", # unit tests
]

[tool.black]
line-length = 100
target-version = ['py37']
target-version = ['py39']

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/muon/_version.py"

[tool.hatch.build.targets.wheel]
packages = ["src/muon"]

[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/docs",
]

[tool.ruff]
src = ["src"]

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint]
select = [
"E", # Error detected by Pycodestyle
"F", # Errors detected by Pyflakes
"W", # Warning detected by Pycodestyle
"UP", # pyupgrade
"I", # isort
"TCH", # manage type checking blocks
"ICN", # Follow import conventions
"PTH", # Pathlib instead of os.path
"PT", # Pytest conventions
]
ignore = [
# line too long -> we accept long comment lines; formatter gets rid of long code lines
"E501",
# Do not assign a lambda expression, use a def -> AnnData allows lambda expression assignments,
"E731",
# allow I, O, l as variable names -> I is the identity matrix, i, j, k, l is reasonable indexing notation
"E741",
]
61 changes: 61 additions & 0 deletions src/muon/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Multimodal omics analysis framework"""

try: # See https://github.com/maresb/hatch-vcs-footgun-example
from setuptools_scm import get_version

__version__ = get_version(root="../..", relative_to=__file__)
except (ImportError, LookupError):
try:
from ._version import __version__
except ModuleNotFoundError:
raise RuntimeError("muon is not correctly installed. Please install it, e.g. with pip.")


from mudata import MuData
from mudata._core.io import (
read,
read_anndata,
read_h5ad,
read_h5mu,
read_zarr,
write_anndata,
write_h5ad,
write_h5mu,
write_zarr,
)

from . import _atac as atac
from . import _prot as prot
from . import _rna as rna
from ._core import plot as pl
from ._core import preproc as pp
from ._core import tools as tl
from ._core import utils
from ._core.config import set_options
from ._core.io import read_10x_h5, read_10x_mtx

__all__ = [
"__version__",
"MuData",
"pp",
"tl",
"pl",
"utils",
# mudata I/O
"read_h5mu",
"read_h5ad",
"read_anndata",
"read_zarr",
"write_h5mu",
"write_h5ad",
"write_anndata",
"write_zarr",
"read",
# muon I/O
"read_10x_h5",
"read_10x_mtx",
"set_options",
"atac",
"prot",
"rna",
]
6 changes: 6 additions & 0 deletions src/muon/_atac/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from . import plot as pl
from . import preproc as pp
from . import tools as tl
from .io import read_10x_h5, read_10x_mtx, read_snap

__all__ = ["pp", "tl", "pl", "read_10x_h5", "read_10x_mtx", "read_snap"]
Loading
Loading