Skip to content

Commit d4a347a

Browse files
committed
Merge remote-tracking branch 'origin/master' into additional_deprecations
2 parents de2da7a + 2c6da9f commit d4a347a

8 files changed

+60
-37
lines changed

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Changed
2020
+++++++
2121

2222
- Schema migration is now performed on directories rather than signac projects and supports a wider range of schemas (#654).
23+
- Deprecated features now use ``FutureWarning`` instead of ``DeprecationWarning``, which is hidden by default (#687, #691).
2324

2425
Deprecated
2526
++++++++++
@@ -31,6 +32,11 @@ Deprecated
3132
- ``signac.cite`` module is deprecated (#611, #592).
3233
- ``config.get_config`` method is deprecated (#675).
3334

35+
Changed
36+
+++++++
37+
38+
- Project names have a default in anticipation of removing names entirely. Project names will be removed in signac 2.0.
39+
3440
Fixed
3541
+++++
3642

contributors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,8 @@ contributors:
107107
family-names: Dave
108108
given-names: Shantanu
109109
affiliation: "Jodhpur Institute of Engineering and Technology"
110+
-
111+
family-names: Mahapatra
112+
given-names: Onkar
113+
affiliation: "Cluster Innovation Centre, New Delhi"
110114
...
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
click==8.0.3
1+
click==8.0.4
22
gitdb2==4.0.2
3-
GitPython==3.1.26
4-
numpy==1.22.1
5-
pandas==1.4.0; implementation_name=='cpython' --no-binary :none:
3+
GitPython==3.1.27
4+
numpy==1.22.2
5+
pandas==1.4.1; implementation_name=='cpython' --no-binary :none:
66
psutil==5.9.0
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
h5py==3.6.0; implementation_name=='cpython'
2-
numpy==1.22.1
3-
pandas==1.4.0; implementation_name=='cpython'
2+
numpy==1.22.2
3+
pandas==1.4.1; implementation_name=='cpython'
44
pymongo==4.0.1; implementation_name=='cpython'
5-
redis==4.1.2
6-
ruamel.yaml==0.17.20
5+
redis==4.1.4
6+
ruamel.yaml==0.17.21
77
tables==3.7.0; implementation_name=='cpython'
88
zarr==2.10.3; platform_system!='Windows'

requirements/requirements-test.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
coverage==6.3
2-
pytest==6.2.5
1+
coverage==6.3.2
2+
pytest==7.0.1
33
pytest-cov==3.0.0

signac/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,10 +1093,7 @@ def main_shell(args):
10931093
except LookupError:
10941094
print("signac", __version__)
10951095
print("No project within this directory.")
1096-
print(
1097-
"If you want to initialize a project, execute `$ signac init <project-name>`, "
1098-
"where <project-name> can be freely chosen."
1099-
)
1096+
print("If you want to initialize a project, execute `$ signac init`.")
11001097
else:
11011098
_jobs = find_with_filter(args)
11021099

@@ -1201,7 +1198,10 @@ def main():
12011198

12021199
parser_init = subparsers.add_parser("init")
12031200
parser_init.add_argument(
1204-
"project_id", type=str, help="Initialize a project with the given project id."
1201+
"project_id",
1202+
nargs="?",
1203+
type=str,
1204+
help="Initialize a project with the given project id.",
12051205
)
12061206
parser_init.add_argument(
12071207
"-w",

signac/contrib/project.py

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def get_indexes(root):
8383
"information."
8484
)
8585

86+
# Temporary default for project names until they are removed entirely in signac 2.0
87+
_DEFAULT_PROJECT_NAME = None
88+
8689

8790
class JobSearchIndex:
8891
"""Search for specific jobs with filters.
@@ -170,7 +173,7 @@ def find_job_ids(self, filter=None, doc_filter=None):
170173
if doc_filter:
171174
filter.update(doc_filter)
172175
elif doc_filter:
173-
warnings.warn(DOC_FILTER_WARNING, DeprecationWarning)
176+
warnings.warn(DOC_FILTER_WARNING, FutureWarning)
174177
filter = doc_filter
175178
return self._collection._find(filter)
176179

@@ -917,7 +920,7 @@ def detect_schema(self, exclude_const=False, subset=None, index=None):
917920
if index is None:
918921
index = self.index(include_job_document=False)
919922
else:
920-
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
923+
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
921924
if subset is not None:
922925
subset = {str(s) for s in subset}
923926
index = [doc for doc in index if doc["_id"] in subset]
@@ -1031,15 +1034,15 @@ def _find_job_ids(self, filter=None, doc_filter=None, index=None):
10311034
if index is None:
10321035
filter = dict(parse_filter(_add_prefix("sp.", filter)))
10331036
if doc_filter:
1034-
warnings.warn(DOC_FILTER_WARNING, DeprecationWarning)
1037+
warnings.warn(DOC_FILTER_WARNING, FutureWarning)
10351038
filter.update(parse_filter(_add_prefix("doc.", doc_filter)))
10361039
index = self.index(include_job_document=True)
10371040
elif "doc" in _root_keys(filter):
10381041
index = self.index(include_job_document=True)
10391042
else:
10401043
index = self._sp_index()
10411044
else:
1042-
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
1045+
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
10431046

10441047
return Collection(index, _trust=True)._find(filter)
10451048

@@ -1079,7 +1082,7 @@ def find_jobs(self, filter=None, doc_filter=None):
10791082
"""
10801083
filter = dict(parse_filter(_add_prefix("sp.", filter)))
10811084
if doc_filter:
1082-
warnings.warn(DOC_FILTER_WARNING, DeprecationWarning)
1085+
warnings.warn(DOC_FILTER_WARNING, FutureWarning)
10831086
filter.update(parse_filter(_add_prefix("doc.", doc_filter)))
10841087
return JobsCursor(self, filter)
10851088

@@ -1521,7 +1524,7 @@ def create_linked_view(self, prefix=None, job_ids=None, index=None, path=None):
15211524
15221525
"""
15231526
if index is not None:
1524-
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
1527+
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
15251528
from .linked_view import create_linked_view
15261529

15271530
return create_linked_view(self, prefix, job_ids, index, path)
@@ -1922,7 +1925,7 @@ def repair(self, fn_statepoints=None, index=None, job_ids=None):
19221925
if index is not None:
19231926
for doc in index:
19241927
self._sp_cache[doc["signac_id"]] = doc["sp"]
1925-
warnings.warn(INDEX_DEPRECATION_WARNING, DeprecationWarning)
1928+
warnings.warn(INDEX_DEPRECATION_WARNING, FutureWarning)
19261929
corrupted = []
19271930
for job_id in job_ids:
19281931
try:
@@ -2226,7 +2229,7 @@ def create_access_module(self, filename=None, main=True, master=None):
22262229
"""
22272230
if master is not None:
22282231
warnings.warn(
2229-
"The parameter master has been renamed to main.", DeprecationWarning
2232+
"The parameter master has been renamed to main.", FutureWarning
22302233
)
22312234
main = master
22322235

@@ -2282,8 +2285,8 @@ def temporary_project(self, name=None, dir=None):
22822285
yield tmp_project
22832286

22842287
@classmethod
2285-
def init_project(cls, name, root=None, workspace=None, make_dir=True):
2286-
"""Initialize a project with the given name.
2288+
def init_project(cls, name=None, root=None, workspace=None, make_dir=True):
2289+
"""Initialize a project.
22872290
22882291
It is safe to call this function multiple times with the same
22892292
arguments. However, a `RuntimeError` is raised if an existing project
@@ -2294,15 +2297,15 @@ def init_project(cls, name, root=None, workspace=None, make_dir=True):
22942297
22952298
Parameters
22962299
----------
2297-
name : str
2298-
The name of the project to initialize.
2299-
root : str
2300+
name : str, optional
2301+
The name of the project to initialize (Default value = None).
2302+
root : str, optional
23002303
The root directory for the project.
23012304
Defaults to the current working directory.
2302-
workspace : str
2305+
workspace : str, optional
23032306
The workspace directory for the project.
23042307
Defaults to a subdirectory ``workspace`` in the project root.
2305-
make_dir : bool
2308+
make_dir : bool, optional
23062309
Create the project root directory if it does not exist yet
23072310
(Default value = True).
23082311
@@ -2320,6 +2323,16 @@ def init_project(cls, name, root=None, workspace=None, make_dir=True):
23202323
"""
23212324
if root is None:
23222325
root = os.getcwd()
2326+
2327+
if name is not None:
2328+
warnings.warn(
2329+
"Project names are deprecated and will be removed in signac 2.0 in favor of using "
2330+
"the project root directory to identify projects. The name argument to "
2331+
"init_project should be removed.",
2332+
FutureWarning,
2333+
)
2334+
else:
2335+
name = _DEFAULT_PROJECT_NAME
23232336
try:
23242337
project = cls.get_project(root=root, search=False)
23252338
except LookupError:
@@ -3033,24 +3046,24 @@ def _repr_html_(self):
30333046
return repr(self) + self._repr_html_jobs()
30343047

30353048

3036-
def init_project(name, root=None, workspace=None, make_dir=True):
3037-
"""Initialize a project with the given name.
3049+
def init_project(name=None, root=None, workspace=None, make_dir=True):
3050+
"""Initialize a project.
30383051
30393052
It is safe to call this function multiple times with the same arguments.
30403053
However, a `RuntimeError` is raised if an existing project configuration
30413054
would conflict with the provided initialization parameters.
30423055
30433056
Parameters
30443057
----------
3045-
name : str
3058+
name : str, optional
30463059
The name of the project to initialize.
3047-
root : str
3060+
root : str, optional
30483061
The root directory for the project.
30493062
Defaults to the current working directory.
3050-
workspace : str
3063+
workspace : str, optional
30513064
The workspace directory for the project.
30523065
Defaults to a subdirectory ``workspace`` in the project root.
3053-
make_dir : bool
3066+
make_dir : bool, optional
30543067
Create the project root directory, if it does not exist yet (Default
30553068
value = True).
30563069

signac/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def diff_jobs(*jobs):
3030
Examples
3131
--------
3232
>>> import signac
33-
>>> project = signac.init_project('project_name')
33+
>>> project = signac.init_project()
3434
>>> job1 = project.open_job({'constant': 42, 'diff1': 0, 'diff2': 1}).init()
3535
>>> job2 = project.open_job({'constant': 42, 'diff1': 1, 'diff2': 1}).init()
3636
>>> job3 = project.open_job({'constant': 42, 'diff1': 2, 'diff2': 2}).init()

0 commit comments

Comments
 (0)