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

chore(deps): bump trestle version to major version 3 #44

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 10 additions & 10 deletions .github/workflows/python-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
path: ~/Library/Caches/pip
# - os: windows-latest
# path: ~\AppData\Local\pip\Cache
python-version: [3.8, 3.9]
python-version: [3.9, 3.11]
steps:
- name: Don't mess with line endings
run: |
Expand All @@ -44,35 +44,35 @@ jobs:
run: |
make develop
- name: Setup pre-commit
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
run: |
make pre-commit
- name: Install dependencies
run: |
make install
- name: Run md document formatting (mdformat)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
run: |
make mdformat
- name: Run code formatting (yapf)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
run: |
make code-format
- name: Run code linting (flake8)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
run: |
make code-lint
- name: Run code typing check (mypy)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
continue-on-error: true
run: |
make code-typing
- name: Pytest Fast
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
run: |
make test
- name: Pytest Cov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }}
run: |
make test-cov

Expand All @@ -86,10 +86,10 @@ jobs:
submodules: true
fetch-depth: 0
token: ${{ secrets.ADMIN_PAT }}
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install build tools
run: |
make develop
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
path: ~/Library/Caches/pip
# - os: windows-latest
# path: ~\AppData\Local\pip\Cache
python-version: [3.8, 3.9]
python-version: [3.9, 3.11]
steps:
- name: Don't mess with line endings
run: |
Expand All @@ -124,16 +124,16 @@ jobs:
run: |
make develop
- name: Pytest Fast
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') }}
run: |
make test
- name: Pytest Cov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }}
run: |
make test-cov

- name: Upload artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }}
uses: actions/upload-artifact@v2
with:
name: coverage
Expand All @@ -156,7 +156,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- uses: actions/cache@v2
with:
path: ~/.cache/pip
Expand All @@ -180,7 +180,7 @@ jobs:
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.tests=tests/
-Dsonar.sources=trestle_fedramp/
-Dsonar.python.version=3.8
-Dsonar.python.version=3.9
-Dsonar.projectKey=compliance-trestle-fedramp
-Dsonar.organization=compliance-trestle
- name: SonarQube Quality Gate check
Expand Down
7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ classifiers =
Operating System :: POSIX
Operating System :: Microsoft
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
long_description_content_type = text/markdown
long_description = file: README.md
python_require= '>=3.8'
python_require= '>=3.9'
[options]
packages = find:
include_package_data = True

install_requires =
compliance-trestle>=2.5.1
compliance-trestle>=3.3.0
saxonche>=12.4.1.0

[options.packages.find]
Expand Down
16 changes: 6 additions & 10 deletions trestle_fedramp/core/fedramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
import pathlib
import sys
import tempfile

from pkg_resources import resource_filename
from importlib.resources import files

from saxonche import (PySaxonApiError, PySaxonProcessor, PyXslt30Processor)

Expand All @@ -37,21 +36,18 @@ class FedrampValidator:

def __init__(self):
"""Intialize FedRAMP validator."""
self.baselines_path = pathlib.Path(resource_filename('trestle_fedramp.resources',
const.FEDRAM_BASELINE)).resolve()
self.baselines_path = files('trestle_fedramp.resources').joinpath(const.FEDRAM_BASELINE)

if not self.baselines_path.exists():
raise TrestleError(f'Fedramp baseline directory {self.baselines_path} does not exist')

self.registry_path = pathlib.Path(resource_filename('trestle_fedramp.resources',
const.FEDRAMP_REGISTRY)).resolve()
self.registry_path = files('trestle_fedramp.resources').joinpath(const.FEDRAMP_REGISTRY)
if not self.registry_path.exists():
raise TrestleError(f'Fedramp registry directory {self.registry_path} does not exist')

self.ssp_xsl_path = pathlib.Path(resource_filename('trestle_fedramp.resources',
const.FEDRAMP_SSP_XSL)).resolve()
self.ssp_xsl_path = files('trestle_fedramp.resources').joinpath(const.FEDRAMP_SSP_XSL)

self.svrl_xsl_path = pathlib.Path(resource_filename('trestle_fedramp.resources',
const.FEDRAM__SVRL_XSL)).resolve()
self.svrl_xsl_path = files('trestle_fedramp.resources').joinpath(const.FEDRAM__SVRL_XSL)

logger.debug(f'Baselines dir: {self.baselines_path}')
logger.debug(f'Registry dir: {self.registry_path}')
Expand Down
8 changes: 2 additions & 6 deletions trestle_fedramp/core/format_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

import base64
import logging
import pathlib
import sys

from pkg_resources import resource_filename
from importlib.resources import files

from saxonche import PySaxonProcessor

Expand All @@ -36,9 +34,7 @@ class JsonXmlConverter:

def __init__(self):
"""Initialize JSON to XML converter."""
self.ssp_j_x_xsl_path = pathlib.Path(
resource_filename('trestle_fedramp.resources', const.NIST_SSP_JSON_XML_XSL)
).resolve()
self.ssp_j_x_xsl_path = files('trestle_fedramp.resources').joinpath(const.NIST_SSP_JSON_XML_XSL)
logger.info(f'SSP converter from JSON to XML: {self.ssp_j_x_xsl_path}')

self.initial_template = const.NIST_INITIAL_TEMPLATE
Expand Down
Loading