Skip to content

Commit 0720f3e

Browse files
swathipill0lawrence
authored andcommitted
[ModelsRepository] deprecating azure-iot-modelrepository (Azure#38225)
* [ModelsRepository] deprecating iot-modelrepository * add changelog section
1 parent a57398f commit 0720f3e

File tree

4 files changed

+7
-189
lines changed

4 files changed

+7
-189
lines changed

sdk/modelsrepository/azure-iot-modelsrepository/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Release History
22

3-
## 1.0.0b2 (Unreleased)
3+
## 1.0.0b2 (2024-10-31)
44

5-
- Python 2.7 is no longer supported. Please use Python version 3.6 or later.
5+
### Other Changes
6+
7+
- This package has been deprecated and will no longer be maintained after 2024-02-24.
68

79
## 1.0.0b1 (2021-04-27)
810

Lines changed: 2 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,186 +1,3 @@
1-
# Azure IoT Models Repository client library for Python
1+
# Microsoft Azure SDK for Python
22

3-
The Azure IoT Models Repository Library for Python provides functionality for working with the Azure IoT Models Repository
4-
5-
## Getting started
6-
7-
### Install package
8-
9-
Install the Azure IoT Models Repository library for Python with [pip][pip]:
10-
11-
```Shell
12-
pip install azure-iot-modelsrepository
13-
```
14-
15-
### Prerequisites
16-
* A models repository following [Azure IoT conventions][repo_conventions]
17-
* The models repository can be hosted on the local filesystem or hosted on a webserver
18-
* Azure IoT hosts the global [Azure IoT Models Repository][global_azure_repo] which the client will use if no custom location is provided
19-
20-
### Publishing Models
21-
Follow the [guide](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository#publish-a-model) to publish models to the global Azure IoT Models Repository.
22-
23-
If using a custom local or remote repository, you can simply add your model files to a directory structure in the repository location, e.g. `dtmi/com/example/thermostat-1.json`
24-
25-
### Authentication
26-
Currently, no authentication mechanisms are supported. The global endpoint is not tied to an Azure subscription and does not support authentication. All models published are meant for anonymous public consumption.
27-
28-
## Key concepts
29-
30-
The Azure IoT Models Repository enables builders to manage and share digital twin models. The models are [JSON-LD][json_ld] documents defined using the Digital Twins Definition Language ([DTDL][dtdl_spec]).
31-
32-
The repository defines a pattern to store DTDL interfaces in a directory structure based on the Digital Twin Model Identifier (DTMI). You can locate an interface in the repository by converting the DTMI to a relative path. For example, the DTMI `dtmi:com:example:Thermostat;1` translates to `/dtmi/com/example/thermostat-1.json`.
33-
34-
## Examples
35-
The following sections provide several snippets covering common Models Repository tasks:
36-
* [Initializing the ModelsRepositoryClient](#initializing-the-modelsrepositoryclient "Initializing the ModelsRepositoryClient")
37-
* [Get Models](#modelsrepositoryclient---get-models "Get models")
38-
* [DTMI Conventions](#dtmi-conventions "DTMI Conventions")
39-
40-
### Initializing the ModelsRepositoryClient
41-
42-
#### Repository Location
43-
When no repository location is provided during instantiation, the Azure IoT Models Repository global endpoint (https://devicemodels.azure.com/) is used
44-
45-
```python
46-
client = ModelsRepositoryClient()
47-
```
48-
49-
Alternatively, you can provide a custom location for where your repository is located via the optional `repository_location` keyword. The client accepts the following location formats:
50-
* Web URL - e.g. `"https://contoso.com/models/"`
51-
* Local Filesystem URI - e.g. `"file:///path/to/repository/"`
52-
* POSIX filepath - e.g. `"/path/to/repository/"`
53-
* Drive letter filepath - e.g. `"C:/path/to/repository/"`
54-
```python
55-
client = ModelsRepositoryClient(repository_location="https://contoso.com/models/")
56-
```
57-
58-
#### Dependency Resolution Mode
59-
The client can be configured with an optional `dependency_resolution` mode at instantiation, using one of the following values:
60-
* `'disabled'` - The client will not resolve model dependencies
61-
* `'enabled'` - The client will resolve any model dependencies
62-
* `'tryFromExpanded'` - The client will attempt to resolve models using an expanded model definition (falling back on `'enabled'` mode if not possible)
63-
64-
```python
65-
client = ModelsRepositoryClient(dependency_resolution="enabled")
66-
```
67-
68-
If the `dependency_resolution` mode is not specified:
69-
* Clients configured for the Azure IoT Models Repository global endpoint will default to using `'tryFromExpanded'`
70-
* Clients configured for a custom location (remote or local) will default to using `'enabled'`
71-
72-
#### Additional Options
73-
If you need to override default pipeline behavior from the [azure-core library][azure_core_docs], you can provide various [keyword arguments][azure_core_kwargs] during instantiation.
74-
75-
#### Client cleanup
76-
When you are finished with your client, make sure to call `.close()` in order to free up resources
77-
78-
```python
79-
client = ModelsRepositoryClient()
80-
# Do things
81-
client.close()
82-
```
83-
84-
In order to avoid having to do this, it is recommended that you use your client from within a context manager whenever possible, which will automatically close for you
85-
```python
86-
with ModelsRepositoryClient() as client:
87-
# Do things
88-
```
89-
90-
### ModelsRepositoryClient - Get Models
91-
Note that you must first [publish models to your repository](#publishing-models "Publishing models") before you can fetch them. The following examples assume you are using the global Azure IoT Models Repository.
92-
93-
Calling `.get_models()` will fetch the model at the provided DTMI and potentially its dependencies (depending on the dependency resolution mode). It will return a `dict` that maps DTMIs to model definitions.
94-
95-
```python
96-
dtmi = "dtmi:com:example:TemperatureController;1"
97-
with ModelsRepositoryClient() as client:
98-
models = get_models(dtmi)
99-
print("{} resolved in {} interfaces".format(dtmi, len(models)))
100-
```
101-
102-
If you provide multiple DTMIs to the method, you can retrieve multiple models (and potentially their dependencies) at once
103-
```python
104-
dtmis = ["dtmi:com:example:TemperatureController;1", "dtmi:com:example:azuresphere:sampledevice;1"]
105-
with ModelsRepositoryClient() as client:
106-
models = get_models(dtmis)
107-
print("{} resolved in {} interfaces".format(dtmi, len(models)))
108-
```
109-
110-
By default the client will use whichever [dependency resolution mode](#dependency-resolution-mode "Dependency resolution mode") it was configured with at instantiation when retrieving models. However, this behavior can be overridden by passing any of the valid options in as an optional keyword argument to `.get_models()`
111-
112-
```python
113-
dtmi = "dtmi:com:example:TemperatureController;1"
114-
with ModelsRepositoryClient(dependency_resolution="disabled") as client:
115-
models = get_models(dtmi, dependency_resolution="enabled")
116-
```
117-
118-
### DTMI Conventions
119-
The package contains a module called `dtmi_conventions`, which, when imported provides a series of utility operations for working with DTMIs
120-
121-
```python
122-
# Returns True - this is a valid DTMI
123-
dtmi_conventions.is_valid_dtmi("dtmi:com:example:Thermostat;1")
124-
125-
# Returns False - this is NOT a valid DTMI
126-
dtmi_conventions.is_valid_dtmi("dtmi:com:example:Thermostat")
127-
```
128-
129-
```python
130-
dtmi = "dtmi:com:example:Thermostat;1"
131-
132-
# Local repository example
133-
repo_uri = "file:///path/to/repository"
134-
print(dtmi_conventions.get_model_uri(dtmi, repo_uri))
135-
# Prints: "file:///path/to/repository/dtmi/com/example/thermostat-1.json"
136-
print(dtmi_conventions.get_model_uri(dtmi, repo_uri, expanded=True))
137-
# Prints: "file:///path/to/repository/dtmi/com/example/thermostat-1.expanded.json"
138-
139-
# Remote repository example
140-
repo_uri = "https://contoso.com/models/"
141-
print(dtmi_conventions.get_model_uri(dtmi, repo_uri))
142-
# Prints: "https://contoso/com/models/dtmi/com/example/thermostat-1.json"
143-
print(dtmi_conventions.get_model_uri(dtmi, repo_uri, expanded=True))
144-
# Prints: "https://contoso/com/models/dtmi/com/example/thermostat-1.expanded.json"
145-
```
146-
147-
148-
## Troubleshooting
149-
150-
### Logging
151-
This library uses the standard [logging][logging_doc] library for logging. Information about HTTP sessions (URLs, headers, etc.) is logged at `DEBUG` level.
152-
153-
### Exceptions
154-
Models Repository APIs may raise exceptions defined in [azure-core][azure_core_exceptions].
155-
156-
Additionally, they may raise exceptions defined in the `azure-iot-modelsrepository`:
157-
* `ModelError` - Indicates an error occurred while trying to parse/resolve a model definition. This generally means that there is a malformed model that does not comply with the [model DTDL specification][dtdl_spec]
158-
159-
### Provide Feedback
160-
If you encounter bugs or have suggestions, please
161-
[open an issue](https://github.com/Azure/azure-sdk-for-python/issues).
162-
163-
## Next steps
164-
165-
### Samples
166-
Additional samples are available in the [samples repository][samples_repo].
167-
168-
### Contributing
169-
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
170-
171-
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
172-
173-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
174-
175-
176-
<!-- LINKS -->
177-
[azure_core_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html
178-
[azure_core_exceptions]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core#azure-core-library-exceptions
179-
[azure_core_kwargs]: https://aka.ms/azsdk/python/options
180-
[dtdl_spec]: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md
181-
[global_azure_repo]: https://devicemodels.azure.com/
182-
[json_ld]: https://json-ld.org/
183-
[logging_doc]: https://docs.python.org/3.5/library/logging.html
184-
[pip]: https://pypi.org/project/pip/
185-
[repo_conventions]: https://github.com/Azure/iot-plugandplay-models-tools/wiki
186-
[samples_repo]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/modelsrepository/azure-iot-modelsrepository/samples/
3+
This package has been deprecated and will no longer be maintained after 2024-02-24.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[tool.azure-sdk-build]
22
pyright = false
33
type_check_samples = false
4-
ci_enabled = false

sdk/modelsrepository/azure-iot-modelsrepository/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
long_description=_long_description,
3636
long_description_content_type="text/markdown",
3737
classifiers=[
38-
"Development Status :: 4 - Beta",
38+
"Development Status :: 7 - Inactive",
3939
"Intended Audience :: Developers",
4040
"Topic :: Software Development :: Libraries :: Python Modules",
4141
"License :: OSI Approved :: MIT License",

0 commit comments

Comments
 (0)