Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock down deps and add readmes to package metadata #234

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 49 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![](https://img.shields.io/badge/license-EPL--2.0-blue) [![Latest Release](https://img.shields.io/github/v/release/zowe/zowe-client-python-sdk)](https://github.com/zowe/zowe-client-python-sdk/releases/latest) [![Documentation Status](https://readthedocs.org/projects/zowe-client-python-sdk/badge/?version=latest)](https://zowe-client-python-sdk.readthedocs.io/en/latest/index.html)

The Zowe Client Python SDK, is a set of Python packages designed to allow programmatic
The Zowe Client Python SDK, is a set of Python packages designed to allow programmatic
interactions with z/OS REST API interfaces with minimal effort.

Python developers can leverage the Zowe SDK in order to create powerful scripts/applications
Expand All @@ -18,11 +18,10 @@ When installing the Zowe Client Python SDK, you have two options:
- Install a single sub-package

The choice depends on your intentions. If you choose to install all Zowe SDK packages,
this means that you will install everything under the `zowe` namespace in PyPi.
this means that you will install everything under the `zowe` namespace in PyPi.

Alternatively, you can choose to install only a single subpackage for a smaller installation.


To install all Zowe SDK packages using pip:

```
Expand All @@ -36,24 +35,33 @@ pip install zowe.<subpackage>_for_zowe_sdk
```

For more information on the available sub-packages click [HERE](https://zowe-client-python-sdk.readthedocs.io/en/latest/packages/packages.html)
<!--

<!--
**Note**: If you want to stay on the bleeding edge, install the Zowe SDK from the `main` branch with the following command:
```
pip install zowe@git+https://github.com/zowe/zowe-client-python-sdk@main#subdirectory=src
```
```
-->

## Requirements

The Zowe core package has dependencies on the below packages:
The Zowe core package has dependencies on the packages listed below:

```
requests>=2.22
keyring
commentjson
deepmerge
jsonschema
pyyaml
requests>=2.22
urllib3
```

It also has an optional dependency on the Zowe Secrets SDK for storing client secrets which can be installed with the `secrets` extra:

```
pip install zowe.core-for-zowe-sdk[secrets]
```

### Developer setup

**Prerequisite:** The minimum supported Python version is 3.7.
Expand All @@ -71,7 +79,7 @@ cd zowe-client-python-sdk/
git checkout main
```

We recommend that developers make a virtual environment to install all required dependencies.
We recommend that developers make a virtual environment to install all required dependencies.

Create a virtual environment in the root of the repository folder using the `venv` module.
The command below assumes that `python` is a version of Python3:
Expand Down Expand Up @@ -106,11 +114,9 @@ deactivate

## Quickstart


After you install the package in your project, import the class for the required sub-package (i.e `Console` class for z/OS Console commands).
After you install the package in your project, import the class for the required sub-package (i.e `Console` class for z/OS Console commands).
Create a dictionary to handle communication with the plug-in:


```python
from zowe.zos_console_for_zowe_sdk import Console
profile = {
Expand All @@ -135,60 +141,67 @@ Alternatively, you can use an existing Zowe CLI profile instead:

**Important**: If your z/OSMF profile uses a credentials manager, this approach may not work depending on your operating system. Support for loading secure profiles has only been tested on Windows and Ubuntu so far.


# Available options

Currently, the Zowe Python SDK supports the following interfaces:

* Console commands
* z/OSMF Information retrieval
* Submit job from a dataset
* Submit job from local file
* Submit job as plain text JCL
* Retrieve job status
* Retrieve job list from JES spool
* Start/End TSO address space
* Ping TSO address space
* Issue TSO command

**Important**: Notice that the below examples assume that you have already created
- Console commands
- z/OSMF Information retrieval
- Submit job from a dataset
- Submit job from local file
- Submit job as plain text JCL
- Retrieve job status
- Retrieve job list from JES spool
- Start/End TSO address space
- Ping TSO address space
- Issue TSO command

**Important**: Notice that the below examples assume that you have already created
an object for the sub-package of your preference just like in the quickstart example.

## Console

Usage of the console api:

```python
result = my_console.issue_command("<command>")
```

The result will be a JSON object containing the result from the console command.

## Job

To retrieve the status of a job on JES

```python
result = my_jobs.get_job_status("<jobname>", "<jobid>")
```

To retrieve list of jobs in JES spool

```python
result = my_jobs.list_jobs(owner="<user>", prefix="<job-prefix>")
```

Additional parameters available are:

* max_jobs
* user_correlator
- max_jobs
- user_correlator

To submit a job from a dataset:

```python
result = my_jobs.submit_from_mainframe("<dataset-name>")
```

To submit a job from a local file:

```python
result = my_jobs.submit_from_local_file("<file-path>")
```

To submit from plain text:

```python
jcl = '''
//IEFBR14Q JOB (AUTOMATION),CLASS=A,MSGCLASS=0,
Expand All @@ -203,6 +216,7 @@ result = my_jobs.submit_from_plaintext(jcl)
## TSO

Starting a TSO address space

```python

session_parameters = {
Expand All @@ -217,27 +231,32 @@ session_parameters = {

session_key = my_tso.start_tso_session(**session_parameters)
```

If you don't provide any session parameter ZoweSDK will attempt to start a session with default parameters.

To end a TSO address space

```python
my_tso.end_tso_session("<session-key>")
```

In order to issue a TSO command

```python
tso_output = my_tso.issue_command("<tso-command>")
```

## z/OSMF

Usage of the z/OSMF api

```python
result = my_zosmf.get_info()
```
The result will be a JSON object containing z/OSMF information

The result will be a JSON object containing z/OSMF information

# Acknowledgments

* Make sure to check out the [Zowe project](https://github.com/zowe)!
* For further information on z/OSMF REST API, click [HERE](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_RESTServices.htm)
- Make sure to check out the [Zowe project](https://github.com/zowe)!
- For further information on z/OSMF REST API, click [HERE](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_RESTServices.htm)
14 changes: 8 additions & 6 deletions src/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
name="zowe_core_for_zowe_sdk",
version=__version__,
description="Zowe Python SDK - Core package",
long_description=open("README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand All @@ -20,12 +22,12 @@
"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)",
],
install_requires=[
"commentjson",
"deepmerge",
"jsonschema",
"pyyaml",
"requests",
"urllib3",
"commentjson~=0.9.0",
"deepmerge~=1.1.0",
"jsonschema~=4.17.3",
"pyyaml~=6.0.1",
"requests~=2.31.0",
"urllib3~=1.26.18",
],
extras_require={
"secrets": [resolve_sdk_dep("secrets", "~=" + __version__)]
Expand Down
2 changes: 2 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def resolve_sdk_dep(sdk_name, version_spec):
name="zowe",
version=__version__,
description="Zowe Python SDK",
long_description=open("../README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions src/zos_console/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
name="zowe_zos_console_for_zowe_sdk",
version=__version__,
description="Zowe Python SDK - z/OS Console package",
long_description=open("README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions src/zos_files/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
name="zowe_zos_files_for_zowe_sdk",
version=__version__,
description="Zowe Python SDK - z/OS Files package",
long_description=open("README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions src/zos_jobs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
name="zowe_zos_jobs_for_zowe_sdk",
version=__version__,
description="Zowe Python SDK - z/OS Jobs package",
long_description=open("README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions src/zos_tso/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
name="zowe_zos_tso_for_zowe_sdk",
version=__version__,
description="Zowe Python SDK - z/OS TSO package",
long_description=open("README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions src/zosmf/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
name="zowe_zosmf_for_zowe_sdk",
version=__version__,
description="Zowe Python SDK - z/OSMF package",
long_description=open("README.md", 'r').read(),
long_description_content_type="text/markdown",
url="https://github.com/zowe/zowe-client-python-sdk",
author="Guilherme Cartier",
author_email="[email protected]",
Expand Down