Skip to content

Commit f17ed60

Browse files
Merge pull request #366 from Chaffelson/retirePy2Automation
Prepare v0.21.0 with py2 semi-retirement
2 parents 6a94c6b + f2ccf64 commit f17ed60

15 files changed

+106
-165
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,9 @@ fabric.properties
157157

158158
# Stupid OSX exclusions
159159
/.vscode
160+
161+
.DS_Store
162+
# Coverage reports
163+
coverage*
164+
.coverage
165+
htmlcov/

docs/devnotes.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ Instructions::
4848
I recommend you install PyEnv to manage Python versions `sudo curl https://pyenv.run | bash`
4949
Follow the instructions to set up your .bashrc
5050
To build various versions of Python for testing you may also need `sudo dnf install bzip2-devel openssl-devel libffi-devel zlib-devel readline-devel sqlite-devel -y`
51-
Install the latest supported version of Python for your main dev environment `pyenv install 3.9 2.7`
52-
Set these versions as global in pyenv so tox can see them. Use the actual versions with the command `pyenv global 3.9.16 2.7.62`
51+
Install the latest supported version of Python for your main dev environment `pyenv install 3.9 2.7 3.12`
52+
Set these versions as global in pyenv so tox can see them. Use the actual versions with the command `pyenv global 3.9.16 2.7.18 3.12.2`
5353
You'll want to stand up the two sets of NiFi containers for testing. resources/docker/tox-full for default and regression tests, and resources/docker/secure for tests under auth.
5454
You can switch between the tests by changing flags in tests/conftest.py around line 17.
55+
Python3 can be tested automatically using Tox.
56+
Python2 can be tested using the following steps within a Python2 virtualenv:
57+
1. Install requirements: pip install -r requirements.txt
58+
2. Install dev requirements: `pip install -r requirements_dev.txt`
59+
3. Install package in editable mode with test support: `pip install -e .[test]`
60+
4. Run tests: `pytest -v -s tests --tb=long -W ignore::urllib3.exceptions.InsecureRequestWarning`
5561

