Skip to content

Commit

Permalink
Update APIs / internals for signac 2. (#166)
Browse files Browse the repository at this point in the history
* Update init_project call for signac 2.

* Update module namespaces.

* Remove references to project root (it's called the project path now).

* Test against signac development branch.

* Update .gitignore.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Bump requirements.

* Update requirements.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
bdice and pre-commit-ci[bot] committed Mar 30, 2023
1 parent c44aed2 commit 0eb5660
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-oldest-reqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ markupsafe==2.0.0
natsort
pytest
pytest-cov
signac==1.8.0
signac==2.0.0
watchdog
webassets==2.0.0
werkzeug==2.1.0
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __pycache__
signac_dashboard.egg-info/
build/
dist/
.signac_sp_cache.json.gz
doc/_*
.signac
.signac_sp_cache.json.gz
.signac_shell_history
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies = [
"libsass",
"markupsafe>=2.0.0",
"natsort",
"signac>=1.8.0",
"signac>=2.0.0",
"watchdog",
"webassets>=2.0.0",
"werkzeug>=2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jsmin
libsass
markupsafe>=2.0.0
natsort
signac>=1.8.0
signac>=2.0.0
watchdog
webassets>=2.0.0
werkzeug>=2.1.0
8 changes: 4 additions & 4 deletions signac_dashboard/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def job_title(self, job):
(but verbose) form of the job state point, based on the project schema.
:param job: The job being titled.
:type job: :py:class:`signac.contrib.job.Job`
:type job: :py:class:`signac.job.Job`
:returns: Title to be displayed.
:rtype: str
"""
Expand Down Expand Up @@ -331,7 +331,7 @@ def job_subtitle(self, job):
minimal unique substring of the job id.
:param job: The job being subtitled.
:type job: :py:class:`signac.contrib.job.Job`
:type job: :py:class:`signac.job.Job`
:returns: Subtitle to be displayed.
:rtype: str
"""
Expand All @@ -346,7 +346,7 @@ def job_sorter(self, job):
strings or tuples of properties that should be used to sort.
:param job: The job being sorted.
:type job: :py:class:`signac.contrib.job.Job`
:type job: :py:class:`signac.job.Job`
:returns: Key for sorting.
:rtype: any comparable type
"""
Expand Down Expand Up @@ -376,7 +376,7 @@ def _job_search(self, query):
f = json.loads(query)
except json.JSONDecodeError:
query = shlex.split(query)
f = signac.contrib.filterparse.parse_filter_arg(query)
f = signac.filterparse.parse_filter_arg(query)
flash(f"Search string interpreted as '{json.dumps(f)}'.")
jobs = self.project.find_jobs(filter=f)
return sorted(jobs, key=lambda job: self.job_sorter(job))
Expand Down
8 changes: 4 additions & 4 deletions signac_dashboard/modules/image_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ImageViewer(Module):
The ImageViewer module can display images in any format that works with a standard
``<img>`` tag. The module defaults to showing all images of PNG, JPG, GIF, and SVG
types in the job or project root directory. A filename or glob can be
types in the job or project directory. A filename or glob can be
defined to select specific filenames. Each matching file yields a card.
Multiple ImageViewer modules can be defined with different filenames or
Expand All @@ -29,13 +29,13 @@ class ImageViewer(Module):
img_mod = ImageViewer() # Show all PNG/JPG/GIF/SVG images
img_mod = ImageViewer(name='Bond Order Diagram', img_globs=['bod.png'])
img_mod = ImageViewer(context="ProjectContext",
img_globs=['/gallery/*.png']) # search subdirectory of project root
img_globs=['/gallery/*.png']) # search subdirectory of project path
:param context: Supports :code:`'JobContext'` and :code:`'ProjectContext'`.
:type context: str
:param img_globs: A list of glob expressions or exact filenames,
relative to the job or project root directory, to be
displayed (default: :code:`['*.png', '*.jpg', '*.gif', '*.svg']`).
relative to the job or project directory, to be displayed
(default: :code:`['*.png', '*.jpg', '*.gif', '*.svg']`).
:type img_globs: list
:type sort_key: callable
:param sort_key: Key to sort the image files, passed internally to :code:`sorted`.
Expand Down
2 changes: 1 addition & 1 deletion signac_dashboard/modules/text_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def my_text(job):
:param context: Supports :code:`'JobContext'` and :code:`'ProjectContext'`.
:type context: str
:param message: A callable accepting one argument of type
:py:class:`signac.contrib.job.Job` or :py:class:`signac.Project`
:py:class:`signac.job.Job` or :py:class:`signac.Project`
and returning text or Markdown content.
:type message: callable
:param markdown: Enables Markdown rendering if True (default: :code:`False`).
Expand Down
6 changes: 3 additions & 3 deletions signac_dashboard/modules/video_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class VideoViewer(Module):
The VideoViewer module displays videos using an HTML ``<video>`` tag. The
module defaults to showing all videos of MP4 or M4V types in the job or
project root directory. A filename or glob can be defined to select specific
project directory. A filename or glob can be defined to select specific
filenames, which may be of any format supported by your browser with the
``<video>`` tag. Each matching file yields a card.
Expand Down Expand Up @@ -43,8 +43,8 @@ class VideoViewer(Module):
:param context: Supports :code:`'JobContext'` and :code:`'ProjectContext'`.
:type context: str
:param video_globs: A list of glob expressions or exact filenames,
relative to the job or project root directory, to be
displayed (default: :code:`['*.mp4', '*.m4v']`).
relative to the job or project directory, to be displayed
(default: :code:`['*.mp4', '*.m4v']`).
:type video_globs: list
:param preload: Option for preloading videos, one of :code:`'auto'`,
:code:`'metadata'`, or :code:`'none'` (default: :code:`'none'`).
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_response(self, query):

def setUp(self):
self._tmp_dir = tempfile.mkdtemp()
self.project = init_project(root=self._tmp_dir, make_dir=False)
self.project = init_project(self._tmp_dir)
# Set up some fake jobs
for a in range(3):
for b in range(2):
Expand Down Expand Up @@ -137,7 +137,7 @@ class AllModulesTestCase(DashboardTestCase):

def setUp(self):
self._tmp_dir = tempfile.mkdtemp()
self.project = init_project(root=self._tmp_dir, make_dir=False)
self.project = init_project(self._tmp_dir)
# Set up some fake jobs
for a in range(3):
for b in range(2):
Expand Down

0 comments on commit 0eb5660

Please sign in to comment.