Skip to content

Commit

Permalink
Add metadata and adjust as necessary to make it a functional package (#2
Browse files Browse the repository at this point in the history
)

* add project metadata

* adjust imports

* add __init__ files

* pre-commit
  • Loading branch information
jaimergp authored Apr 25, 2023
1 parent fe330f2 commit 9fe2e15
Show file tree
Hide file tree
Showing 11 changed files with 380 additions and 28 deletions.
85 changes: 85 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
.napari_cache

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask instance folder
instance/

# Sphinx documentation
docs/_build/

# MkDocs documentation
/site/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# OS
.DS_Store

# written by setuptools_scm
*/_version.py

# pycharm stuff
.idea/

# ruff stuff
.ruff_cache/
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.3
hooks:
- id: pycln
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
pass_filenames: true
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.237
hooks:
- id: ruff
- repo: https://github.com/seddonym/import-linter
rev: v1.7.0
hooks:
- id: import-linter
stages: [manual]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
hooks:
- id: check-github-workflows
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2018, Napari
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# napari-plugin-manager

> WIP, under active development
[![License](https://img.shields.io/pypi/l/napari-plugin-manager.svg?color=green)](https://github.com/napari/napari-plugin-manager/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-plugin-manager.svg?color=green)](https://pypi.org/project/napari-plugin-manager)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-plugin-manager.svg?color=green)](https://python.org)
[![tests](https://github.com/napari/napari-plugin-manager/workflows/tests/badge.svg)](https://github.com/napari/napari-plugin-manager/actions)
[![codecov](https://codecov.io/gh/napari/napari-plugin-manager/branch/main/graph/badge.svg)](https://codecov.io/gh/napari/napari-plugin-manager)

A plugin that adds a plugin manager to [napari].

----------------------------------

## Installation

You can install `napari-plugin-manager` via [pip]:

pip install napari-plugin-manager

## License

Distributed under the terms of the [BSD-3] license,
"napari-plugin-manager" is free and open source software

## Issues

If you encounter any problems, please [file an issue] along with a detailed description.

[napari]: https://github.com/napari/napari
[Cookiecutter]: https://github.com/audreyr/cookiecutter
[@napari]: https://github.com/napari
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[file an issue]: https://github.com/napari/napari-plugin-manager/issues
[napari]: https://github.com/napari/napari
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion napari_plugin_manager/_tests/test_installer_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from qtpy.QtCore import QProcessEnvironment

from napari._qt.dialogs.qt_package_installer import (
from napari_plugin_manager.qt_package_installer import (
AbstractInstallerTool,
CondaInstallerTool,
InstallerQueue,
Expand Down
8 changes: 4 additions & 4 deletions napari_plugin_manager/_tests/test_qt_plugin_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from typing import Generator, Optional, Tuple
from unittest.mock import patch

import napari.plugins
import npe2
import pytest

import napari.plugins
from napari._qt.dialogs import qt_plugin_dialog
from napari._qt.dialogs.qt_package_installer import InstallerActions
from napari.plugins._tests.test_npe2 import mock_pm # noqa
from napari.utils.translations import trans

from napari_plugin_manager import qt_plugin_dialog
from napari_plugin_manager.qt_package_installer import InstallerActions


def _iter_napari_pypi_plugin_info(
conda_forge: bool = True,
Expand Down
13 changes: 5 additions & 8 deletions napari_plugin_manager/qt_package_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@
from tempfile import gettempdir, mkstemp
from typing import Deque, Optional, Sequence, Tuple

from npe2 import PluginManager
from qtpy.QtCore import QObject, QProcess, QProcessEnvironment, Signal
from qtpy.QtWidgets import QTextEdit

from napari._version import (
version as _napari_version,
version_tuple as _napari_version_tuple,
)
from napari._version import version as _napari_version
from napari._version import version_tuple as _napari_version_tuple
from napari.plugins import plugin_manager
from napari.plugins.npe2api import _user_agent
from napari.utils._appdirs import user_plugin_dir, user_site_packages
from napari.utils.misc import StringEnum, running_as_bundled_app
from napari.utils.translations import trans
from npe2 import PluginManager
from qtpy.QtCore import QObject, QProcess, QProcessEnvironment, Signal
from qtpy.QtWidgets import QTextEdit

JobId = int
log = getLogger(__name__)
Expand Down
30 changes: 15 additions & 15 deletions napari_plugin_manager/qt_plugin_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@
from pathlib import Path
from typing import Dict, List, Literal, Optional, Sequence, Tuple

import napari.plugins
import napari.resources
import npe2
from napari._qt.qt_resources import QColoredSVGIcon
from napari._qt.qthreading import create_worker
from napari._qt.widgets.qt_message_popup import WarnPopup
from napari._qt.widgets.qt_tooltip import QtToolTipLabel
from napari.plugins.npe2api import iter_napari_plugin_info
from napari.plugins.utils import normalized_name
from napari.settings import get_settings
from napari.utils.misc import (
parse_version,
running_as_constructor_app,
)
from napari.utils.translations import trans
from qtpy.QtCore import QEvent, QPoint, QSize, Qt, QTimer, Slot
from qtpy.QtGui import QFont, QMovie
from qtpy.QtWidgets import (
Expand All @@ -30,25 +44,11 @@
)
from superqt import QCollapsible, QElidingLabel

import napari.plugins
import napari.resources
from napari._qt.dialogs.qt_package_installer import (
from napari_plugin_manager.qt_package_installer import (
InstallerActions,
InstallerQueue,
InstallerTools,
)
from napari._qt.qt_resources import QColoredSVGIcon
from napari._qt.qthreading import create_worker
from napari._qt.widgets.qt_message_popup import WarnPopup
from napari._qt.widgets.qt_tooltip import QtToolTipLabel
from napari.plugins.npe2api import iter_napari_plugin_info
from napari.plugins.utils import normalized_name
from napari.settings import get_settings
from napari.utils.misc import (
parse_version,
running_as_constructor_app,
)
from napari.utils.translations import trans

# TODO: add error icon and handle pip install errors

Expand Down
Loading

0 comments on commit 9fe2e15

Please sign in to comment.