diff --git a/.gitattributes b/.gitattributes index e0473a36..df34f3da 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ * text git-encoding=utf-8 zos-working-tree-encoding=iso8859-1 working-tree-encoding=utf-8 eol=lf *.png binary +README.md git-encoding=utf-8 zos-working-tree-encoding=utf-8 working-tree-encoding=utf-8 eol=lf diff --git a/.github/workflows/.github-actions.yml b/.github/workflows/coverage.yml similarity index 66% rename from .github/workflows/.github-actions.yml rename to .github/workflows/coverage.yml index bb2e2be2..c57f74cb 100644 --- a/.github/workflows/.github-actions.yml +++ b/.github/workflows/coverage.yml @@ -1,11 +1,11 @@ -name: pyRACF Linting & Unit Test +name: coverage on: [push, pull_request] jobs: build: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -14,16 +14,12 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install Poetry - run: curl -sSL https://install.python-poetry.org | python3 - + run: pipx install poetry - name: Show Poetry Environment Info run: poetry env info - name: Install Development Dependencies run: poetry install --no-root - - name: Flake8 - run: poetry run flake8 . - - name: Pylint - run: poetry run pylint --recursive=y . - - name: Unit Test + - name: unittest run: poetry run coverage run tests/test_runner.py - - name: Code Coverage + - name: coverage run: poetry run coverage report -m diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 00000000..3152298e --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,23 @@ +name: flake8 +on: [push, pull_request] +jobs: + build: + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set Up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + run: pipx install poetry + - name: Show Poetry Environment Info + run: poetry env info + - name: Install Development Dependencies + run: poetry install --no-root + - name: flake8 + run: poetry run flake8 . diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 00000000..53cd4ce8 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: pylint +on: [push, pull_request] +jobs: + build: + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set Up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + run: pipx install poetry + - name: Show Poetry Environment Info + run: poetry env info + - name: Install Development Dependencies + run: poetry install --no-root + - name: pylint + run: poetry run pylint --recursive=y . diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 00000000..959e9b98 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,23 @@ +name: unittest +on: [push, pull_request] +jobs: + build: + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set Up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + run: pipx install poetry + - name: Show Poetry Environment Info + run: poetry env info + - name: Install Development Dependencies + run: poetry install --no-root + - name: unittest + run: poetry run coverage run tests/test_runner.py diff --git a/README.md b/README.md index dbfce06b..b29a70d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ -![pyRACF Logo](logo.png) +![pyRACF Logo](https://raw.githubusercontent.com/ambitus/pyracf/refs/heads/main/logo.png) -![GitHub Actions Build Status](https://github.com/ambitus/pyracf/actions/workflows/.github-actions.yml/badge.svg?branch=dev) +[![tests](https://github.com/ambitus/pyracf/actions/workflows/unittest.yml/badge.svg)](https://github.com/ambitus/pyracf/actions/workflows/unittest.yml) +[![coverage](https://github.com/ambitus/pyracf/actions/workflows/coverage.yml/badge.svg)](https://github.com/ambitus/pyracf/actions/workflows/coverage.yml) +[![pylint](https://github.com/ambitus/pyracf/actions/workflows/pylint.yml/badge.svg)](https://github.com/ambitus/pyracf/actions/workflows/pylint.yml) +[![flake8](https://github.com/ambitus/pyracf/actions/workflows/flake8.yml/badge.svg)](https://github.com/ambitus/pyracf/actions/workflows/flake8.yml) +[![Beta Version](https://img.shields.io/pypi/v/pyracf?label=beta)](https://pypi.org/project/pyracf/#history) +[![Python Versions](https://img.shields.io/pypi/pyversions/pyracf)](https://pypi.org/project/pyracf/) +[![Download Stats](https://img.shields.io/pypi/dm/pyracf)](https://pypistats.org/packages/pyracf) + +> ⚠️ _If this is not what you are looking for, it is likely because you are looking for a different package that used to be distributed under the `pyracf` name. You may instead be looking for the [`mfpandas`](https://pypi.org/project/mfpandas/) package, which was distributed under the `pyracf` name prior to October 2024._ Python interface into the RACF management application programming interface. @@ -32,9 +40,11 @@ As automation becomes more and more prevalent, the need to manage the security e ### Installation -:warning: _pyRACF will eventually be made available on [pypi.org](https://pypi.org/), but currently python wheel distributions for pyRACF are only available for manual download and installation via GitHub._ +```shell +pip install pyracf +``` -* [Download & Install From GitHub](https://github.com/ambitus/pyracf/releases) +> 💡 _You may also optionally [Download & Install pyRACF From GitHub](https://github.com/ambitus/pyracf/releases)._ ### Usage diff --git a/pyproject.toml b/pyproject.toml index 46884260..12bdbcac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [tool.poetry] name="pyracf" - version="1.0b5" + version="1.0b6" description="Python interface to RACF using IRRSMO00 RACF Callable Service." license = "Apache-2.0" authors = [ @@ -28,6 +28,7 @@ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Security", diff --git a/pyracf/common/security_admin.py b/pyracf/common/security_admin.py index d916b1fe..d31c1a0e 100644 --- a/pyracf/common/security_admin.py +++ b/pyracf/common/security_admin.py @@ -336,7 +336,7 @@ def _to_steps(self, results: Union[List[dict], dict, bytes]) -> Union[dict, byte pre_processed_results.append(result) steps_dictionary = {} for step, result_dictionary in enumerate(pre_processed_results): - steps_dictionary[f"step{step+1}"] = result_dictionary + steps_dictionary[f"step{step + 1}"] = result_dictionary return steps_dictionary # ============================================================================ @@ -579,7 +579,7 @@ def __format_user_profile_data( ) i += 3 elif "=" not in messages[i] and messages[i].strip()[:3] != "NO-": - messages[i] = f"{messages[i]}={messages[i+1]}" + messages[i] = f"{messages[i]}={messages[i + 1]}" self.__add_key_value_pairs_to_segment( current_segment, profile[current_segment], messages[i] ) diff --git a/pyracf/common/utilities/logger.py b/pyracf/common/utilities/logger.py index abe85099..8d3d0e74 100644 --- a/pyracf/common/utilities/logger.py +++ b/pyracf/common/utilities/logger.py @@ -116,11 +116,11 @@ def log_debug(self, header_message: str, message: str) -> None: admin_class = "".join(class_tokens) function_called_by_user = f"{admin_class}.{user_call[1]}()" header = ( - f"{self.__purple_background(' '*79)}\n" + f"{self.__purple_background(' ' * 79)}\n" + f"{self.__purple_background('[pyRACF:Debug]'.center(79))}\n" + f"{self.__purple_background(header_message.center(79))}\n" + f"{self.__purple_background(function_called_by_user.center(79))}\n" - + f"{self.__purple_background(' '*79)}\n" + + f"{self.__purple_background(' ' * 79)}\n" ) print(f"{header}\n{message}")