Repository: brainglobe/brainrender-napari (language: python)

Issue:
Move setup.cfg to pyproject.toml
Follow NIU cookiecutter as far as possible!
Context menu to add additional references
## Description

**What is this PR**

- [ ] Bug fix
- [x] Addition of a new feature
- [ ] Other

**Why is this PR needed?**
The main components of atlases we'd like to add as layers include additional reference images.

**What does this PR do?**
Adds functionality to add additional reference images to napari (if the atlas has them).
This is achieved by a custom context menu which can be opened via a right-click on the atlas table view.
In order to test this well, we now have the `mpin_zfish_1um` atlas as part of the downloaded test data (as it is the smallest atlas that has additional references, AFAIK).

(Some improving of testing docstrings and variable names are included in this PR)

## References

Closes #6 

## How has this PR been tested?

* A new test for the napari atlas representation part of the new functionality is added. 
* Emulating a right-click to open the context menu was tricky in `qtbot` and has therefore been kicked down the line.

## Is this a breaking change?

Nope

## Does this PR require an update to the documentation?

In the future, yes. No high-level documentation for this plugin exists yet.

## Checklist:

- [x] The code has been tested locally
- [x] Tests have been added to cover all new functionality (unit & integration)
- [x] The documentation has been updated to reflect any changes
- [x] The code has been formatted with [pre-commit](https://pre-commit.com/)



Discussion / hints:

Fix patch:
diff --git a/.napari-hub/DESCRIPTION.md b/.napari-hub/DESCRIPTION.md
index 7ecdd97..e841b13 100644
--- a/.napari-hub/DESCRIPTION.md
+++ b/.napari-hub/DESCRIPTION.md
@@ -1,8 +1,8 @@
-<!-- This file is a placeholder for customizing description of your plugin 
+<!-- This file is a placeholder for customizing description of your plugin
 on the napari hub if you wish. The readme file will be used by default if
 you wish not to do any customization for the napari hub listing.
 
-If you need some help writing a good description, check out our 
+If you need some help writing a good description, check out our
 [guide](https://github.com/chanzuckerberg/napari-hub/wiki/Writing-the-Perfect-Description-for-your-Plugin)
 -->
 
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b2450a7..1e39253 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,41 +1,38 @@
+exclude: 'conf.py'
 repos:
-  - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.4.0
-    hooks:
-      - id: check-docstring-first
-      - id: end-of-file-fixer
-      - id: trailing-whitespace
-        exclude: ^\.napari-hub/.*
-  - repo: https://github.com/PyCQA/isort
-    rev: 5.12.0
-    hooks:
-      - id: isort
-  - repo: https://github.com/asottile/pyupgrade
-    rev: v3.9.0
-    hooks:
-      - id: pyupgrade
-        args: [--py38-plus, --keep-runtime-typing]
-  - repo: https://github.com/PyCQA/autoflake
-    rev: v2.2.0
-    hooks:
-      - id: autoflake
-        args: ["--in-place", "--remove-all-unused-imports"]
-  - repo: https://github.com/psf/black
-    rev: 23.7.0
-    hooks:
-      - id: black
-  - repo: https://github.com/PyCQA/flake8
-    rev: 6.0.0
-    hooks:
-      - id: flake8
-        additional_dependencies: [flake8-typing-imports>=1.9.0]
-  - repo: https://github.com/tlambert03/napari-plugin-checks
-    rev: v0.3.0
-    hooks:
-      - id: napari-plugin-checks
-  # https://mypy.readthedocs.io/en/stable/introduction.html
-  # you may wish to add this as well!
-  # - repo: https://github.com/pre-commit/mirrors-mypy
-  #   rev: v0.910-1
-  #   hooks:
-  #     - id: mypy
+    - repo: https://github.com/pre-commit/pre-commit-hooks
+      rev: v4.4.0
+      hooks:
+          - id: check-docstring-first
+          - id: check-executables-have-shebangs
+          - id: check-merge-conflict
+          - id: check-toml
+          - id: end-of-file-fixer
+          - id: mixed-line-ending
+            args: [--fix=lf]
+          - id: requirements-txt-fixer
+          - id: trailing-whitespace
+    - repo: https://github.com/charliermarsh/ruff-pre-commit
+      rev: v0.0.272
+      hooks:
+        - id: ruff
+    - repo: https://github.com/psf/black
+      rev: 23.3.0
+      hooks:
+          - id: black
+    - repo: https://github.com/pre-commit/mirrors-mypy
+      rev: v1.3.0
+      hooks:
+          - id: mypy
+            additional_dependencies:
+                - types-setuptools
+    - repo: https://github.com/mgedmin/check-manifest
+      rev: "0.49"
+      hooks:
+          - id: check-manifest
+            args: [--no-build-isolation]
+            additional_dependencies: [setuptools-scm]
+    - repo: https://github.com/tlambert03/napari-plugin-checks
+      rev: v0.3.0
+      hooks:
+        - id: napari-plugin-checks
diff --git a/LICENSE b/LICENSE
index c91c2ff..e3b82a9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -12,7 +12,7 @@ modification, are permitted provided that the following conditions are met:
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
 
-* Neither the name of copyright holder nor the names of its
+* Neither the name of brainrender-napari nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.
 
diff --git a/MANIFEST.in b/MANIFEST.in
index f3155af..e3ecce0 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,11 @@
 include LICENSE
 include README.md
+include .napari-hub/DESCRIPTION.md
+include .napari-hub/config.yml
+include brainrender_napari/napari.yaml
+exclude .pre-commit-config.yaml
 
 recursive-exclude * __pycache__
 recursive-exclude * *.py[co]
+recursive-exclude docs *
+recursive-exclude tests *
diff --git a/src/brainglobe_napari/__init__.py b/brainrender_napari/__init__.py
similarity index 100%
rename from src/brainglobe_napari/__init__.py
rename to brainrender_napari/__init__.py
diff --git a/src/brainglobe_napari/atlas_download_dialog.py b/brainrender_napari/atlas_download_dialog.py
similarity index 100%
rename from src/brainglobe_napari/atlas_download_dialog.py
rename to brainrender_napari/atlas_download_dialog.py
diff --git a/src/brainglobe_napari/atlas_viewer_utils.py b/brainrender_napari/atlas_viewer_utils.py
similarity index 100%
rename from src/brainglobe_napari/atlas_viewer_utils.py
rename to brainrender_napari/atlas_viewer_utils.py
diff --git a/src/brainglobe_napari/atlas_viewer_widget.py b/brainrender_napari/atlas_viewer_widget.py
similarity index 95%
rename from src/brainglobe_napari/atlas_viewer_widget.py
rename to brainrender_napari/atlas_viewer_widget.py
index d57a79b..b5433ed 100644
--- a/src/brainglobe_napari/atlas_viewer_widget.py
+++ b/brainrender_napari/atlas_viewer_widget.py
@@ -30,15 +30,15 @@
     QWidget,
 )
 
-from brainglobe_napari.atlas_download_dialog import AtlasDownloadDialog
-from brainglobe_napari.atlas_viewer_utils import (
+from brainrender_napari.atlas_download_dialog import AtlasDownloadDialog
+from brainrender_napari.atlas_viewer_utils import (
     read_atlas_metadata_from_file,
     read_atlas_structures_from_file,
 )
-from brainglobe_napari.napari_atlas_representation import (
+from brainrender_napari.napari_atlas_representation import (
     NapariAtlasRepresentation,
 )
-from brainglobe_napari.structure_tree_model import StructureTreeModel
+from brainrender_napari.structure_tree_model import StructureTreeModel
 
 
 class AtlasTableModel(QtCore.QAbstractTableModel):
@@ -255,8 +255,3 @@ def _on_context_menu_requested(self, position):
                     atlas_representation.add_additional_reference(
                         selected_item.text()
                     )
-                    print(selected_item.text())
-                else:
-                    print("menu action cancelled")
-            else:
-                pass  # don't show a menu if there are no additional references
diff --git a/brainrender_napari/napari.yaml b/brainrender_napari/napari.yaml
new file mode 100644
index 0000000..238734b
--- /dev/null
+++ b/brainrender_napari/napari.yaml
@@ -0,0 +1,10 @@
+name: brainrender-napari
+display_name: BrainGlobe Tools
+contributions:
+  commands:
+    - id: brainrender-napari.make_atlas_viewer_widget
+      python_name: brainrender_napari.atlas_viewer_widget:AtlasViewerWidget
+      title: Make Brainrender Napari
+  widgets:
+    - command: brainrender-napari.make_atlas_viewer_widget
+      display_name: Brainrender Napari
diff --git a/src/brainglobe_napari/napari_atlas_representation.py b/brainrender_napari/napari_atlas_representation.py
similarity index 97%
rename from src/brainglobe_napari/napari_atlas_representation.py
rename to brainrender_napari/napari_atlas_representation.py
index 062c7ff..ed31269 100644
--- a/src/brainglobe_napari/napari_atlas_representation.py
+++ b/brainrender_napari/napari_atlas_representation.py
@@ -45,7 +45,7 @@ def add_structure_to_viewer(self, structure_name: str):
             color=color,
         )
 
-    def _add_mesh(self, mesh: Mesh, name: str = None, color=None):
+    def _add_mesh(self, mesh: Mesh, name: str, color=None):
         """Helper function to add a mesh as a surface layer to the viewer.
 
         mesh: the mesh to add
diff --git a/src/brainglobe_napari/structure_tree_model.py b/brainrender_napari/structure_tree_model.py
similarity index 94%
rename from src/brainglobe_napari/structure_tree_model.py
rename to brainrender_napari/structure_tree_model.py
index ff91dc5..b597f66 100644
--- a/src/brainglobe_napari/structure_tree_model.py
+++ b/brainrender_napari/structure_tree_model.py
@@ -1,10 +1,11 @@
-from typing import List
+from typing import Dict, List
 
 from bg_atlasapi.structure_tree_util import get_structures_tree
 from qtpy.QtCore import QAbstractItemModel, QModelIndex, Qt
+from qtpy.QtGui import QStandardItem
 
 
-class StructureTreeItem:
+class StructureTreeItem(QStandardItem):
     """A class to hold items in a tree model."""
 
     def __init__(self, data, parent=None):
@@ -48,16 +49,14 @@ def __init__(self, data: List, parent=None):
         self.root_item = StructureTreeItem(data=("Atlas regions", "-1"))
         self.build_structure_tree(data, self.root_item)
 
-    def build_structure_tree(
-        self, structures: List, root: StructureTreeItem = None
-    ):
+    def build_structure_tree(self, structures: List, root: StructureTreeItem):
         """Build the structure tree given a list of structures."""
         tree = get_structures_tree(structures)
         structure_id_dict = {}
         for structure in structures:
             structure_id_dict[structure["id"]] = structure
 
-        inserted_items = {}
+        inserted_items: Dict[int, StructureTreeItem] = {}
         for n_id in tree.expand_tree():  # sorts nodes by default,
             # so parents will always be already in the QAbstractItemModel
             # before their children
diff --git a/pyproject.toml b/pyproject.toml
index ec43372..1cc82e9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,126 @@
+[project]
+name = "brainrender-napari"
+authors = [{name = "Alessandro Felder", email= "a.felder@ucl.ac.uk"}]
+description = "A napari plugin to render BrainGlobe atlases and associated data as layers."
+readme = "README.md"
+requires-python = ">=3.8.0"
+dynamic = ["version"]
+
+license = {text = "BSD-3-Clause"}
+
+classifiers = [
+    "Development Status :: 2 - Pre-Alpha",
+    "Framework :: napari",
+    "Intended Audience :: Developers",
+    "Programming Language :: Python",
+    "Programming Language :: Python :: 3",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
+    "Operating System :: OS Independent",
+    "License :: OSI Approved :: BSD License",
+    "Topic :: Scientific/Engineering :: Image Processing",
+]
+
+dependencies = [
+    "bg-atlasapi",
+    "numpy",
+    "qtpy",
+]
+
+[project.urls]
+"Homepage" = "https://github.com/brainglobe/brainrender-napari"
+"Bug Tracker" = "https://github.com/brainglobe/brainrender-napari/issues"
+"Documentation" = "https://brainglobe.github.io/brainrender-napari"
+
+"Source Code" = "https://github.com/brainglobe/brainrender-napari"
+"User Support" = "https://github.com/brainglobe/brainrender-napari/issues"
+
+[project.entry-points."napari.manifest"]
+brainrender-napari = "brainrender_napari:napari.yaml"
+
+[project.optional-dependencies]
+dev = [
+  "pytest",
+  "pytest-cov",
+  "pytest-mock",
+  "pytest-qt",
+  "coverage",
+  "tox",
+  "black",
+  "mypy",
+  "pre-commit",
+  "ruff",
+  "setuptools_scm",
+  "napari",
+  "pyqt5"
+]
+
 [build-system]
-requires = ["setuptools>=42.0.0", "wheel"]
+requires = [
+    "setuptools>=45",
+    "wheel",
+    "setuptools_scm[toml]>=6.2",
+]
 build-backend = "setuptools.build_meta"
 
+[tool.setuptools]
+include-package-data = true
+
+[tool.setuptools.packages.find]
+include = ["brainrender_napari*"]
+exclude = ["tests", "docs*"]
+
 
+[tool.pytest.ini_options]
+addopts = "--cov=brainrender_napari"
 
 [tool.black]
+target-version = ['py38', 'py39', 'py310']
+skip-string-normalization = false
 line-length = 79
 
-[tool.isort]
-profile = "black"
-line_length = 79
+[tool.setuptools_scm]
+
+[tool.check-manifest]
+ignore = [
+  ".yaml",
+  "tox.ini",
+  "tests/",
+  "tests/test_unit/",
+  "tests/test_integration/",
+  "docs/",
+  "docs/source/",
+]
+
+
+[tool.ruff]
+line-length = 79
+exclude = ["__init__.py","build",".eggs"]
+select = ["I", "E", "F"]
+fix = true
+
+[tool.cibuildwheel]
+build = "cp38-* cp39-* cp310-*"
+
+[tool.cibuildwheel.macos]
+archs = ["x86_64", "arm64"]
+
+[tool.tox]
+legacy_tox_ini = """
+[tox]
+envlist = py{38,39,310}
+isolated_build = True
+
+[gh-actions]
+python =
+    3.8: py38
+    3.9: py39
+    3.10: py310
+
+[testenv]
+extras =
+    dev
+commands =
+    pytest -v --color=yes --cov=brainrender_napari --cov-report=xml
+"""
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index f7f65ec..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,66 +0,0 @@
-[metadata]
-name = brainglobe-napari
-version = 0.0.1
-description = BrainGlobe Tools for computational neuroanatomy
-long_description = file: README.md
-long_description_content_type = text/markdown
-url = https://github.com/brainglobe/brainglobe-napari
-author = Alessandro Felder
-author_email = a.felder@ucl.ac.uk
-license = BSD-3-Clause
-license_files = LICENSE
-classifiers =
-    Development Status :: 2 - Pre-Alpha
-    Framework :: napari
-    Intended Audience :: Developers
-    License :: OSI Approved :: BSD License
-    Operating System :: OS Independent
-    Programming Language :: Python
-    Programming Language :: Python :: 3
-    Programming Language :: Python :: 3 :: Only
-    Programming Language :: Python :: 3.8
-    Programming Language :: Python :: 3.9
-    Programming Language :: Python :: 3.10
-    Topic :: Scientific/Engineering :: Image Processing
-project_urls =
-    Bug Tracker = https://github.com/brainglobe/brainglobe-napari/issues
-    Documentation = https://github.com/brainglobe/brainglobe-napari#README.md
-    Source Code = https://github.com/brainglobe/brainglobe-napari
-    User Support = https://github.com/brainglobe/brainglobe-napari/issues
-
-[options]
-packages = find:
-install_requires =
-    bg-atlasapi
-    numpy
-    magicgui
-    qtpy
-    superqt
-
-python_requires = >=3.8
-include_package_data = True
-package_dir =
-    =src
-
-# add your package requirements here
-
-[options.packages.find]
-where = src
-
-[options.entry_points]
-napari.manifest =
-    brainglobe-napari = brainglobe_napari:napari.yaml
-
-[options.extras_require]
-dev =
-    tox
-    pytest  # https://docs.pytest.org/en/latest/contents.html
-    pytest-cov  # https://pytest-cov.readthedocs.io/en/latest/
-    pytest-mock
-    pytest-qt  # https://pytest-qt.readthedocs.io/en/latest/
-    napari
-    pyqt5
-
-
-[options.package_data]
-* = *.yaml
diff --git a/src/brainglobe_napari/napari.yaml b/src/brainglobe_napari/napari.yaml
deleted file mode 100644
index 67bec5d..0000000
--- a/src/brainglobe_napari/napari.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-name: brainglobe-napari
-display_name: BrainGlobe Tools
-contributions:
-  commands:
-    - id: brainglobe-napari.make_atlas_viewer_widget
-      python_name: brainglobe_napari.atlas_viewer_widget:AtlasViewerWidget
-      title: Make Atlas Viewer Widget
-  widgets:
-    - command: brainglobe-napari.make_atlas_viewer_widget
-      display_name: BrainGlobe Atlas Viewer


Test patch:
diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml
index 980f71a..d23d4b3 100644
--- a/.github/workflows/test_and_deploy.yml
+++ b/.github/workflows/test_and_deploy.yml
@@ -1,33 +1,45 @@
-# This workflows will upload a Python Package using Twine when a release is created
-# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
-
 name: tests
 
 on:
   push:
     branches:
       - main
-      - npe2
     tags:
       - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
   pull_request:
     branches:
       - main
-      - npe2
   workflow_dispatch:
 
 jobs:
+  linting:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: neuroinformatics-unit/actions/lint@v2
+
+  manifest:
+    name: Check Manifest
+    runs-on: ubuntu-latest
+    steps:
+      - uses: neuroinformatics-unit/actions/check_manifest@v2
+
   test:
-    name: ${{ matrix.platform }} py${{ matrix.python-version }}
-    runs-on: ${{ matrix.platform }}
+    needs: [linting, manifest]
+    name: ${{ matrix.os }} py${{ matrix.python-version }}
+    runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        platform: [ubuntu-latest, windows-latest, macos-latest]
-        python-version: ['3.8', '3.9', '3.10']
+        # Run all supported Python versions on linux
+        python-version: ["3.8", "3.9", "3.10"]
+        os: [ubuntu-latest]
+        # Include one windows and macos run
+        include:
+        - os: macos-latest
+          python-version: "3.10"
+        - os: windows-latest
+          python-version: "3.10"
 
     steps:
-      - uses: actions/checkout@v3
-
       - name: Set up Python ${{ matrix.python-version }}
         uses: actions/setup-python@v4
         with:
@@ -43,16 +55,6 @@ jobs:
           git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
           powershell gl-ci-helpers/appveyor/install_opengl.ps1
 
-      # note: if you need dependencies from conda, considering using
-      # setup-miniconda: https://github.com/conda-incubator/setup-miniconda
-      # and
-      # tox-conda: https://github.com/tox-dev/tox-conda
-      - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          python -m pip install setuptools tox tox-gh-actions
-
-
       # cache atlases needed by the tests
       - name: Cache Atlases
         uses: actions/cache@v3
@@ -62,39 +64,30 @@ jobs:
           key: cached-atlases
           enableCrossOsArchive: true
 
-      # this runs the platform-specific tests declared in tox.ini
-      - name: Test with tox
-        uses: GabrielBB/xvfb-action@v1
+      # Run tests
+      - uses: neuroinformatics-unit/actions/test@v2
         with:
-          run: python -m tox
-        env:
-          PLATFORM: ${{ matrix.platform }}
-
-      - name: Coverage
-        uses: codecov/codecov-action@v2
+          python-version: ${{ matrix.python-version }}
 
-  deploy:
-    # this will run when you have tagged a commit, starting with "v*"
-    # and requires that you have put your twine API key in your
-    # github secrets (see readme for details)
+  build_sdist_wheels:
+    name: Build source distribution
     needs: [test]
+    if: github.event_name == 'push' && github.ref_type == 'tag'
     runs-on: ubuntu-latest
-    if: contains(github.ref, 'tags')
     steps:
-      - uses: actions/checkout@v3
-      - name: Set up Python
-        uses: actions/setup-python@v4
-        with:
-          python-version: "3.x"
-      - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          pip install -U setuptools setuptools_scm wheel twine build
-      - name: Build and publish
-        env:
-          TWINE_USERNAME: __token__
-          TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
-        run: |
-          git tag
-          python -m build .
-          twine upload dist/*
+    - uses: neuroinformatics-unit/actions/build_sdist_wheels@v2
+
+
+  upload_all:
+    name: Publish build distributions
+    needs: [build_sdist_wheels]
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/download-artifact@v3
+      with:
+        name: artifact
+        path: dist
+    - uses: pypa/gh-action-pypi-publish@v1.5.0
+      with:
+        user: __token__
+        password: ${{ secrets.TWINE_API_KEY }}
diff --git a/src/brainglobe_napari/tests/__init__.py b/tests/__init__.py
similarity index 100%
rename from src/brainglobe_napari/tests/__init__.py
rename to tests/__init__.py
diff --git a/tests/test_integration/__init__.py b/tests/test_integration/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_unit/__init__.py b/tests/test_unit/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/brainglobe_napari/tests/conftest.py b/tests/test_unit/conftest.py
similarity index 100%
rename from src/brainglobe_napari/tests/conftest.py
rename to tests/test_unit/conftest.py
diff --git a/src/brainglobe_napari/tests/test_atlas_viewer_widget.py b/tests/test_unit/test_atlas_viewer_widget.py
similarity index 96%
rename from src/brainglobe_napari/tests/test_atlas_viewer_widget.py
rename to tests/test_unit/test_atlas_viewer_widget.py
index 47a16bc..3ec938e 100644
--- a/src/brainglobe_napari/tests/test_atlas_viewer_widget.py
+++ b/tests/test_unit/test_atlas_viewer_widget.py
@@ -7,7 +7,7 @@
 from napari.viewer import Viewer
 from qtpy.QtCore import Qt
 
-from brainglobe_napari.atlas_viewer_widget import AtlasViewerWidget
+from brainrender_napari.atlas_viewer_widget import AtlasViewerWidget
 
 
 @pytest.fixture
@@ -105,7 +105,7 @@ def test_double_click_on_not_yet_downloaded_atlas_row(
     atlas_viewer.atlas_table_view.setCurrentIndex(model_index)
 
     dialog_exec_mock = mocker.patch(
-        "brainglobe_napari.atlas_viewer_widget.AtlasDownloadDialog.exec"
+        "brainrender_napari.atlas_viewer_widget.AtlasDownloadDialog.exec"
     )
     # weirdly, to correctly emulate a double-click
     # you need to click first. Also, note that the view
@@ -124,7 +124,7 @@ def test_structure_row_double_clicked(
     """
     _, atlas_viewer = make_atlas_viewer
     add_structure_to_viewer_mock = mocker.patch(
-        "brainglobe_napari.atlas_viewer_widget"
+        "brainrender_napari.atlas_viewer_widget"
         ".NapariAtlasRepresentation.add_structure_to_viewer"
     )
     atlas_viewer.atlas_table_view.selectRow(4)  # allen_mouse_100um is in row 4
@@ -190,7 +190,7 @@ def test_hover_atlas_table_view(make_atlas_viewer, mocker, qtbot):
     index = view.model().index(2, 1)
 
     get_tooltip_text_mock = mocker.patch(
-        "brainglobe_napari.atlas_viewer_widget"
+        "brainrender_napari.atlas_viewer_widget"
         ".AtlasViewerWidget.get_tooltip_text"
     )
 
diff --git a/src/brainglobe_napari/tests/test_download_dialog.py b/tests/test_unit/test_download_dialog.py
similarity index 88%
rename from src/brainglobe_napari/tests/test_download_dialog.py
rename to tests/test_unit/test_download_dialog.py
index 8b9793b..fba7eb4 100644
--- a/src/brainglobe_napari/tests/test_download_dialog.py
+++ b/tests/test_unit/test_download_dialog.py
@@ -1,6 +1,6 @@
 import pytest
 
-from brainglobe_napari.atlas_download_dialog import AtlasDownloadDialog
+from brainrender_napari.atlas_download_dialog import AtlasDownloadDialog
 
 
 def test_download_dialog(qtbot):
diff --git a/src/brainglobe_napari/tests/test_metadata_reading.py b/tests/test_unit/test_metadata_reading.py
similarity index 81%
rename from src/brainglobe_napari/tests/test_metadata_reading.py
rename to tests/test_unit/test_metadata_reading.py
index b993213..d298882 100644
--- a/src/brainglobe_napari/tests/test_metadata_reading.py
+++ b/tests/test_unit/test_metadata_reading.py
@@ -1,6 +1,6 @@
 from bg_atlasapi import BrainGlobeAtlas
 
-from brainglobe_napari.atlas_viewer_utils import read_atlas_metadata_from_file
+from brainrender_napari.atlas_viewer_utils import read_atlas_metadata_from_file
 
 
 def test_metadata_reading():
diff --git a/src/brainglobe_napari/tests/test_napari_atlas_representation.py b/tests/test_unit/test_napari_atlas_representation.py
similarity index 98%
rename from src/brainglobe_napari/tests/test_napari_atlas_representation.py
rename to tests/test_unit/test_napari_atlas_representation.py
index ccacb02..a48f6f6 100644
--- a/src/brainglobe_napari/tests/test_napari_atlas_representation.py
+++ b/tests/test_unit/test_napari_atlas_representation.py
@@ -3,7 +3,7 @@
 from napari.layers import Image, Labels
 from numpy import all, allclose
 
-from brainglobe_napari.napari_atlas_representation import (
+from brainrender_napari.napari_atlas_representation import (
     NapariAtlasRepresentation,
 )