From 7f023125529cd33f866a787f0b88ed7b76be265b Mon Sep 17 00:00:00 2001 From: PascalEgn Date: Tue, 17 Sep 2024 13:15:14 +0200 Subject: [PATCH 1/2] yaml: update load functions --- jsonschema2rst/parser.py | 2 +- jsonschema2rst/tree_node.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonschema2rst/parser.py b/jsonschema2rst/parser.py index e930988..3aa13fe 100644 --- a/jsonschema2rst/parser.py +++ b/jsonschema2rst/parser.py @@ -70,7 +70,7 @@ def schema2rst(schema_file, excluded_key): change_extension(schema_file.name, JSON_EXTENSION))) rst = RST_DIRECTIVES - TreeNode.dict2tree(yaml.load(schema_file), tree, excluded_key) + TreeNode.dict2tree(yaml.full_load(schema_file), tree, excluded_key) rst += _traverse_bfs(tree, _node2rst) return rst diff --git a/jsonschema2rst/tree_node.py b/jsonschema2rst/tree_node.py index 6e33a62..c0ff6fc 100644 --- a/jsonschema2rst/tree_node.py +++ b/jsonschema2rst/tree_node.py @@ -356,7 +356,7 @@ def improve_parent(obj, node): temp.write(response.read()) with open(filename) as temp: - schema = yaml.load(temp) + schema = yaml.full_load(temp) tree = TreeNode("Test_Hep_Schema") TreeNode.dict2tree(schema, tree) print(tree) From 90f2ba8ebfd6376236f4a776a6045bb31e17c567 Mon Sep 17 00:00:00 2001 From: PascalEgn Date: Tue, 17 Sep 2024 13:57:44 +0200 Subject: [PATCH 2/2] gh-actions: refactor --- .../install-python-dependencies/action.yml | 15 ----- .github/workflows/build-and-release.yml | 56 +++++-------------- setup.py | 2 +- 3 files changed, 16 insertions(+), 57 deletions(-) delete mode 100644 .github/actions/install-python-dependencies/action.yml diff --git a/.github/actions/install-python-dependencies/action.yml b/.github/actions/install-python-dependencies/action.yml deleted file mode 100644 index 4b1de9b..0000000 --- a/.github/actions/install-python-dependencies/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Install python dependencies -description: Setup python packages and requirements - -runs: - using: composite - steps: - - name: Setup python additional packages - shell: bash - run: | - python -m pip install --upgrade pip - pip install setuptools wheel py coveralls - - - name: Install requirements - shell: bash - run: pip install -e .[tests] \ No newline at end of file diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 8cf53a6..3f3a293 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -8,10 +8,14 @@ on: jobs: Test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: - python-version: [2.7, 3.6] + include: + - python: python3 + pip: pip3 + - python: python2 + pip: pip steps: - name: Checkout @@ -19,43 +23,20 @@ jobs: with: fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Cache Python - uses: actions/cache@v2.1.3 - id: cache - with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ github.sha }} - - name: Install python dependencies - uses: ./.github/actions/install-python-dependencies + run: | + ${{ matrix.pip }} install --user --upgrade pip + ${{ matrix.pip }} --no-cache-dir install --user setuptools wheel py coveralls + ${{ matrix.pip }} --no-cache-dir install --user -e .[tests] - name: Show python dependencies - run: pip freeze + run: | + ${{ matrix.python }} --version + ${{ matrix.pip }} freeze - name: Run tests uses: ./.github/actions/run-tests - - name: Coveralls - uses: AndreMiras/coveralls-python-action@v20201129 - with: - parallel: true - github-token: ${{ secrets.github_token }} - flag-name: run-${{ matrix.test_number }} - - Coveralls: - needs: Test - runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: AndreMiras/coveralls-python-action@v20201129 - with: - github-token: ${{ secrets.github_token }} - parallel-finished: true Release: if: ${{ github.event_name == 'push' }} @@ -67,17 +48,10 @@ jobs: with: fetch-depth: 0 - - name: Set up Python 2.7 + - name: Set up Python 3.x uses: actions/setup-python@v2 with: - python-version: 2.7 - - - name: Cache Python Dependencies - uses: actions/cache@v2.1.3 - id: cache - with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-pip-2.7-${{ github.sha }} + python-version: 3.x - name: Install python dependencies uses: ./.github/actions/install-python-dependencies diff --git a/setup.py b/setup.py index e51fc95..31fe632 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ ] install_requires = [ - 'pyyaml', + 'pyyaml>=6.0,<7.0', 'autosemver==0.5.5', 'isort<5.0.0', 'six',