@@ -83,6 +83,9 @@ def get_indexes(root):
83
83
"information."
84
84
)
85
85
86
+ # Temporary default for project names until they are removed entirely in signac 2.0
87
+ _DEFAULT_PROJECT_NAME = None
88
+
86
89
87
90
class JobSearchIndex :
88
91
"""Search for specific jobs with filters.
@@ -170,7 +173,7 @@ def find_job_ids(self, filter=None, doc_filter=None):
170
173
if doc_filter :
171
174
filter .update (doc_filter )
172
175
elif doc_filter :
173
- warnings .warn (DOC_FILTER_WARNING , DeprecationWarning )
176
+ warnings .warn (DOC_FILTER_WARNING , FutureWarning )
174
177
filter = doc_filter
175
178
return self ._collection ._find (filter )
176
179
@@ -917,7 +920,7 @@ def detect_schema(self, exclude_const=False, subset=None, index=None):
917
920
if index is None :
918
921
index = self .index (include_job_document = False )
919
922
else :
920
- warnings .warn (INDEX_DEPRECATION_WARNING , DeprecationWarning )
923
+ warnings .warn (INDEX_DEPRECATION_WARNING , FutureWarning )
921
924
if subset is not None :
922
925
subset = {str (s ) for s in subset }
923
926
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):
1031
1034
if index is None :
1032
1035
filter = dict (parse_filter (_add_prefix ("sp." , filter )))
1033
1036
if doc_filter :
1034
- warnings .warn (DOC_FILTER_WARNING , DeprecationWarning )
1037
+ warnings .warn (DOC_FILTER_WARNING , FutureWarning )
1035
1038
filter .update (parse_filter (_add_prefix ("doc." , doc_filter )))
1036
1039
index = self .index (include_job_document = True )
1037
1040
elif "doc" in _root_keys (filter ):
1038
1041
index = self .index (include_job_document = True )
1039
1042
else :
1040
1043
index = self ._sp_index ()
1041
1044
else :
1042
- warnings .warn (INDEX_DEPRECATION_WARNING , DeprecationWarning )
1045
+ warnings .warn (INDEX_DEPRECATION_WARNING , FutureWarning )
1043
1046
1044
1047
return Collection (index , _trust = True )._find (filter )
1045
1048
@@ -1079,7 +1082,7 @@ def find_jobs(self, filter=None, doc_filter=None):
1079
1082
"""
1080
1083
filter = dict (parse_filter (_add_prefix ("sp." , filter )))
1081
1084
if doc_filter :
1082
- warnings .warn (DOC_FILTER_WARNING , DeprecationWarning )
1085
+ warnings .warn (DOC_FILTER_WARNING , FutureWarning )
1083
1086
filter .update (parse_filter (_add_prefix ("doc." , doc_filter )))
1084
1087
return JobsCursor (self , filter )
1085
1088
@@ -1521,7 +1524,7 @@ def create_linked_view(self, prefix=None, job_ids=None, index=None, path=None):
1521
1524
1522
1525
"""
1523
1526
if index is not None :
1524
- warnings .warn (INDEX_DEPRECATION_WARNING , DeprecationWarning )
1527
+ warnings .warn (INDEX_DEPRECATION_WARNING , FutureWarning )
1525
1528
from .linked_view import create_linked_view
1526
1529
1527
1530
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):
1922
1925
if index is not None :
1923
1926
for doc in index :
1924
1927
self ._sp_cache [doc ["signac_id" ]] = doc ["sp" ]
1925
- warnings .warn (INDEX_DEPRECATION_WARNING , DeprecationWarning )
1928
+ warnings .warn (INDEX_DEPRECATION_WARNING , FutureWarning )
1926
1929
corrupted = []
1927
1930
for job_id in job_ids :
1928
1931
try :
@@ -2226,7 +2229,7 @@ def create_access_module(self, filename=None, main=True, master=None):
2226
2229
"""
2227
2230
if master is not None :
2228
2231
warnings .warn (
2229
- "The parameter master has been renamed to main." , DeprecationWarning
2232
+ "The parameter master has been renamed to main." , FutureWarning
2230
2233
)
2231
2234
main = master
2232
2235
@@ -2282,8 +2285,8 @@ def temporary_project(self, name=None, dir=None):
2282
2285
yield tmp_project
2283
2286
2284
2287
@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.
2287
2290
2288
2291
It is safe to call this function multiple times with the same
2289
2292
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):
2294
2297
2295
2298
Parameters
2296
2299
----------
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
2300
2303
The root directory for the project.
2301
2304
Defaults to the current working directory.
2302
- workspace : str
2305
+ workspace : str, optional
2303
2306
The workspace directory for the project.
2304
2307
Defaults to a subdirectory ``workspace`` in the project root.
2305
- make_dir : bool
2308
+ make_dir : bool, optional
2306
2309
Create the project root directory if it does not exist yet
2307
2310
(Default value = True).
2308
2311
@@ -2320,6 +2323,16 @@ def init_project(cls, name, root=None, workspace=None, make_dir=True):
2320
2323
"""
2321
2324
if root is None :
2322
2325
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
2323
2336
try :
2324
2337
project = cls .get_project (root = root , search = False )
2325
2338
except LookupError :
@@ -3033,24 +3046,24 @@ def _repr_html_(self):
3033
3046
return repr (self ) + self ._repr_html_jobs ()
3034
3047
3035
3048
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.
3038
3051
3039
3052
It is safe to call this function multiple times with the same arguments.
3040
3053
However, a `RuntimeError` is raised if an existing project configuration
3041
3054
would conflict with the provided initialization parameters.
3042
3055
3043
3056
Parameters
3044
3057
----------
3045
- name : str
3058
+ name : str, optional
3046
3059
The name of the project to initialize.
3047
- root : str
3060
+ root : str, optional
3048
3061
The root directory for the project.
3049
3062
Defaults to the current working directory.
3050
- workspace : str
3063
+ workspace : str, optional
3051
3064
The workspace directory for the project.
3052
3065
Defaults to a subdirectory ``workspace`` in the project root.
3053
- make_dir : bool
3066
+ make_dir : bool, optional
3054
3067
Create the project root directory, if it does not exist yet (Default
3055
3068
value = True).
3056
3069
0 commit comments