From c291e1ef1d8cc7bb3b9591ae4e6265f4c27cf7aa Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 23 Feb 2022 09:13:43 -0800 Subject: [PATCH 01/11] Deprecate project id (#644) * Convert name to an optional parameter. * Update changelog. * update init_project call in example code * Fix assertion. * Update signac/contrib/project.py Co-authored-by: Corwin Kerr * suggestion: change other init_project * Address PR comments. Co-authored-by: Corwin Kerr --- changelog.txt | 5 +++++ signac/__main__.py | 10 +++++----- signac/contrib/project.py | 39 ++++++++++++++++++++++++++------------- signac/diff.py | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/changelog.txt b/changelog.txt index a00ae098f..4e591989f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -31,6 +31,11 @@ Deprecated - ``signac.cite`` module is deprecated (#611, #592). - ``config.get_config`` method is deprecated (#675). +Changed ++++++++ + + - Project names have a default in anticipation of removing names entirely. Project names will be removed in signac 2.0. + Fixed +++++ diff --git a/signac/__main__.py b/signac/__main__.py index 4bd38b313..75d9321f4 100644 --- a/signac/__main__.py +++ b/signac/__main__.py @@ -1093,10 +1093,7 @@ def main_shell(args): except LookupError: print("signac", __version__) print("No project within this directory.") - print( - "If you want to initialize a project, execute `$ signac init `, " - "where can be freely chosen." - ) + print("If you want to initialize a project, execute `$ signac init`.") else: _jobs = find_with_filter(args) @@ -1201,7 +1198,10 @@ def main(): parser_init = subparsers.add_parser("init") parser_init.add_argument( - "project_id", type=str, help="Initialize a project with the given project id." + "project_id", + nargs="?", + type=str, + help="Initialize a project with the given project id.", ) parser_init.add_argument( "-w", diff --git a/signac/contrib/project.py b/signac/contrib/project.py index d898b862a..98c523cc6 100644 --- a/signac/contrib/project.py +++ b/signac/contrib/project.py @@ -83,6 +83,9 @@ def get_indexes(root): "information." ) +# Temporary default for project names until they are removed entirely in signac 2.0 +_DEFAULT_PROJECT_NAME = None + class JobSearchIndex: """Search for specific jobs with filters. @@ -2279,8 +2282,8 @@ def temporary_project(self, name=None, dir=None): yield tmp_project @classmethod - def init_project(cls, name, root=None, workspace=None, make_dir=True): - """Initialize a project with the given name. + def init_project(cls, name=None, root=None, workspace=None, make_dir=True): + """Initialize a project. It is safe to call this function multiple times with the same arguments. However, a `RuntimeError` is raised if an existing project @@ -2291,15 +2294,15 @@ def init_project(cls, name, root=None, workspace=None, make_dir=True): Parameters ---------- - name : str - The name of the project to initialize. - root : str + name : str, optional + The name of the project to initialize (Default value = None). + root : str, optional The root directory for the project. Defaults to the current working directory. - workspace : str + workspace : str, optional The workspace directory for the project. Defaults to a subdirectory ``workspace`` in the project root. - make_dir : bool + make_dir : bool, optional Create the project root directory if it does not exist yet (Default value = True). @@ -2317,6 +2320,16 @@ def init_project(cls, name, root=None, workspace=None, make_dir=True): """ if root is None: root = os.getcwd() + + if name is not None: + warnings.warn( + "Project names are deprecated and will be removed in signac 2.0 in favor of using " + "the project root directory to identify projects. The name argument to " + "init_project should be removed.", + DeprecationWarning, + ) + else: + name = _DEFAULT_PROJECT_NAME try: project = cls.get_project(root=root, search=False) except LookupError: @@ -3028,8 +3041,8 @@ def _repr_html_(self): return repr(self) + self._repr_html_jobs() -def init_project(name, root=None, workspace=None, make_dir=True): - """Initialize a project with the given name. +def init_project(name=None, root=None, workspace=None, make_dir=True): + """Initialize a project. It is safe to call this function multiple times with the same arguments. However, a `RuntimeError` is raised if an existing project configuration @@ -3037,15 +3050,15 @@ def init_project(name, root=None, workspace=None, make_dir=True): Parameters ---------- - name : str + name : str, optional The name of the project to initialize. - root : str + root : str, optional The root directory for the project. Defaults to the current working directory. - workspace : str + workspace : str, optional The workspace directory for the project. Defaults to a subdirectory ``workspace`` in the project root. - make_dir : bool + make_dir : bool, optional Create the project root directory, if it does not exist yet (Default value = True). diff --git a/signac/diff.py b/signac/diff.py index 952818e9d..4bd21577c 100644 --- a/signac/diff.py +++ b/signac/diff.py @@ -30,7 +30,7 @@ def diff_jobs(*jobs): Examples -------- >>> import signac - >>> project = signac.init_project('project_name') + >>> project = signac.init_project() >>> job1 = project.open_job({'constant': 42, 'diff1': 0, 'diff2': 1}).init() >>> job2 = project.open_job({'constant': 42, 'diff1': 1, 'diff2': 1}).init() >>> job3 = project.open_job({'constant': 42, 'diff1': 2, 'diff2': 2}).init() From 1285881dc1c33ff838dd0d9b7cd84aaa4da47e89 Mon Sep 17 00:00:00 2001 From: Onkar Mahapatra <74865775+Onkar627@users.noreply.github.com> Date: Mon, 28 Feb 2022 23:19:42 +0530 Subject: [PATCH 02/11] Use FutureWarning instead of DeprecationWarning in project.py (#691) * Update project.py * Update changelog. Co-authored-by: Bradley Dice --- changelog.txt | 1 + signac/contrib/project.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4e591989f..5afe61036 100644 --- a/changelog.txt +++ b/changelog.txt @@ -20,6 +20,7 @@ Changed +++++++ - Schema migration is now performed on directories rather than signac projects and supports a wider range of schemas (#654). + - Deprecated features now use ``FutureWarning`` instead of ``DeprecationWarning``, which is hidden by default (#687, #691). Deprecated ++++++++++ diff --git a/signac/contrib/project.py b/signac/contrib/project.py index 98c523cc6..fa57dd377 100644 --- a/signac/contrib/project.py +++ b/signac/contrib/project.py @@ -173,7 +173,7 @@ def find_job_ids(self, filter=None, doc_filter=None): if doc_filter: filter.update(doc_filter) elif doc_filter: - warnings.warn(DOC_FILTER_WARNING, DeprecationWarning) + warnings.warn(DOC_FILTER_WARNING, FutureWarning) filter = doc_filter return self._collection._find(filter) @@ -919,7 +919,7 @@ def detect_schema(self, exclude_const=False, subset=None, index=None): if index is None: index = self.index(include_job_document=False) else: - warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning) + warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning) if subset is not None: subset = {str(s) for s in subset} index = [doc for doc in index if doc["_id"] in subset] @@ -1031,7 +1031,7 @@ def _find_job_ids(self, filter=None, doc_filter=None, index=None): if index is None: filter = dict(parse_filter(_add_prefix("sp.", filter))) if doc_filter: - warnings.warn(DOC_FILTER_WARNING, DeprecationWarning) + warnings.warn(DOC_FILTER_WARNING, FutureWarning) filter.update(parse_filter(_add_prefix("doc.", doc_filter))) index = self.index(include_job_document=True) elif "doc" in _root_keys(filter): @@ -1039,7 +1039,7 @@ def _find_job_ids(self, filter=None, doc_filter=None, index=None): else: index = self._sp_index() else: - warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning) + warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning) return Collection(index, _trust=True)._find(filter) @@ -1079,7 +1079,7 @@ def find_jobs(self, filter=None, doc_filter=None): """ filter = dict(parse_filter(_add_prefix("sp.", filter))) if doc_filter: - warnings.warn(DOC_FILTER_WARNING, DeprecationWarning) + warnings.warn(DOC_FILTER_WARNING, FutureWarning) filter.update(parse_filter(_add_prefix("doc.", doc_filter))) return JobsCursor(self, filter) @@ -1521,7 +1521,7 @@ def create_linked_view(self, prefix=None, job_ids=None, index=None, path=None): """ if index is not None: - warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning) + warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning) from .linked_view import create_linked_view return create_linked_view(self, prefix, job_ids, index, path) @@ -1922,7 +1922,7 @@ def repair(self, fn_statepoints=None, index=None, job_ids=None): if index is not None: for doc in index: self._sp_cache[doc["signac_id"]] = doc["sp"] - warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning) + warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning) corrupted = [] for job_id in job_ids: try: @@ -2226,7 +2226,7 @@ def create_access_module(self, filename=None, main=True, master=None): """ if master is not None: warnings.warn( - "The parameter master has been renamed to main.", DeprecationWarning + "The parameter master has been renamed to main.", FutureWarning ) main = master @@ -2326,7 +2326,7 @@ def init_project(cls, name=None, root=None, workspace=None, make_dir=True): "Project names are deprecated and will be removed in signac 2.0 in favor of using " "the project root directory to identify projects. The name argument to " "init_project should be removed.", - DeprecationWarning, + FutureWarning, ) else: name = _DEFAULT_PROJECT_NAME @@ -2647,7 +2647,7 @@ def next(self): """ warnings.warn( "Calling next() directly on a JobsCursor is deprecated! Use next(iter(..)) instead.", - DeprecationWarning, + FutureWarning, ) if self._next_iter is None: self._next_iter = iter(self) From 2583d884d571de39627c9155b48b9a857967c8d5 Mon Sep 17 00:00:00 2001 From: Onkar Mahapatra <74865775+Onkar627@users.noreply.github.com> Date: Tue, 1 Mar 2022 00:44:40 +0530 Subject: [PATCH 03/11] Update contributors.yaml (#694) * Update contributors.yaml * Update contributors.yaml Co-authored-by: Bradley Dice --- contributors.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contributors.yaml b/contributors.yaml index d3c106477..ba434fded 100644 --- a/contributors.yaml +++ b/contributors.yaml @@ -107,4 +107,8 @@ contributors: family-names: Dave given-names: Shantanu affiliation: "Jodhpur Institute of Engineering and Technology" + - + family-names: Mahapatra + given-names: Onkar + affiliation: "Cluster Innovation Centre, New Delhi" ... From 696b1e3927eb6eaa0aa62af212784c39ec158ed6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:57:53 -0600 Subject: [PATCH 04/11] Bump redis from 4.1.2 to 4.1.4 (#698) Bumps [redis](https://github.com/redis/redis-py) from 4.1.2 to 4.1.4. - [Release notes](https://github.com/redis/redis-py/releases) - [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES) - [Commits](https://github.com/redis/redis-py/compare/v4.1.2...v4.1.4) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-test-optional.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-test-optional.txt b/requirements/requirements-test-optional.txt index abc10db4d..bdb91c70d 100644 --- a/requirements/requirements-test-optional.txt +++ b/requirements/requirements-test-optional.txt @@ -2,7 +2,7 @@ h5py==3.6.0; implementation_name=='cpython' numpy==1.22.1 pandas==1.4.0; implementation_name=='cpython' pymongo==4.0.1; implementation_name=='cpython' -redis==4.1.2 +redis==4.1.4 ruamel.yaml==0.17.20 tables==3.7.0; implementation_name=='cpython' zarr==2.10.3; platform_system!='Windows' From abb21c3eeb88e889c1a9c4d128198756632ec399 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:57:58 -0600 Subject: [PATCH 05/11] Bump coverage from 6.3 to 6.3.2 (#699) Bumps [coverage](https://github.com/nedbat/coveragepy) from 6.3 to 6.3.2. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/6.3...6.3.2) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index ad75235a6..da715d6fc 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -1,3 +1,3 @@ -coverage==6.3 +coverage==6.3.2 pytest==6.2.5 pytest-cov==3.0.0 From 115c80b9c698a022cd0d885425df0cbd37db26bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:58:03 -0600 Subject: [PATCH 06/11] Bump pandas from 1.4.0 to 1.4.1 (#700) Bumps [pandas](https://github.com/pandas-dev/pandas) from 1.4.0 to 1.4.1. - [Release notes](https://github.com/pandas-dev/pandas/releases) - [Changelog](https://github.com/pandas-dev/pandas/blob/main/RELEASE.md) - [Commits](https://github.com/pandas-dev/pandas/compare/v1.4.0...v1.4.1) --- updated-dependencies: - dependency-name: pandas dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-benchmark.txt | 2 +- requirements/requirements-test-optional.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/requirements-benchmark.txt b/requirements/requirements-benchmark.txt index bf2f9c63f..a02323669 100644 --- a/requirements/requirements-benchmark.txt +++ b/requirements/requirements-benchmark.txt @@ -2,5 +2,5 @@ click==8.0.3 gitdb2==4.0.2 GitPython==3.1.26 numpy==1.22.1 -pandas==1.4.0; implementation_name=='cpython' --no-binary :none: +pandas==1.4.1; implementation_name=='cpython' --no-binary :none: psutil==5.9.0 diff --git a/requirements/requirements-test-optional.txt b/requirements/requirements-test-optional.txt index bdb91c70d..6467f6a8b 100644 --- a/requirements/requirements-test-optional.txt +++ b/requirements/requirements-test-optional.txt @@ -1,6 +1,6 @@ h5py==3.6.0; implementation_name=='cpython' numpy==1.22.1 -pandas==1.4.0; implementation_name=='cpython' +pandas==1.4.1; implementation_name=='cpython' pymongo==4.0.1; implementation_name=='cpython' redis==4.1.4 ruamel.yaml==0.17.20 From 5e552524fd18fa8bbce7565e2ad4b3bba09363ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:58:08 -0600 Subject: [PATCH 07/11] Bump click from 8.0.3 to 8.0.4 (#701) Bumps [click](https://github.com/pallets/click) from 8.0.3 to 8.0.4. - [Release notes](https://github.com/pallets/click/releases) - [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/click/compare/8.0.3...8.0.4) --- updated-dependencies: - dependency-name: click dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-benchmark.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-benchmark.txt b/requirements/requirements-benchmark.txt index a02323669..f05548f23 100644 --- a/requirements/requirements-benchmark.txt +++ b/requirements/requirements-benchmark.txt @@ -1,4 +1,4 @@ -click==8.0.3 +click==8.0.4 gitdb2==4.0.2 GitPython==3.1.26 numpy==1.22.1 From 5784be8bd71d98f9af012ac070fbec1a53bb3cb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:58:44 -0600 Subject: [PATCH 08/11] Bump ruamel-yaml from 0.17.20 to 0.17.21 (#703) Bumps [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) from 0.17.20 to 0.17.21. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-test-optional.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-test-optional.txt b/requirements/requirements-test-optional.txt index 6467f6a8b..0d7bb3036 100644 --- a/requirements/requirements-test-optional.txt +++ b/requirements/requirements-test-optional.txt @@ -3,6 +3,6 @@ numpy==1.22.1 pandas==1.4.1; implementation_name=='cpython' pymongo==4.0.1; implementation_name=='cpython' redis==4.1.4 -ruamel.yaml==0.17.20 +ruamel.yaml==0.17.21 tables==3.7.0; implementation_name=='cpython' zarr==2.10.3; platform_system!='Windows' From df9e522499a2bfb4327419e417c98cb136bdffc2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:58:58 -0600 Subject: [PATCH 09/11] Bump numpy from 1.22.1 to 1.22.2 (#702) Bumps [numpy](https://github.com/numpy/numpy) from 1.22.1 to 1.22.2. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/HOWTO_RELEASE.rst.txt) - [Commits](https://github.com/numpy/numpy/compare/v1.22.1...v1.22.2) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-benchmark.txt | 2 +- requirements/requirements-test-optional.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/requirements-benchmark.txt b/requirements/requirements-benchmark.txt index f05548f23..48d6c8a96 100644 --- a/requirements/requirements-benchmark.txt +++ b/requirements/requirements-benchmark.txt @@ -1,6 +1,6 @@ click==8.0.4 gitdb2==4.0.2 GitPython==3.1.26 -numpy==1.22.1 +numpy==1.22.2 pandas==1.4.1; implementation_name=='cpython' --no-binary :none: psutil==5.9.0 diff --git a/requirements/requirements-test-optional.txt b/requirements/requirements-test-optional.txt index 0d7bb3036..24093b0ff 100644 --- a/requirements/requirements-test-optional.txt +++ b/requirements/requirements-test-optional.txt @@ -1,5 +1,5 @@ h5py==3.6.0; implementation_name=='cpython' -numpy==1.22.1 +numpy==1.22.2 pandas==1.4.1; implementation_name=='cpython' pymongo==4.0.1; implementation_name=='cpython' redis==4.1.4 From 7315dffa03f694eed481293640cd67c667c33f2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 07:07:59 -0800 Subject: [PATCH 10/11] Bump pytest from 6.2.5 to 7.0.1 (#695) Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.0.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.0.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index da715d6fc..6cc761564 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -1,3 +1,3 @@ coverage==6.3.2 -pytest==6.2.5 +pytest==7.0.1 pytest-cov==3.0.0 From 2c6da9f5081c7bf1cefb73aeebfb9f5f9f50ce1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 15:25:49 +0100 Subject: [PATCH 11/11] Bump gitpython from 3.1.26 to 3.1.27 (#696) Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.26 to 3.1.27. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.26...3.1.27) --- updated-dependencies: - dependency-name: gitpython dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carl Simon Adorf --- requirements/requirements-benchmark.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-benchmark.txt b/requirements/requirements-benchmark.txt index 48d6c8a96..d01fb63ba 100644 --- a/requirements/requirements-benchmark.txt +++ b/requirements/requirements-benchmark.txt @@ -1,6 +1,6 @@ click==8.0.4 gitdb2==4.0.2 -GitPython==3.1.26 +GitPython==3.1.27 numpy==1.22.2 pandas==1.4.1; implementation_name=='cpython' --no-binary :none: psutil==5.9.0