Skip to content

Split base factory helpers#1682

Open
vmoens wants to merge 1 commit intopytorch:mainfrom
vmoens:split-big-files
Open

Split base factory helpers#1682
vmoens wants to merge 1 commit intopytorch:mainfrom
vmoens:split-big-files

Conversation

@vmoens
Copy link
Copy Markdown
Collaborator

@vmoens vmoens commented Apr 29, 2026

Summary

  • move tensordict.base factory helpers into tensordict._base.factories
  • keep tensordict.base as the compatibility facade for the moved helpers
  • add tests that lock legacy import paths and public __module__ values

BC notes

  • existing imports from tensordict, tensordict.base, tensordict._td, tensordict._lazy, tensordict.tensorclass, and tensordict.store._store remain valid
  • moved factory helpers keep __module__ == "tensordict.base"

Test plan

  • python -m pytest test/test_compatibility.py::test_legacy_import_paths_are_preserved test/test_compatibility.py::test_public_class_modules_are_preserved -q
  • python -m pytest test/test_tensordict.py -k "from_dict or from_namedtuple or from_struct_array or from_tuple or from_csv or from_json or from_parquet or from_pandas" -q
  • python -m pytest test/test_compatibility.py -q -k "not redis and not StoreFromSchema and not Preallocation"
  • python -m compileall -q tensordict/_base tensordict/base.py

Full test/test_compatibility.py is not runnable in my local environment because Redis Python support is installed but no Redis server is listening on localhost:6379.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR Title Label Error

PR title must start with a label prefix in brackets (e.g., [BugFix]).

Current title: Split base factory helpers

Supported Prefixes

Your PR title must start with exactly one of these prefixes (case-insensitive):

Prefix Label Applied Example
[BugFix] or [Fix] bug [BugFix] Fix memory leak in TensorDict
[Feature] Feature [Feature] Add new storage backend
[Doc] or [Docs] documentation [Doc] Update installation guide
[Refactor] Refactor [Refactor] Clean up module imports
[CI] CI [CI] Fix workflow permissions
[Test] or [Tests] Test [Test] Add unit tests for nn module
[Compile] Compile [Compile] Fix torch.compile issue
[Performance] or [Perf] Performance [Perf] Optimize tensor operations
[Deprecation] Deprecation [Deprecation] Mark old function
[Setup] setup [Setup] Update build configuration
[Distributed] or [Dist] Distributed [Distributed] Add scatter collective
[Benchmark] or [Bench] Benchmarks [Benchmark] Add compile benchmark
[Typing] or [Type] Typing [Typing] Add type stubs
[BC-breaking] or [BC] BC-breaking [BC-breaking] Remove deprecated API
[Formatting] or [Format] Formatting [Format] Fix code style
[Quality] Quality [Quality] Improve error messages

Note: Matching is case-insensitive. Common variations (singular/plural) are supported.

@github-actions github-actions Bot added the Test label Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR Title Label Error

PR title must start with a label prefix in brackets (e.g., [BugFix]).

Current title: Split base factory helpers

Supported Prefixes

Your PR title must start with exactly one of these prefixes (case-insensitive):

Prefix Label Applied Example
[BugFix] or [Fix] bug [BugFix] Fix memory leak in TensorDict
[Feature] Feature [Feature] Add new storage backend
[Doc] or [Docs] documentation [Doc] Update installation guide
[Refactor] Refactor [Refactor] Clean up module imports
[CI] CI [CI] Fix workflow permissions
[Test] or [Tests] Test [Test] Add unit tests for nn module
[Compile] Compile [Compile] Fix torch.compile issue
[Performance] or [Perf] Performance [Perf] Optimize tensor operations
[Deprecation] Deprecation [Deprecation] Mark old function
[Setup] setup [Setup] Update build configuration
[Distributed] or [Dist] Distributed [Distributed] Add scatter collective
[Benchmark] or [Bench] Benchmarks [Benchmark] Add compile benchmark
[Typing] or [Type] Typing [Typing] Add type stubs
[BC-breaking] or [BC] BC-breaking [BC-breaking] Remove deprecated API
[Formatting] or [Format] Formatting [Format] Fix code style
[Quality] Quality [Quality] Improve error messages

Note: Matching is case-insensitive. Common variations (singular/plural) are supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant