Skip to content

Commit 198d16d

Browse files
authored
Merge pull request #51 from crest42/bump_cryptography
* Bump dependencies (notably cryptography>=39.0.1 and flask>=2.2.0) * Deprecate Python 3.7 due to EOL soon and bump trx version to 1.6.1 * Drop support for Python 2 and remove dependency on 'six' This commit removes all code and dependencies related to Python 2, including the 'six' library. This will allow us to focus on using modern Python features and libraries, and streamline our codebase. Any future contributions should be made with Python >=3.8 in mind. * Update GitHub action to test Python 3.8 - 3.10 only This commit updates the GitHub action to test our codebase only with Python versions 3.8, 3.9, and 3.10. * Make github action run on master merges with action pull_request_target --------- Co-authored-by: Robin Lösch <[email protected]>
2 parents 534a2cb + 0f6715b commit 198d16d

8 files changed

+29
-30
lines changed

.github/workflows/pythonx-boot-check.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: 'Runs with Python3.6 - Python3.10'
22

3-
on: [ push ]
3+
on:
4+
pull_request_target:
5+
branches:
6+
- 'master'
47

58
jobs:
69
boots:
710
runs-on: ubuntu-latest
811
strategy:
912
matrix:
10-
python-version: [ '3.6.x', '3.7.x', '3.8.x', '3.9.x', '3.10.x' ]
13+
python-version: [ '3.8.x', '3.9.x', '3.10.x' ]
1114

1215
steps:
1316
- uses: actions/checkout@v2

.github/workflows/pythonx-pytest.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: 'PyTest with Python3.6 - Python3.10'
22

3-
on: [ push ]
3+
on:
4+
pull_request_target:
5+
branches:
6+
- 'master'
47

58
jobs:
69
pytest:
710
runs-on: ubuntu-latest
811
strategy:
912
matrix:
10-
python-version: [ '3.6.x', '3.7.x', '3.8.x', '3.9.x', '3.10.x' ]
13+
python-version: [ '3.8.x', '3.9.x', '3.10.x' ]
1114

1215
steps:
1316
- uses: actions/checkout@v2

.github/workflows/sonatype-jack.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: 'Sonatype Jake'
22

3-
on: [ push ]
3+
on:
4+
pull_request_target:
5+
branches:
6+
- 'master'
47

58
jobs:
69
security:
710
runs-on: ubuntu-latest
811
strategy:
912
matrix:
10-
python-version: [ '3.6.x', '3.10.x' ]
13+
python-version: [ '3.8.x', '3.9.x', '3.10.x' ]
1114

1215
steps:
1316
- uses: actions/checkout@v2
@@ -19,9 +22,6 @@ jobs:
1922

2023
- name: Run jake from Sonatype
2124
run: |
22-
# needed for Python3.6
23-
export PYTHONIOENCODING=utf-8
24-
2525
python -m pip install --upgrade pip
2626
pip3 install -r requirements.txt
2727
pip3 freeze > frozen.requirements.txt

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Maltego TRX Python Library
22

3-
[![Runs with Python3.6 - Python3.10](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-boot-check.yaml/badge.svg)](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-boot-check.yaml)
4-
[![PyTest with Python3.6 - Python3.10](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-pytest.yaml/badge.svg)](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-pytest.yaml)
3+
[![Runs with Python3.8 - Python3.10](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-boot-check.yaml/badge.svg)](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-boot-check.yaml)
4+
[![PyTest with Python3.8 - Python3.10](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-pytest.yaml/badge.svg)](https://github.com/paterva/maltego-trx/actions/workflows/pythonx-pytest.yaml)
55
[![Sonatype Jake](https://github.com/paterva/maltego-trx/actions/workflows/sonatype-jack.yml/badge.svg)](https://github.com/paterva/maltego-trx/actions/workflows/sonatype-jack.yml)
66

77
## Release Notes
88

9+
__1.6.1__: Update cryptography and Flask dependency and deprecate Python 3.7
10+
911
__1.6.0__: Automatically generate am `.mtz` for your local transforms
1012

1113
__1.5.2__: Add logging output for invalid / missing params in xml serialization
@@ -22,7 +24,7 @@ __1.4.2__: Fixed python3.6 incompatibility
2224

2325
## Getting Started
2426

25-
_Note: Support for Python 2 has been officially discontinued as of July 2021. Please use Python 3.6 or higher to use
27+
_Note: Support for Python 2 has been officially discontinued as of July 2021. Please use Python 3.8 or higher to use
2628
up-to-date versions of Maltego TRX._
2729

2830
To install the trx library run the following command:

maltego_trx/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "1.6.0"
1+
VERSION = "1.6.1"

maltego_trx/utils.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from xml.etree import ElementTree
88
from xml.etree.ElementTree import Element
99

10-
from six import text_type, binary_type
11-
1210
logger = logging.getLogger("maltego-trx")
1311

1412

@@ -39,12 +37,12 @@ def make_printable(val):
3937

4038

4139
def force_encoding(val, encoding):
42-
if type(val) == text_type:
40+
if isinstance(val, str):
4341
return val.encode(encoding, 'replace').decode(encoding, 'replace')
44-
elif type(val) == binary_type:
42+
elif isinstance(val, bytes):
4543
return val.decode(encoding, 'replace')
4644
else:
47-
return text_type(val).encode(encoding, 'replace').decode(encoding, 'replace')
45+
return str(val).encode(encoding, 'replace').decode(encoding, 'replace')
4846

4947

5048
def remove_invalid_xml_chars(val):

requirements.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
flask>=1
2-
six>=1
3-
cryptography==3.3.2 # pinned for now as newer versions require setuptools_rust
4-
dataclasses==0.8; python_version < "3.7"
1+
flask>=2.2.3
2+
cryptography==39.0.1

setup.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
setup(
88
name='maltego-trx',
9+
python_requires='>=3.8.0',
910
version=VERSION,
1011
description='Python library used to develop Maltego transforms',
1112
long_description=long_description,
@@ -15,15 +16,9 @@
1516
author_email='[email protected]',
1617
license='MIT',
1718
install_requires=[
18-
'flask>=1',
19-
'six>=1',
20-
'cryptography==3.3.2' # pinned for now as newer versions require setuptools_rust
19+
'flask>=2.2.0',
20+
'cryptography>=39.0.1'
2121
],
22-
extras_require={
23-
':python_version == "3.6"': [
24-
'dataclasses',
25-
],
26-
},
2722
packages=[
2823
'maltego_trx',
2924
'maltego_trx/template_dir',

0 commit comments

Comments
 (0)