5662
Setup Code Signing
5763
------------------
@@ -194,7 +200,6 @@ This assumes you have virtualenvwrapper, git, and appropriate python versions in
194200
# Run appropriate tests, such as usage tests etc.
195201
deactivate
196202
Push changes to Github
197-
Check build on TravisCI
198203
Check dockerhub automated build
199204
# You may have to reactivate your original virtualenv
200205
twine upload dist/*

docs/history.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22
History
33
=======
44

5+
0.21.0 (2024-07-14)
6+
-------------------
7+
8+
| Updated client for NiFi & Registry 1.27.0 release
9+
10+
* Fix API model generator by @michaelarnauts in https://github.com/Chaffelson/nipyapi/pull/356
11+
* issue-360: handle -9 error messages better by @ottobackwards in https://github.com/Chaffelson/nipyapi/pull/361
12+
* Handle plain text response types so json values are correctly returned by @michaelarnauts in https://github.com/Chaffelson/nipyapi/pull/358
13+
* update clients to 1.27.0 by @Chaffelson in https://github.com/Chaffelson/nipyapi/pull/365
14+
* Simplified the use of setattr in recurse_flow, flatten, and list_all_by_kind methods in nipyapi/canvas.py.
15+
* Added support for key_password in the Configuration class and its usage in nipyapi/nifi/rest.py and nipyapi/registry/rest.py.
16+
* Fixed the method to retrieve HTTP headers in nipyapi/nifi/rest.py and nipyapi/registry/rest.py.
17+
* Fixed issue #326 where the latest flow version was not being deployed by default
18+
* Updated pylintrc to match more modern python standards
19+
* Fixes nipyapi.nifi.ProcessGroupsApi.upload_process_group_with_http_info() incomplete #310
20+
* VersionedReportingTask added with appropriate functions
21+
* Move docker requirement to extras to avoid dependency install during standard usage
22+
* Set latest python3 version to 3.12
23+
* Deprecate usage of py.test in favour of newer pytest.
24+
* Update readme
25+
526
0.20.0 (2024-04-14)
627
-------------------
728

docs/nipyapi-docs/nipyapi.nifi.models.rst

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -188,38 +188,6 @@ nipyapi.nifi.models.batch\_size module
188188
:undoc-members:
189189
:show-inheritance:
190190

191-
nipyapi.nifi.models.bucket module
192-
---------------------------------
193-
194-
.. automodule:: nipyapi.nifi.models.bucket
195-
:members:
196-
:undoc-members:
197-
:show-inheritance:
198-
199-
nipyapi.nifi.models.bucket\_dto module
200-
--------------------------------------
201-
202-
.. automodule:: nipyapi.nifi.models.bucket_dto
203-
:members:
204-
:undoc-members:
205-
:show-inheritance:
206-
207-
nipyapi.nifi.models.bucket\_entity module
208-
-----------------------------------------
209-
210-
.. automodule:: nipyapi.nifi.models.bucket_entity
211-
:members:
212-
:undoc-members:
213-
:show-inheritance:
214-
215-
nipyapi.nifi.models.buckets\_entity module
216-
------------------------------------------
217-
218-
.. automodule:: nipyapi.nifi.models.buckets_entity
219-
:members:
220-
:undoc-members:
221-
:show-inheritance:
222-
223191
nipyapi.nifi.models.bulletin\_board\_dto module
224192
-----------------------------------------------
225193

@@ -1036,14 +1004,6 @@ nipyapi.nifi.models.peers\_entity module
10361004
:undoc-members:
10371005
:show-inheritance:
10381006

1039-
nipyapi.nifi.models.permissions module
1040-
--------------------------------------
1041-
1042-
.. automodule:: nipyapi.nifi.models.permissions
1043-
:members:
1044-
:undoc-members:
1045-
:show-inheritance:
1046-
10471007
nipyapi.nifi.models.permissions\_dto module
10481008
-------------------------------------------
10491009

@@ -1388,30 +1348,6 @@ nipyapi.nifi.models.queue\_size\_dto module
13881348
:undoc-members:
13891349
:show-inheritance:
13901350

1391-
nipyapi.nifi.models.registry\_client\_entity module
1392-
---------------------------------------------------
1393-
1394-
.. automodule:: nipyapi.nifi.models.registry_client_entity
1395-
:members:
1396-
:undoc-members:
1397-
:show-inheritance:
1398-
1399-
nipyapi.nifi.models.registry\_clients\_entity module
1400-
----------------------------------------------------
1401-
1402-
.. automodule:: nipyapi.nifi.models.registry_clients_entity
1403-
:members:
1404-
:undoc-members:
1405-
:show-inheritance:
1406-
1407-
nipyapi.nifi.models.registry\_dto module
1408-
----------------------------------------
1409-
1410-
.. automodule:: nipyapi.nifi.models.registry_dto
1411-
:members:
1412-
:undoc-members:
1413-
:show-inheritance:
1414-
14151351
nipyapi.nifi.models.relationship\_dto module
14161352
--------------------------------------------
14171353

@@ -1916,14 +1852,6 @@ nipyapi.nifi.models.versioned\_controller\_service module
19161852
:undoc-members:
19171853
:show-inheritance:
19181854

1919-
nipyapi.nifi.models.versioned\_flow module
1920-
------------------------------------------
1921-
1922-
.. automodule:: nipyapi.nifi.models.versioned_flow
1923-
:members:
1924-
:undoc-members:
1925-
:show-inheritance:
1926-
19271855
nipyapi.nifi.models.versioned\_flow\_coordinates module
19281856
-------------------------------------------------------
19291857

@@ -1948,13 +1876,6 @@ nipyapi.nifi.models.versioned\_flow\_entity module
19481876
:undoc-members:
19491877
:show-inheritance:
19501878

1951-
nipyapi.nifi.models.versioned\_flow\_snapshot module
1952-
----------------------------------------------------
1953-
1954-
.. automodule:: nipyapi.nifi.models.versioned_flow_snapshot
1955-
:members:
1956-
:undoc-members:
1957-
:show-inheritance:
19581879

19591880
nipyapi.nifi.models.versioned\_flow\_snapshot\_entity module
19601881
------------------------------------------------------------

nipyapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
__author__ = """Daniel Chaffelson"""
1111
__email__ = '[email protected]'
12-
__version__ = '0.19.1'
12+
__version__ = '0.21.0'
1313
__all__ = ['canvas', 'system', 'templates', 'config', 'nifi', 'registry',
1414
'versioning', 'demo', 'utils', 'security', 'parameters']
1515

nipyapi/canvas.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ def flatten(parent_pg):
179179
Generator for all ProcessGroupEntities, eventually
180180
"""
181181
for child_pg in parent_pg.process_group_flow.flow.process_groups:
182-
yield from flatten(child_pg.nipyapi_extended)
182+
for item in flatten(child_pg.nipyapi_extended):
183+
yield item
183184
yield child_pg
184185

185186
# Recurse children

nipyapi/security.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ def create_access_policy(resource, action, r_id=None, service="nifi"):
721721
)
722722

723723

724-
# pylint: disable=R0913,R0917
724+
# pylint: disable=R0913
725725
def set_service_ssl_context(
726726
service="nifi",
727727
ca_file=None,

nipyapi/utils.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from packaging import version
1919
import six
2020
from ruamel.yaml import YAML
21+
from ruamel.yaml.compat import StringIO
2122
import requests
2223
from requests.models import Response
2324
from future.utils import raise_from as _raise
@@ -57,23 +58,22 @@ def dump(obj, mode='json'):
5758
assert mode in ['json', 'yaml']
5859
api_client = nipyapi.nifi.ApiClient()
5960
prepared_obj = api_client.sanitize_for_serialization(obj)
60-
try:
61-
out = json.dumps(
62-
obj=prepared_obj,
63-
sort_keys=True,
64-
indent=4
65-
)
66-
except TypeError as e:
67-
raise e
6861
if mode == 'json':
69-
return out
62+
try:
63+
return json.dumps(
64+
obj=prepared_obj,
65+
sort_keys=True,
66+
indent=4
67+
)
68+
except TypeError as e:
69+
raise e
7070
if mode == 'yaml':
7171
# Use 'safe' loading to prevent arbitrary code execution
7272
yaml = YAML(typ='safe', pure=True)
7373
# Create a StringIO object to act as the stream
74-
stream = io.StringIO()
74+
stream = StringIO()
7575
# Dump to the StringIO stream
76-
yaml.dump(json.loads(out), stream)
76+
yaml.dump(prepared_obj, stream)
7777
# Return the contents of the stream as a string
7878
return stream.getvalue()
7979
raise ValueError("Invalid dump Mode specified {0}".format(mode))
@@ -350,7 +350,7 @@ def set_endpoint(endpoint_url, ssl=False, login=False,
350350
return True
351351

352352

353-
# pylint: disable=R0913,R0902,R0917
353+
# pylint: disable=R0913,R0902
354354
class DockerContainer():
355355
"""
356356
Helper class for Docker container automation without using Ansible

nipyapi/versioning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def get_flow_in_bucket(bucket_id, identifier, identifier_type='name',
217217
obj, identifier, identifier_type, greedy=greedy)
218218

219219

220-
# pylint: disable=R0913,R0917
220+
# pylint: disable=R0913
221221
def save_flow_ver(process_group, registry_client, bucket, flow_name=None,
222222
flow_id=None, comment='', desc='', refresh=True,
223223
force=False):
@@ -696,7 +696,7 @@ def import_flow_version(bucket_id, encoded_flow=None, file_path=None,
696696
)
697697

698698

699-
# pylint: disable=R0913,R0917
699+
# pylint: disable=R0913
700700
def deploy_flow_version(parent_id, location, bucket_id, flow_id, reg_client_id,
701701
version=None):
702702
"""

pylintrc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,6 @@ disable=raw-checker-failed,
429429
useless-suppression,
430430
deprecated-pragma,
431431
use-symbolic-message-instead,
432-
use-implicit-booleaness-not-comparison-to-string,
433-
use-implicit-booleaness-not-comparison-to-zero,
434432
bare-except,
435433
invalid-name,
436434
C0103, E1101, R1710, E0401, C0209
@@ -471,11 +469,6 @@ max-nested-blocks=5
471469
# printed.
472470
never-returning-functions=sys.exit,argparse.parse_error
473471

474-
# Let 'consider-using-join' be raised when the separator to join on would be
475-
# non-empty (resulting in expected fixes of the type: ``"- " + " -
476-
# ".join(items)``)
477-
suggest-join-with-non-empty-separator=yes
478-
479472

480473
[REPORTS]
481474

0 commit comments

Comments
 (0)