Repository: ResearchObject/ro-crate-py

Issue:
Export entities/models in `rocrate.model.__init__`
Hi,

Would it be possible to simplify the imports of ro-crate-py, import/exporting entities like `Person`, `ContextEntity`, `Metadata`, etc, from the `__init__.py` file?

So that instead of having to write

```
from rocrate.model.person import Person
from rocrate.model.contextentity import ContextEntity
from rocrate.model.metadata import Metadata
```

one can do just

```
from rocrate.model import Person, ContextEntity, Metadata
```

Cheers,
Bruno

Comments:

Patch:
diff --git a/rocrate/metadata.py b/rocrate/metadata.py
index 98e4583..e37c111 100644
--- a/rocrate/metadata.py
+++ b/rocrate/metadata.py
@@ -19,7 +19,7 @@
 import json
 import warnings
 
-from .model.metadata import Metadata, LegacyMetadata
+from .model import Metadata, LegacyMetadata
 
 
 def read_metadata(metadata_path):
diff --git a/rocrate/model/__init__.py b/rocrate/model/__init__.py
index 2e3ad6b..ec4376d 100644
--- a/rocrate/model/__init__.py
+++ b/rocrate/model/__init__.py
@@ -24,3 +24,46 @@ in rocrate_ represented as different Python classes.
 
 .. _rocrate: https://w3id.org/ro/crate/
 """
+
+from .computationalworkflow import ComputationalWorkflow, WorkflowDescription, Workflow
+from .computerlanguage import ComputerLanguage
+from .contextentity import ContextEntity
+from .creativework import CreativeWork
+from .data_entity import DataEntity
+from .dataset import Dataset
+from .entity import Entity
+from .file import File
+from .file_or_dir import FileOrDir
+from .metadata import Metadata, LegacyMetadata
+from .person import Person
+from .root_dataset import RootDataset
+from .softwareapplication import SoftwareApplication
+from .testdefinition import TestDefinition
+from .testinstance import TestInstance
+from .preview import Preview
+from .testservice import TestService
+from .testsuite import TestSuite
+
+__all__ = [
+    "ComputationalWorkflow",
+    "ComputerLanguage",
+    "ContextEntity",
+    "CreativeWork",
+    "DataEntity",
+    "Dataset",
+    "Entity",
+    "File",
+    "FileOrDir",
+    "LegacyMetadata",
+    "Metadata",
+    "Person",
+    "Preview",
+    "RootDataset",
+    "SoftwareApplication",
+    "TestDefinition",
+    "TestInstance",
+    "TestService",
+    "TestSuite",
+    "Workflow",
+    "WorkflowDescription",
+]
diff --git a/rocrate/rocrate.py b/rocrate/rocrate.py
index 02c57f8..98ec74b 100644
--- a/rocrate/rocrate.py
+++ b/rocrate/rocrate.py
@@ -28,22 +28,31 @@ from collections import OrderedDict
 from pathlib import Path
 from urllib.parse import urljoin
 
-from .model.contextentity import ContextEntity
-from .model.entity import Entity
-from .model.root_dataset import RootDataset
-from .model.data_entity import DataEntity
-from .model.file_or_dir import FileOrDir
-from .model.file import File
-from .model.dataset import Dataset
-from .model.metadata import WORKFLOW_PROFILE, Metadata, LegacyMetadata, TESTING_EXTRA_TERMS, metadata_class
-from .model.preview import Preview
-from .model.testdefinition import TestDefinition
-from .model.computationalworkflow import ComputationalWorkflow, WorkflowDescription, galaxy_to_abstract_cwl
-from .model.computerlanguage import ComputerLanguage, get_lang
-from .model.testinstance import TestInstance
-from .model.testservice import TestService, get_service
-from .model.softwareapplication import SoftwareApplication, get_app
-from .model.testsuite import TestSuite
+from .model import (
+    ComputationalWorkflow,
+    ComputerLanguage,
+    ContextEntity,
+    DataEntity,
+    Dataset,
+    Entity,
+    File,
+    FileOrDir,
+    LegacyMetadata,
+    Metadata,
+    Preview,
+    RootDataset,
+    SoftwareApplication,
+    TestDefinition,
+    TestInstance,
+    TestService,
+    TestSuite,
+    WorkflowDescription,
+)
+from .model.metadata import WORKFLOW_PROFILE, TESTING_EXTRA_TERMS, metadata_class
+from .model.computationalworkflow import galaxy_to_abstract_cwl
+from .model.computerlanguage import get_lang
+from .model.testservice import get_service
+from .model.softwareapplication import get_app
 
 from .utils import is_url, subclasses, get_norm_value, walk
 from .metadata import read_metadata, find_root_entity_id


Test patch:
diff --git a/test/test_cli.py b/test/test_cli.py
index 4781fcd..de2aa23 100644
--- a/test/test_cli.py
+++ b/test/test_cli.py
@@ -22,7 +22,7 @@ from click.testing import CliRunner
 import pytest
 
 from rocrate.cli import cli
-from rocrate.model.file import File
+from rocrate.model import File
 from rocrate.model.metadata import TESTING_EXTRA_TERMS
 from rocrate.rocrate import ROCrate
 
diff --git a/test/test_model.py b/test/test_model.py
index 184b1ef..c9ec981 100644
--- a/test/test_model.py
+++ b/test/test_model.py
@@ -26,13 +26,15 @@ from pathlib import Path
 
 import pytest
 from rocrate.rocrate import ROCrate
-from rocrate.model.data_entity import DataEntity
-from rocrate.model.file import File
-from rocrate.model.dataset import Dataset
-from rocrate.model.computationalworkflow import ComputationalWorkflow
-from rocrate.model.person import Person
-from rocrate.model.preview import Preview
-from rocrate.model.contextentity import ContextEntity
+from rocrate.model import (
+    DataEntity,
+    File,
+    Dataset,
+    ComputationalWorkflow,
+    Person,
+    Preview,
+    ContextEntity
+)
 
 
 RAW_REPO_URL = "https://raw.githubusercontent.com/ResearchObject/ro-crate-py"
diff --git a/test/test_read.py b/test/test_read.py
index 57adc45..c7843f7 100644
--- a/test/test_read.py
+++ b/test/test_read.py
@@ -24,9 +24,7 @@ import zipfile
 from pathlib import Path
 
 from rocrate.rocrate import ROCrate
-from rocrate.model.data_entity import DataEntity
-from rocrate.model.file import File
-from rocrate.model.dataset import Dataset
+from rocrate.model import DataEntity, File, Dataset
 
 _URL = ('https://raw.githubusercontent.com/ResearchObject/ro-crate-py/master/'
         'test/test-data/sample_file.txt')
diff --git a/test/test_test_metadata.py b/test/test_test_metadata.py
index 6ba584d..f698490 100644
--- a/test/test_test_metadata.py
+++ b/test/test_test_metadata.py
@@ -19,12 +19,14 @@
 import pytest
 
 from rocrate.rocrate import ROCrate
-from rocrate.model.testservice import TestService
-from rocrate.model.testinstance import TestInstance
-from rocrate.model.testdefinition import TestDefinition
-from rocrate.model.testsuite import TestSuite
-from rocrate.model.softwareapplication import SoftwareApplication
-from rocrate.model.computationalworkflow import ComputationalWorkflow
+from rocrate.model import (
+    TestService,
+    TestInstance,
+    TestDefinition,
+    TestSuite,
+    SoftwareApplication,
+    ComputationalWorkflow,
+)
 
 # Tell pytest these are not test classes (so it doesn't try to collect them)
 TestService.__test__ = False
diff --git a/test/test_write.py b/test/test_write.py
index b2f264e..10f0ec3 100644
--- a/test/test_write.py
+++ b/test/test_write.py
@@ -24,8 +24,7 @@ import zipfile
 from itertools import product
 from urllib.error import URLError
 
-from rocrate.model.dataset import Dataset
-from rocrate.model.person import Person
+from rocrate.model import Dataset, Person
 from rocrate.rocrate import ROCrate