Skip to content

Commit 574b5f1

Browse files
Remove deprecated add_hidden_timestamp feature and dead code
- Remove add_hidden_timestamp config setting (replaced by job metadata) - Remove hash-based timestamp column generation from declare.py - Remove unused sha1 import - Remove unused test fixtures: monkeysession, monkeymodule, enable_adapted_types - Clean up empty Utility Fixtures section in conftest.py Job metadata feature (config.jobs.add_job_metadata) remains for computed table provenance tracking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent b09310d commit 574b5f1

File tree

5 files changed

+1
-75
lines changed

5 files changed

+1
-75
lines changed

src/datajoint/declare.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import logging
77
import re
8-
from hashlib import sha1
98

109
import pyparsing as pp
1110

@@ -297,13 +296,6 @@ def declare(full_table_name, definition, context):
297296
fk_attribute_map,
298297
) = prepare_declare(definition, context)
299298

300-
if config.get("add_hidden_timestamp", False):
301-
metadata_attr_sql = ["`_{full_table_name}_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"]
302-
attribute_sql.extend(
303-
attr.format(full_table_name=sha1(full_table_name.replace("`", "").encode("utf-8")).hexdigest())
304-
for attr in metadata_attr_sql
305-
)
306-
307299
# Add hidden job metadata for Computed/Imported tables (not parts)
308300
# Note: table_name may still have backticks, strip them for prefix checking
309301
clean_table_name = table_name.strip("`")

src/datajoint/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ class Config(BaseSettings):
302302
safemode: bool = True
303303
fetch_format: Literal["array", "frame"] = "array"
304304
enable_python_native_blobs: bool = True
305-
add_hidden_timestamp: bool = False
306305
filepath_checksum_size_limit: int | None = None
307306

308307
# External stores configuration

src/datajoint/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# version bump auto managed by Github Actions:
22
# label_prs.yaml(prep), release.yaml(bump), post_release.yaml(edit)
33
# manually set this version will be eventually overwritten by the above actions
4-
__version__ = "2.0.0a10"
4+
__version__ = "2.0.0a11"

tests/conftest.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -454,29 +454,6 @@ def minio_client(s3_creds, s3fs_client, teardown=False):
454454
pass
455455

456456

457-
# =============================================================================
458-
# Utility Fixtures
459-
# =============================================================================
460-
461-
462-
@pytest.fixture(scope="session")
463-
def monkeysession():
464-
with pytest.MonkeyPatch.context() as mp:
465-
yield mp
466-
467-
468-
@pytest.fixture(scope="module")
469-
def monkeymodule():
470-
with pytest.MonkeyPatch.context() as mp:
471-
yield mp
472-
473-
474-
@pytest.fixture
475-
def enable_adapted_types():
476-
"""Deprecated - custom attribute types no longer require a feature flag."""
477-
yield
478-
479-
480457
# =============================================================================
481458
# Cleanup Fixtures
482459
# =============================================================================

tests/integration/test_declare.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import datajoint as dj
66
from datajoint.declare import declare
7-
from datajoint.settings import config
87

98
from tests.schema import (
109
Auto,
@@ -22,24 +21,6 @@
2221
)
2322

2423

25-
@pytest.fixture(scope="function")
26-
def enable_add_hidden_timestamp():
27-
orig_config_val = config.get("add_hidden_timestamp")
28-
config["add_hidden_timestamp"] = True
29-
yield
30-
if orig_config_val is not None:
31-
config["add_hidden_timestamp"] = orig_config_val
32-
33-
34-
@pytest.fixture(scope="function")
35-
def disable_add_hidden_timestamp():
36-
orig_config_val = config.get("add_hidden_timestamp")
37-
config["add_hidden_timestamp"] = False
38-
yield
39-
if orig_config_val is not None:
40-
config["add_hidden_timestamp"] = orig_config_val
41-
42-
4324
def test_schema_decorator(schema_any):
4425
assert issubclass(Subject, dj.Lookup)
4526
assert not issubclass(Subject, dj.Part)
@@ -384,26 +365,3 @@ class Table_With_Underscores(dj.Manual):
384365
schema_any(TableNoUnderscores)
385366
with pytest.raises(dj.DataJointError, match="must be alphanumeric in CamelCase"):
386367
schema_any(Table_With_Underscores)
387-
388-
389-
def test_add_hidden_timestamp_default_value():
390-
config_val = config.get("add_hidden_timestamp")
391-
assert config_val is not None and not config_val, "Default value for add_hidden_timestamp is not False"
392-
393-
394-
def test_add_hidden_timestamp_enabled(enable_add_hidden_timestamp, schema_any_fresh):
395-
assert config["add_hidden_timestamp"], "add_hidden_timestamp is not enabled"
396-
msg = f"{Experiment().heading._attributes=}"
397-
assert any(a.name.endswith("_timestamp") for a in Experiment().heading._attributes.values()), msg
398-
assert any(a.name.startswith("_") for a in Experiment().heading._attributes.values()), msg
399-
assert any(a.is_hidden for a in Experiment().heading._attributes.values()), msg
400-
assert not any(a.is_hidden for a in Experiment().heading.attributes.values()), msg
401-
402-
403-
def test_add_hidden_timestamp_disabled(disable_add_hidden_timestamp, schema_any_fresh):
404-
assert not config["add_hidden_timestamp"], "expected add_hidden_timestamp to be False"
405-
msg = f"{Experiment().heading._attributes=}"
406-
assert not any(a.name.endswith("_timestamp") for a in Experiment().heading._attributes.values()), msg
407-
assert not any(a.name.startswith("_") for a in Experiment().heading._attributes.values()), msg
408-
assert not any(a.is_hidden for a in Experiment().heading._attributes.values()), msg
409-
assert not any(a.is_hidden for a in Experiment().heading.attributes.values()), msg

0 commit comments

Comments
 (0)