ajs/wrr/sn 2026-07-29 / branch: sn_refactor_custom_excel - Refactored CustomExcel column-mapping config to fetch live from the portal
(GenericQcConfig search) instead of GitHub, with local JSON fallback.
- Fixed [0]-style string values being incorrectly converted into arrays in structured_data.py.
- Added test/test_custom_excel.py (previously untested module) and expanded test_structured_data.py coverage.
- Pinned setuptools<82 to keep pkg_resources-dependent imports (pyramid) working; added a regression test.
- Bumped boto3/botocore to ^1.43.58, tightened Python requirement to >=3.10,<3.13, and updated Poetry to 1.8.5.
- Updated GitHub Actions OIDC credentials in the main workflow.
willronchetti / 2026-07-10 / branch: fm/dcic-pubci-9m - Added an automatic tag-and-publish-to-PyPI publish job to .github/workflows/main.yml,
gated on a successful build and a push to master. Determines the version from poetry version -s, independently checks for an existing git tag and an existing PyPI release (via the PyPI JSON API), tags only if the tag is missing, and publishes only if the version is not yet on PyPI - so the job self-heals if tagging succeeds but a later step fails. main-publish.yml's tag-triggered workflow remains for manual/ workflow_dispatch publishing only, since GitHub Actions does not start a new workflow run from a tag pushed with the default GITHUB_TOKEN.
- wrr / 2026-07-01 / branch: fm/sec-fix-util1 / PR-332 - Fixed Zip Slip/Tar Slip path traversal in zip_utils.py archive extraction. - Redacted credentials from AuthenticationError exception messages in ff_utils.py. - Expanded credential-redaction regex in obfuscation_utils.py to cover token/api_key/authorization/bearer/jwt/private_key.
willronchetti / 2026-07-06 / branch: fm/dcic-pypi-fix-6v - Removed the obsolete/unused verify_not_already_published_obsolete_no_longer_works_20250110
function from scripts/publish_to_pypi.py; the current verify_not_already_published already uses the PyPi JSON API (https://pypi.org/pypi/{package}/json) instead of the old https://pypi.org/project/{package}/{version}/ page check, which was prone to false positives since PyPi returns HTTP 200 for that URL even when the version does not exist.
- Added unit test coverage (test/test_publish_to_pypi.py) for verify_not_already_published: version already published, version not yet published, package with no PyPi presence at all, and PyPi request failure.
willronchetti / 2026-07-08 / branch: fm/dcic-oidc-9x - Migrated GitHub Actions AWS authentication for CI tests from long-lived access key secrets
to OIDC via aws-actions/configure-aws-credentials and AWS_OIDC_ROLE_ARN.
- ajs / 2025-09-30 / branch: ajs_upd_es_metadata_fxns_250925 / PR-330 - Updated ff_utils.get_es_metadata and ff_utils.expand_es_metadata to work locally through aws-proxy.
- dmichaels / 2025-03-05 / branch: dmichaels-20250305-add-portal-get-schema-super-types / PR-328 - Added method portal_utils.get_schema_super_type_names (for use by smaht-submitr).
dmichaels / 2025-02-28 / branch: dmichaels-20250228-correct-submitr-config-path / PR-327 - Corrected branch to smaht-submitr config dcicutils/submitr/custom_excel.py to master branch; i.e.:
dmichaels / 2025-02-11 / branch: dmichaels-20250211-submitr-custom-excel / PR-326 - Support for qc_values pseudo-columns in smaht-submitr (and multiple sheet with same type).
This is encapsulated in custom_excel.py, here because it is needed not only within smaht-submitr but also within smaht-portal (ingestion_processor.py).
- dmichaels / 2025-01-14 / branch: dmichaels-structured-data-row-mapper-hook-20250114 / PR-324
- Added hook to structured_data.StructuredDataSet to allow a custom Excel class to be use, so a custom column mapping can be provided; this was initially to support special/more-intuitive columns for QC values in the submission spreadsheet for smaht-submitr.
- Added hook to structured_data.StructuredDataSet to allow multiple sheets associated with the same type (via a new data_readers.Excel.effective_sheet_name function).
- dmichaels / 2025-01-10
- Fix to dcicutils/scripts/publish_to_pypy.py script. They (pypi) changed their API so this returns HTTP 200 even if the package version does NOT exist: https://pypi.org/project/{package_name}/{package_version} So without this fix this script thinks the version to publish already exists even when it does not. Changed to use this instead: https://pypi.org/pypi/{package_name}/json which returns JSON for ALL versions.
- dmichaels / 2024-11-17
- Very minor fix in datetime_utils.parse_datetime_string.
- dmichaels / 2024-11-08
- Minor updates to portal_utils for internal command-line utility development.
- dmichaels / 2024-10-30
- Added license exception for autocommand: GNU Lesser General Public License v3 (LGPLv3); see license_policies/"c4-python-infrastructure.jsonc. Ran into this with latest building of submitr.
- dmichaels / 2024-10-11
- Updated (added) version (43.0.1) for cryptography library for vulnerabilities (CVE-2023-50782, CVE-2024-0727, et.al.). Updated pyopenssl version (24.2.1) related to above.
- Minor changes to view_portal_object utility script.
- Minor changes to validators hooks in structured_data.
- Added portal_utils.Portal.get_version method.
- Minor fix in misc_utils.format_duration.
- 2024-10-04 (dmichaels)
- Added optional bucket argument to s3_utils.s3Utils.read_s3 (initially for Andy).
- 2024-08-22 (dmichaels)
- Modified structured_data property hook for "finish" attribute/callable.
- Added sheet hook to structured_data.
- Added portal_utils.Portal.head method.
- Corrected requests version (to ^2.27.0 from 2.31.0) on pyproject.toml to not be pinned; but doing so (which resolves to 2.32.3) results in this error on test/test_ecr_utils.py::test_ecr_utils_workflow: docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker But upgrading the docker package (from ^4.4.4) version to ^7.1.0 fixes that.
- Minor changes to utility/troubleshooting/convenience scripts view-portal-object and update-portal-object.
- Minor updates to the view-portal-object dev/troubleshooting utility script.
- Changed from typing_extensions import Literal to import from typing; odd Python 3.12 issue but only in GitHub Actions (observed for submitr).
- Added tomli dependency in pyproject.toml (came up in submitr GA for Pyhthon 3.12).
- Change to structured_data.py to NOT silently convert a string representing a floating point number to an integer.
- Changes in structured_data.py for validator hook.
- Added to_number function to misc_utils.
- Added run_concurrently function to misc_utils.
- Changed misc_utils.to_enum to default to non-fuzzy (prefix) match, for structured_data, i.e for smaht-submitr to match on (case-insensitive) full enum namess.
- Changed dcicutils.structured_data.Schema._map_function_date/time to report malformed dates, e.g. "6/29/2024" rather than "2024-06-29".
N.B. Accidentially tagged/pushed 8.13.1 -> PLEASE IGNORE VERSION: 8.13.1 (subsequently yanked). And then to correct (while no permission to delete above) pushed unofficial 8.13.2.
Fallout from Python 3.12 support. - Though dcicutils is not dependent on numpy, elasticsearch tries to import it,
and if it is installed and if it is a version greater than 1.x, we get this error: AttributeError: np.float_ was removed in the NumPy 2.0 release. Use np.float64 instead. So added a hack in hack_for_elasticsearch_numpy_usage.py for this specific case; to be imported before we import elasticsearch modules.
Added/updated scripts from submitr: view_portal_object.py and update_portal_object.py for dev/troubleshooting purposes.
- Updates related to Python 3.12. - Had to update flake8 (from 5.0.4) to 7.1.0. - Had to update lower bound of Python version (from 3.8.0) to 3.8.1. - Had to update pyramid (from 1.10.4) to 2.0.2 (imp import not found). - Had to update elasticsearch (from 7.13.4) to 7.17.9 (for snovault).
- Changes related to pyinstaller experimentation for smaht-submitr. Mostly changing calls to exit to sys.exit; and related license_utils change.
- Added hook to structured_data (row_reader_hook) for integration testing purposes.
- Add more schema parsing functions to schema_utils, including for new properties for generating submission templates
- Added merge capabilities to structured_data.
- Added Question class to command_utils (factored out of smaht-submitr).
- Refactored out some identifying property related code from portal_object_utils to portal_utils.
- Internalized lookup_strategy related code to structured_data/portal_object_utils/portal_utils.
- Add more schema parsing functions to schema_utils.
Added check for ES_HOST_LOCAL environment variable in ff_utils.get_es_metadata; for running Foursight checks locally (with local ssh tunnel to ES proxy); came up in foursight/checks/audit_checks (2024-04-23).
Allow Python 3.12 (pyproject.toml).
Added remove_empty_objects_from_lists options to structured_data.StructuredDataSet, defaulting to True, which deletes empty objects from lists; however, only from the end of a list; if this flag is True and there are non-empty objects following empty objects then we flag an error.
Few general things initially related to and factored out of rclone support in smaht-submitr: - Added extract_file_from_zip to zip_utils. - Added http_utils with download function. - Added get_app_specific_directory, get_os_name, get_cpu_architecture_name, short_uuid to misc_utils. - Added are_files_equal, create_random_file to file_utils, compute_file_md5, compute_file_etag,
normalize_path, get_file_size, get_file_modified_datetime to file_utils.
- Minor extra sanity check to search_for_file in file_utils.
- Added deterministic ordering to paths returned by search_for_file in file_utils.
- Added create_temporary_file_name and remove_temporary_file tmpfile_utils.
- Minor fix to misc_utils.create_dict (do not create property only if its value is None).
- Minor updates to utility dcicutils.scripts.view_portal_object.
- Fix bug in creds_utils to register portal key managers instead of parent class
- Minor fix in structured_data to not try to resolve empty refs in norefs mode; and added StructuredDataSet.unchecked_refs; not functionally substantive as used (only) with smaht-submitr/submit-metadata-bundle --info --refs.
- Added nrows and nsheets to data_reader; convenience for smaht-submitr/submit-metadata-bundle --info.
- Added test_progress_bar module for progress_bar testing; would like to add more tests.
- Fixed up captured_output module to handle UTF-8 encoding to help unit testing progress_bar.
- Added hooks to progress_bar to help unit testing.
- Added a find_nth_from_end and set_nth to misc_utils to help progress_bar unit testing.
- Added format_size and format_duration misc_utils; refactor from smaht-submitr.
- Added format_datetime, parse_datetime to datetime_utils; refactor from smaht-submitr; and some tests.
- Added check_only flag to portal_utils.Portal.{post,patch}_metadata (came up in ad hoc troubleshooting).
- Minor fix in structured_data related to smaht-submitr progress monitoring.
- Added progress_bar module (orginally lived in smaht-submitr).
- Added Portal.is_schema_type_file to portal_utils.
- Updated deployment_utils.py with support for GOOGLE_API_KEY in smaht-portal; this is to get the version of the latest smaht-submitr metadata template; and also similarly for SUBMITR_METADATA_TEMPLATE_SHEET_ID.
- Support for ExtraFiles pseudo-type, to handle extra_files in smaht-submitr..
- Minor structured_data fix related to counting unresolved references; not functionally consequential; only incorrect user feedback in smaht-submitr.
- Support in structured_data for norefs (completely ignore references).
- Minor fix in portal_object_utils.PortalObject._compare for lists.
- Minor structured_data changes for smaht-submitr validation/submission progress tracking.
- Minor structured_data code cleanup.
- Added submitr.progress_constants for sharing between smaht-submitr, snovault, smaht-portal; not ideal living here but driving us nuts maintaining in separate locations; and since we have this submitr sub-directory now, unified the common ref_lookup_strategy function from smaht-submitr and smaht-portal.
- Changes to troubleshooting utility script view-portal-object.
- Some reworking of ref lookup in structured_data.
- Support ref caching in structured_data.
- Added hook to turn off ref lookup by subtypes in case we need this later.
- Added hook do ref lookup at root path first; set to true by smaht-portal for accession IDs.
- Moved/adapted test_structured_data.py from smaht-portal to here.
- Changes to structured_data support date/time types.
- Changes to structured_data support internal references in any order.
- New datetime_utils module and tests; first created for date/time support in structured_data.
- Added view-portal-object script for general troubleshooting.
- Change to data_reader to ignore sheet names enclosed in parenthesis.
- Changes to itemize SMaHT submission ingestion create/update/diff situation (portal_object_utils).
- Changes to structured_data to handle property deletes (portal_object_utils).
- Changed scripts/publish_to_pypi.py to allow gitinfo.json to have unstaged changes; this is so we can optionally have repos write relevant git (repo, branch, commit) info to this file (via GitHub Actions) and make it accessible to the package for inspection.
- Added is_schema_type and is_specified_schema to portal_utils.Portal.
- Refactoring in portal_utils; added portal_object_utils; added file_utils.py.
- Add new schema_utils module for schema parsing
- Minor fix to misc_utils.to_integer to handle float strings.
- Minor fix to structured_data to accumulate unique resolved_refs across schemas.
- Added ability to autoadd properties structured_data.StructuredDataSet; to automatically pass in submission_centers on submission, and not require that the user explicitly set this in the spreadsheet.
- Changes to structured_data to respect uniqueItems for arrays.
- Handle no schemas better in structured_data.
- Added portal_utils.Portal.ping().
- Minor fix in portal_utils.Portal._uri().
- Moved structured_data.py from smaht-portal to here; new portal_utils and data_readers modules.
- Strip sheet name in data_readers.Excel; respecte (ignore) hidden sheets.
- More work related to SMaHT ingestion (bundle/sheet_utils, data_readers, etc).
- Updates for RAS to Redis API
- 2023-11-02
- Added
SchemaManager.get_identifying_propertiesinbundle_utilswhich implicitly addsidentifiertoidentifyingProperties. - Added support for
portal_vappto to ff_utils.get_metadata`.
New module
bundle_utils.pythat is intended for schema-respecting worksheets ("metadata bundle"). There are various modular bits of functionality here, but the main entry point here is:load_itemsto load data from a given table set, doing certain notational canonicalizations, and checking that things are in the appropriate format.
In
common.py, new hint types:CsvReaderJsonSchemaRegexp
In
lang_utils.py:- New arguments
just_are=tothere_areget verb conjugation without the details. - Add "while" to "which" and "that" as clause handlers in the string pluralizer (e.g., so that "error while parsing x" pluralizes as "errors while parsing x")
conjoin_listanddisjoin_listnow callstron their sequence elements so that things likeconjoined_list([2, 3, 4])are possible.
- New arguments
In
misc_utils.py, miscellaneous new functionality:- New class
AbstractVirtualAppthat is either an actual VirtualApp or can be used to make mocks if the thing being called expects anAbstractVirtualAppinstead of aVirtualApp. - New function
to_snake_casethat assumes its argument is either a CamelCase string or snake_case string and returns the snake_case form. - New function
is_uuid(migrated from Fourfront) - New function
pad_to - New class
JsonLinesReader
- New class
In
qa_checkers.py:- Change the
VERSION_IS_BETA_PATTERNto recognize alpha or beta patterns. Probably a rename would be better, but also incompatible. As far as I know, this is used only to not fuss if you haven't made a changelog entry for a beta (or now also alpha).
- Change the
New module
sheet_utils.pyfor loading workbooks in a variety of formats, but without schema interpretation.A lot of this is implementation classes for each of the kinds of files, but the main entry point is intended to be
load_table_setif you are not working with schemas. For schema-related support, seebundle_utils.py.New module
validation_utils.pywith these facilities:- New class
SchemaManagerfor managing a set of schemas so that programs asking for a schema by name only download one time and then use a cache. There are also facilities here for populating a dictionary with all schemas in a table set (the kind of thing returned byload_table_setinsheet_utils.py) in order to pre-process it as a metadata bundle for checking purposes. - New functions:
validate_data_against_schemasto validate that table sets (workbooks, or the equivalent) have rows in each tab conforming to the schema for that tab.summary_of_data_validation_errorsto summarize the errors obtained fromvalidate_data_against_schemas.
- New class
- Update Python to 3.11; and nixed Python 3.7.
- Updated boto3/botocore versions.
- Updatad pyyaml version to ^6.0.1; Mac M1 has issues building 5.4.1 (though 5.3.1 works). See PyYAML 6.0 change log here: https://github.com/yaml/pyyaml/blob/master/CHANGES The only incompatible change seems to be that yaml.load now requires a Loader argument; and searching our GitHub organizations (4dn-dcic, dbmi-bgm, smaht-dac) the only ones which might be affected are cwltools and parliament2, neither of which are dependent on dcicutils in any way.
In
license_utils:Add an
RLanguageFramework.Add various additional checker classes, and a registry to catalog them. Refactor so that pre-existing classes better share information in an inherited way.
Class
Checker Name
Status
ParkLabCommonLicenseCheckerpark-lab-commonNew
ParkLabGplPipelineLicenseCheckerpark-lab-gpl-pipelineNew
ParkLabCommonServerLicenseCheckerpark-lab-common-serverNew
C4InfrastructureLicenseCheckerc4-infastructureRefactored
C4PythonInfrastructureLicenseCheckerc4-python-infrastructureRefactored
Scan2PipelineLicenseCheckerscan2-pipelineNew
In
misc_utils:- New function
json_file_contents
- New function
In
scripts:- Add a
run-license-checkerscript, implemented byrun_license_checker.py, that runs the license checker whose "checker name" is given as an argument.
- Add a
- In
glacier_utils:- Add functionality for KMS key encrypted accounts
- In
ff_utils:- Fix in
get_schemaandget_schemasfor theportal_vappcase needing a leading slash on the URL. - Fix in
get_schemaandget_schemasfor theportal_vappreturning webtest.response.TestResponse which has ajsonobject property rather than a function.
- Fix in
- In
ff_utils:- New arguments
portal_env=andportal_vapptoget_schemafor functionget_schemaandget_schemas.
- New arguments
- In
s3_utils:- Fix a failing test (caused by an environmental change, no functional change).
- In
license_utils:- Allow C4 infrastructure to use the
chardetlibrary.
- Allow C4 infrastructure to use the
- In
misc_utils:- New function
to_camelcasethat can take either snake_case or CamelCase input.
- New function
- In
qa_utils:- New function
is_subdictfor asymmetric testing of dictionary equivalence.
- New function
- In
ff_utils:- New function
get_schemathat will pull down an individual schema definition. - New function
get_schemasthat will pull down all schema definitions. - New argument
allow_abstracttoget_schema_namesfor conceptual compatibility withget_schemas. - Minor tweaks to
dump_results_to_jsonfor style reasons, and repairs to its overly complex and error-prone unit test.
- New function
- Add
variant_utilswith tools to filter through CGAP data.
- In
license_utils:- In
license_utils.C4InfrastructureLicenseChecker, allow exceptions for librariesdnslib,dnspython,node-forgeandudn-browser.
- In
- Fix tests are failing on utils master branch (C4-1081), a problem with the
project_utilstest namedtest_project_registry_make_project_autoload.
Add
license_utilswith tools to check license utilities.Note
Using these utilities requires you to have a dev dependency on
pip-licenses. If it's not there, you'll get an error telling you this fact.Effectively, though, we're exporting a required dev dependency, since we did not want to make this a runtime dependency.
(You can also attend to this dependency by arranging to
pip install pip-licensesbefore running tests.)Add
contribution_utilswith tools to track repository contributions.
- In
creds_utils:- Support for
SMaHTKeyManager
- Support for
- EnvUtils updates to accommodate
smaht-portal
- Add deployer class for
smaht-portal
- In
scripts/publish_to_pypidefault to not allowing publish using (non-API-token) username, and fixed package name to come from pyproject.toml rather than git repo name (used only for display purposes and checking if version already pushed).
- In
lang_utils:- Teach
EnglishUtils.string_pluralizeabout words ending in-sesbecausecgap-portalneeds this.
- Teach
- New module
project_utilswith support for Project mechanism.- New decorators
ProjectRegistryandC4ProjectRegistry - New class
ProjectandC4Project
- New decorators
- In
qa_utils:- In class
MockFileSystem:- New method
abspath - New method
chdir - New method
expanduser - New method
getcwd - New method
mock_exists_open_remove_abspath_getcwd_chdir(context manager)
- New method
- In class
Fixed the publish-to-pypi script to ignore the .gitignore file when looking for untracked files.
Removed scripts from packages directory list in pyproject.toml; not necessary.
- Rewrite test
test_get_response_jsonas a unit test to get around its flakiness.
The glacier2 branch did not bump the version. It continues to call itself version 7.4.1 even though the v7.4.1 does not contain its functionality, so the point of change is retroactiely tagged v7.4.1.1.
- In
common.py- Add constant
ENCODED_LIFECYCLE_TAG_KEY
- Add constant
- In
glacier_utils.py:- Accept support for url-encoded tags for GlacierUtils multipart uploads.
- Add support for removing lifecycle tag when copying object.
- In
glacier_utils.py:- Fix calls to
self.copy_object_back_to_original_locationinrestore_glacier_phase_two_copy.
- Fix calls to
- In
qa_utils.py:- Make
boto3.client('s3').put_objecthandle either a string or bytes object correctly.
- Make
- Actively mark tests that are already marked with
pytest.mark.beanstalk_failureto also usepytest.mark.skipso they don't run and confuse things even when markers are not in play. - Update some live ecosystem expectations to match present real world state.
- Separate tests of live ecosystem so that the parts that are supposed to pass reliably are in a separate function from the parts that are thought to be in legit transition.
- Misc changes to satisfy various syntax checkers.
- One stray call to print changed to PRINT.
- Various grammar errors fixed in comment strings because PyCharm now whines about that, and the suggestions seemed reasonable.
- In
dcicutils.env_utilsadded functionget_portal_urlwhich is the same asget_env_real_urlbut does not access the URL (via the health page); first usage of which was in foursight-core. 2023-04-16. - Added
dcicutils.ssl_certificate_utils; first usage of which was in foursight-core. 2023-04-16. - Added
dcicutils.scripts.publish_to_pypi; 2023-04-24. - Added
dcicutils.function_cache_decorator; 2023-04-24; future help in simplifying some caching in foursight-core APIs. - Updated
test/test_task_utils.py(test_pmap_parallelism): to increasemargin_of_errorto 1.1333.
Add LICENSE.txt (MIT Licenses). The pyproject.toml already declared that lic
ense, so no real change. Just pro forma.
In
dcicutils.command_utils:- New decorator
require_confirmation
- New decorator
In
dcicutils.common:- New variable
ALL_S3_STORAGE_CLASSES - New variable
AVAILABLE_S3_STORAGE_CLASSES - New variable
S3_GLACIER_CLASSES - New type hint
S3GlacierClass - New type hint
S3StorageClass
- New variable
New module
dcicutils.glacier_utils:- Class for interacting with/restoring files from Glacier
In
dcicutils.misc_utils:- New function
INPUT - New function
future_datetime - New decorator
managed_property - New function
map_chunked - New function
format_in_radix - New function
parse_in_radix
- New function
In
dcicutils.qa_checkers:- Fix bug in
printstatement recognizer
- Fix bug in
In
dcicutils.qa_utils:- Support for Glacier-related operations in
MockBotoS3Client:- Method
copy_object - Method
delete_object - Method
list_object_versions - Method
restore_object
- Method
- Support for Glacier-related operations in
Load
coverallsdependency only dynamically in GA workflow, not in poetry, because it implicatesdocoptlibrary, which needs2to3, and would fail.
- In
exceptions:- New class
MultiError
- New class
- In
qa_utils:- New class
Timer
- New class
- In
misc_utils:- New generator function
chunked
- New generator function
- New module
task_utils:- New class
Task - New class
TaskManager - New function
pmap - New function
pmap_list - New function
pmap_chunked
- New class
- Adjust expectations for environment
hotseatin live ecosystem integration testing bytests/test_s3_utils.py
- New
trace_utilsmodule- New decorator
@Trace - New function
make_trace_decoratorto make similar ones.
- New decorator
- Fix to
obfuscation_utilsrelating to dicts containing lists. - In
dcicutils.misc_utils:- New function
deduplicate_list
- New function
- In
dcicutils.qa_utils:- Fixes to the
printed_outputcontext manager relating to multi-linePRINTstatements.
- Fixes to the
- New files:
dcicutils.redis_utilsanddcicutils.redis_toolsplus associated test files - In
dcicutils.redis_utils:- Implement the
RedisBaseobject, which takes the output ofcreate_redis_clientand returns an object that implements some base APIs for interacting with Redis.
- Implement the
- In
dcicutils.redis_tools:- Implement the
RedisSessionTokenobject, which creates higher level APIs for creating session tokens that are backed by Redis. This object operates on theRedisBaseclass. - Session tokens are 32 bytes and expire automatically after 3 hours by default, but can be tuned otherwise.
- Implement the
- In
dcicutils.command_utils:- Make
script_catch_errorscontext manager return afailfunction that can be called to bypass the warning that an error needs to be reported.
- Make
- In
dcicutils.common:- Add a number of type hints.
- In
dcicutils.ff_utils:- Refactor
unified_authenticationto be object-oriented. - Add some type hinting.
- Refactor
- In
dcicutisl.env_baseanddcicutils.s3_utils:- Add some error checks if stored s3 credentials are not in the right form. (BREAKING CHANGE) This is not expected to break anything, but users should be on the lookout for problems.
- Add a new argument (
require_key=, defaultTrue) tos3Utils.get_access_keys()so that checking of the key name can be relaxed if onlysecretandserverare needed, as might happen for Jupyterhub creds. This is a possible way of addressing unexpected problems that could come up due to added error checks. - Add some type hinting.
- Add comments about other possible future error checking.
- In
dcicutils.misc_utils:- New function
utc_now_str
- New function
- Misc PEP8
- Various test adjustments to accommodate health page changes related to C4-853.
- Move
mocked_s3utils_with_ssefromtest_ff_utils.pytoff_mocks.py.
- In
dcicutils.misc_utils:- Add method
is_c4_arnto check if given ARN looks like CGAP or Fourfront entity.
- Add method
- In
dcicutils.deployment_utils:- Add support for
Auth0DomainandAuth0AllowedConnections
- Add support for
- In
dcicutils.qa_utils:- For method
Eventually_call_assertion:- Make the
error_message=argument actually work. - The
threshold_seconds=argument is now deprecated. Please prefertries=and/orwait_seconds=. - Fix a bug where it didn't wait between iterations.
- Make the
- Add a method
consistentthat is a class method / decorator (namedEventually.consistent). - Add testing, particularly of the timing.
- For method
- In
dcicutils.cloudformation_utils:- When searching for checkrunners, be more forgiving about abbreviations for development (dev) and production (prd, prod).
- In
dcicutils.misc_utils:- Add
keys_and_values_to_dictfunction (and associated unit test).
- Add
- In
dcicutils.qa_utils:- Add
Eventually.call_assertion.
- Add
- Minor fix to
obfuscate_dictinobfuscation_utilsto respect passedobfuscatedargument recursively.
- In
misc_utils:- New class
TopologicalSorterfor topological sorting of graphs
- New class
- New function
env_equalsinenv_utilsmodule.
- Add
opensearch_utils, a forward-compatible OpenSearch client we should migrate to over time - In
codebuild_utils:- New method
run_project_build_with_overridesto allow running builds changing the build branch and environment variables
- New method
- In
lang_utils:- New method EnglishUtils.parse_relative_time_string
- In
misc_utils:- New function
str_to_bool
- New function
- In
misc_utils:- New decorator
@classproperty - New decorator
@classproperty_cached - New decorator
@classproperty_cached_each_subclass - New class
Singleton. Users ofSingletonManagermight prefer this, but we'll continue to support both. (No deprecation for now.) - In function
is_valid_absolute_uri, better handling of argument type errors. - For
CachedField:- Added a handler for
__str__that returns useful information, which can also be used for__repr__. - Fixed handler for
__repr__to return a properly executable expression (shared with__str__).
- Added a handler for
- Improved test coverage by adding tests for some parts of the code that were not previously tested.
- New decorator
- In
qa_utils:- New class
MockIdfor mocking theidfunction in a predictable way. - Adjust
MOCK_QUEUE_URL_PREFIXto use a mocked URL that looks more like modern AWS url, wherequeue.amazonaws.comhas been replaced bysqs.us-east-1.amazonaws.com.
- New class
- Updates ElasticSearch to version 7.13.4, the highest version we can tolerate of this library. This utils version is a requirement for using ES7 or OpenSearch 1.3 in production.
PR 223: Refactored recording tech
Refactor
TestRecorderinto anAbstractTestRecorderwith two concrete classes,RequestsTestRecorderandAuthorizedRequestsTestRecorder. The new refactor means it'll be easier to write other subclasses.The new classes take their arguments slightly differently, but all test cases are updated, and this was previously broken in (so not used in) other repositories and it can't break anything elsewhere to change the conventions. We're treating this as a simple bug fix.
Deprecated unused class
MockBoto4DNLegacyElasticBeanstalkClient.
PR 222: Improved IntegratedFixture and static check cleanups
Show fewer uninteresting tracebacks on static test failures.
Small incompatible changes to recently released qa-related items:
- In
qa_checkers.confirm_no_uses, remove the newif_usedargument in favor of a simpler implementation. - Slightly rerefactored the class hierarchy so that
StaticCheckeris a smaller class that doesn't have quite as much functionality, andStaticSourcesCheckercorresponds to whatStaticCheckerpreviously did.
Since this is all testing-only, not something used in production, and since there are believed to not yet be uses outside the repo, we're treating this as a bug fix (patch version bump) not an incompatible change (which would entail a major version bump and a lot of fussing for nothing).
- In
Make class initialization of
IntegratedFixturehappen at instance-creation time. That simplifies the loading actions needed. Those can happen inconftest.pyrather than indcicutils.ff_mocks, which in turn should allowdcicutils.ff_mocksto be imported without error, fixing C4-932
Some functionality moved from
qa_utilstoqa_checkers. In each case, to be compatible, theqa_utilsmodule will continue to have the entity availble for import until the next major release.- Class
VersionChecker - Class
ChangeLogChecker - Function
confirm_no_uses - Function
find_uses - Variable
QA_EXCEPTION_PATTERN
As an official matter, use of these moved entities from by importing them from
dcicutils.qa_utilsis deprecated. Please update programs to import these fromdcicutils.qa_checkersinstead.- Class
New functionality in
qa_checkers:- New class
DocsChecker - New class
DebuggingArtifactChecker
- New class
In
misc_utils:- New function
lines_printed_to.
- New function
New
pytestmarkerstaticfor static tests.New
maketargettest-staticto run tests marked with@pytest.mark.static.New GithubActions (GA) workflow:
static_checks.yml
- In
qa_utils:- New class ChangeLogChecker, like VersionChecker, but it raises an error if there's a change log inconsistency.
- Drop support for Python 3.6 (BREAKING CHANGE)
New functionallity in
ecr_utils.ECRUtilsin support of planned changes to Foursight:- Add
ECRTagWatcherclass that can be used to watch for a new image with a given tag in an ECS repository.
- Add
New functionality in
qa_utilsto support a mock ECR client.Refactor parts of
ecr_utilsandecr_scriptsto move some general-purpose parts out ofecr_scripts(top-level variables and classECRCommandContext) and intoecr_utils(classECRUtils):Changes to arguments for
ECRUtilsconstructor:- Allow additional arguments needed for moved methods.
- Default more arguments so that only relevant ones need be passed.
Move some methods from
ECRCommandContexttoECRUtils:get_images_descriptions_apply_image_descriptions_limit
Certain variables at
ecr_scriptstop-level became class variables inecr_utils.ECRUtils(some with some renaming):ecr_scriptsecr_utils.ECRUtilsmodule variable
module variable status
class variable
class variable status
DEFAULT_ECS_REPOSITORY
deprecated
DEFAULT_IMAGE_REPOSITORY
new
IMAGE_COUNT_LIMIT
deprecated
IMAGE_LIST_DEFAULT_COUNT_LIMIT
new
IMAGE_LIST_CHUNK_SIZE
deprecated
IMAGE_LIST_CHUNK_SIZE
new
RELEASED_TAG
deprecated
IMAGE_RELEASED_TAG
new
Unit tests for new functionality, and backfilled unit tests for some parts of
ecr_utils.
- In
env_utils:- New function
foursight_env_name, an alias forlambda envname: infer_foursight_from_env(envname=envname)
- New function
- Add error checking for running tests that looks to see that we're in the right account before we move ahead only to find this out in a less intelligible way.
- In
env_utils:- Add
identity_namearguments to:apply_identityassumed_identity_ifassumed_identityget_identity_secrets
- Remove buggy defaulting of value for
get_identity_name. - Improve error messages in
get_identity_secrets.
- Add
- A few other changes to
lang_utils.string_pluralizeto give more refined control of punctuation and to allow phrases with "that is/was" or "which is/was" qualifiers.
- In
ff_utils;- add function
get_search_facet valuesto support count from facets from any search
- add function
- In
lang_utils:- Add
`"from"and"between"to the list of prepositions that the pluralizer understands.
- Add
- In
obfuscation_utils:- Add
is_obfuscatedto predicate whether something is in obfuscated form. Among other things, this enables better testing. - Add an
obfuscated=argument toobfuscateandobfuscate_dict, allowing the choice of what obfuscated value to use. The argument must be something for whichis_obfuscatedreturns True.
- Add
NOTE: Due to a versioning error in beta, there was no 4.3.0. The previous released version was 4.2.0.
- In
command_utils:- Add
script_catch_errorscontext manager, borrowed fromSubmitCGAP.
- Add
- In
ff_utils:- Add
is_bodylesspredicate on http methods (verbs) to say if they want a data arg.
- Add
- In
env_base:- Add
EnvBase.set_global_env_bucketto avoid settingos.environ['GLOBAL_ENV_BUCKET']directly.
- Add
- Add better
CHANGELOG.rstfor the changes that happened in 4.0.0. - Add unit testing for stray
print(...)orpdb.set_trace() - Support for
ENCODED_CREATE_MAPPING_SKIP,ENCODED_CREATE_MAPPING_WIPE_ES, andENCODED_CREATE_MAPPING_STRICTin GAC to allow$CREATE_MAPPING_SKIP,$CREATE_MAPPING_WIPE_ES, and$CREATE_MAPPING_STRICTin.inifiles. - Allow
get_foursight_bucketto infer a bucket prefix if one is not explicitly supplied. (The heuristic removes-envsfrom the global env bucket name and uses what remains.) - Fix test recording capability. Add (though unused) ability to record at
the abstraction level of
authorized_request. - Fix various tests that had grown stale due to data changes.
test_post_delete_purge_links_metadata(needed to be re-recorded)test_upsert_metadata(needed to be re-recorded)test_unified_authentication_prod_envs_integrated_only(simplified, removed bogus attempts at recording)test_faceted_search_exp_set(needed many different counts)test_some_decorated_methods_work(needed one different count)test_faceted_search_exp_set(newly recorded)test_faceted_search_users(newly recorded)
- Specify pytest options in pyproject.toml instead of a separate file.
- In
env_utils:- Added
EnvUtils.app_nameto get the orchestrated app name. - Added
EnvUtils.app_caseto conditionalize onif_cgap=andif_fourfront=.
- Added
- In
qa_utils:- Added an
input_mockedcontext manager. - Added
MockLogand alogged_messagescontext manager.
- Added an
- In
cloudformation_utils:- New function
find_lambda_function_namesinAbstractOrchestrationManagerwhich factors out the lookup part from thediscover_foursight_check_runner_namefunction.
- New function
- In
obfuscation_utils:- Changed
should_obfuscateto include "session" related keys.
- Changed
- In
qa_utils:- New class
MockBoto3Ec2geared toward security group rules related unit testing.
- New class
- New
obfuscation_utilsmodule.
The following change list is only interim. A followup change will revise this entry with better information covering what changed in 4.0, which is considerably more.
- Some new modules. The scripts modules came from other repositories, for centralization reasons. The other modules
are originally refactorings to make functionality more broadly available at various stages of bootstrapping
this library.
ecr_scriptshas support for command line scripts related to ECR repositories.env_basehas support for bits of environmental foothold needed beforeenv_utilsors3_utilsare ready.env_manageris a higher-level environmental abstraction built afterenv_utilsis available.env_scriptshas support for command line scripts related to configurable environments and the global env bucket.
- New
maketargets:make test-allruns all testsmake test-mostruns all unit and integration tests (markedunit,integrationorintegrationx), but not things likely to fail (markedbeanstalk failureordirect_es_query).make test-integrationsruns all integration tests (markedintegrationorintegrationx), but not things likely to fail (markedbeanstalk failureordirect_es_query).make test-direct-es-queryruns any test markeddirect_es_query`.test-units-with-coverageruns unit tests with thecoveragefeature.test-for-gais an indirect way to calltest-units-with-coverage, and will be what the GithubActions workflow calls.
- Configurable environmental support for orchestrated C4 applications (Fourfront and CGAP) in
env_utils(C4-689). - Extend that support to allow mirroring to be enabled (C4-734).
The net result is a configurable environment in which the env descriptor in the global env bucket can contain these new items:
| Key | Notes |
|---|---|
"dev_data_set_table" |
Dictionary mapping envnames to their preferred data set |
"dev_env_domain_suffix" |
e.g., .abc123def456ghi789.us-east-1.rds.amazonaws.com |
"foursight_bucket_table" |
A table mapping environments to another table mapping chalice stages to buckets |
"foursight_url_prefix" |
A prefix string for use by foursight. |
"full_env_prefix" |
A string like "cgap-" that precedes all env names |
"hotseat_envs" |
A list of environments that are for testing with hot data |
"indexer_env_name" |
The environment name used for indexing (being phased out) |
"is_legacy" |
Should be "true" if legacy effect is desired, otherwise omitted. |
"stage_mirroring_enabled" |
Should be "true" if mirroring is desired, otherwise omitted. |
"orchestrated_app" |
This allows us to tell 'cgap' from 'fourfront', in case there ever is one. |
"prd_env_name" |
The name of the prod env |
"public_url_table" |
Dictionary mapping envnames & pseudo_envnames to public urls |
"stg_env_name" |
The name of the stage env (or None) |
"test_envs" |
A list of environments that are for testing |
"webprod_pseudo_env" |
The pseudo-env that is a token name to use in place of the prd env for shared
stg/prd situations, replacing fourfront-webprod in the legacy system.
(In orchestrations, this should usually be the same as the prd_env_name.
It may or may not need to be different if we orchestrate the legacy system.) |
In
base:compute_prd_env_for_projectcompute_stg_env_for_projectget_env_info(replacesbeanstalk_utils.get_beanstalk_info)get_env_real_url(replacesbeanstalk_utils.get_beanstalk_real_url)
In
beanstalk_utils:Removed:
swap_cname
NOTE: This was never invoked by automatic programs, so we didn't do a deprecation stage.
Deprecated:
get_beanstalk_infois deprecated. Usebeanstalk_utils.get_env_info.get_beanstalk_real_urlis deprecated. Useenv_utils.get_env_real_url.
NOTE: These continue to work for now, but will be removed in the future. Please update code to use recommended replacement.
In
cloudformation_utils:- Added function``discover_foursight_check_runner_name``.
- Added function
tokenify. - Moved
DEFAULT_ECOSYSTEMtocloudformation_utils. Importing it from this library is now deprecated.
In
common:- New variables:
CHALICE_STAGE_DEVCHALICE_STAGE_PRODCHALICE_STAGESDEFAULT_ECOSYSTEM(moved fromcloudformation_utils)LEGACY_CGAP_GLOBAL_ENV_BUCKETLEGACY_GLOBAL_ENV_BUCKET
- New type hint (variable):
ChaliceStage
- New variables:
In
ecr_utils:- Removed
CGAP_ECR_LAYOUT. UseECRUtils.ECR_LAYOUTinstead. - Deprecated
CGAP_ECR_REGION. UseECRUtils.REGIONorcommon.REGIONinstead.
- Removed
In
ecs_utils:- Added
ECSUtils.REGION.
- Added
In
env_base:- Moved
EnvBaseto here froms3_utils. - Added
s3_utils.s3Base(factored out ofs3_utils.s3Utils)
- Moved
In
env_utils:Removed:
guess_mirror_envmake_env_name_cfn_compatible
NOTE: This was not believed to be used anywhere so is presumably no great hardship. (Kent also didn't like the naming, which used a confusing abbreviation.)
New functions:
blue_green_mirror_envcompute_prd_env_for_projectdata_set_for_envecr_repository_for_envfull_cgap_env_namefull_fourfront_env_nameget_env_from_contextget_env_real_url(replacesbeanstalk_utils.get_beanstalk_real_url)get_foursight_bucketget_foursight_bucket_prefixget_standard_mirror_envhas_declared_stg_envindexer_env_for_env(introduced _and_ deprecated during beta)infer_foursight_from_envinfer_foursight_url_from_envis_indexer_env(introduced _and_ deprecated during beta)is_orchestratedmaybe_get_declared_prd_env_namepermit_load_data
New classes:
ClassificationPartsEnvNamesEnvUtilsPublicUrlParts
Always erring:
indexer_env_for_envis_indexer_env
- NOTE: These functions unconditionally raise an error indicating that the functionality is no longer available.
Their callers must be rewritten, probably in a way that is not a simple substitution.
Removed all top-level variables from
env_utilsvariables, moving them toenv_utils_legacy. This includes but is not limited to variables with names starting withCGAP_,FF_orBEANSTALK_. These are deprecated and should not be used outside ofdcicutils. Withindcicutils, they may be used only for testing. Allenv_utilsfunctionality should be accessed through functions, not variables.
In
exceptions:BeanstalkOperationNotImplementedEnvUtilsLoadErrorIncompleteFoursightBucketTableLegacyDispatchDisabledMissingFoursightBucketTableNotUsingBeanstalksAnyMore
Added tech debt by disabling certain tests or marking them for later scrutiny.
Three new pytest markers were added in
pytest.ini:beanstalk_failure- An obsolete beanstalk-related test that needs fixingdirect_es_query- A test of direct ES _search that is disabled for now and needs to move inside the firewallstg_or_prd_testing_needs_repair- Some or all of a test that was failing on stg/prd has been temporarily disabledrecordabledeclares a test to use "recorded" technology so that ifRECORDING_ENABLED=TRUE, a new test recording is made
- In
qa_utils:- Extend the mocking so that output to files by
PRINTcan be tested bywith printed_output as printedusingprinted.file_last[fp]andprinted.file_lines[fp].
- Extend the mocking so that output to files by
- In
ecs_utils: * Adds theservice_has_active_deploymentmethod.
- In
qa_utils: * Minor updates related PEP8.
- In
qa_utils:- New class
MockBotoS3Iam. - New class
MockBotoS3Kms. - New class
MockBotoS3OpenSearch. - New class
MockBotoS3Sts. - New method
MockBotoS3Session.get_credentials. - New method
MockBotoS3Session.put_credentials_for_testing. - New property
MockBotoS3Session.region_name. - New method
MockBotoS3Session.unset_environ_credentials_for_testing.
- New class
- In
misc_utils:- New function
key_value_dict. - New function
merge_key_value_dict_lists.
- New function
- In
qa_utils:- Add
MockBotoS3Client.get_object_tagging. - Add
MockBotoS3Client.put_object_tagging.
- Add
- In
s3_utils:- Add
s3Utils.get_object_tags - Add
s3Utils.set_object_tags - Add
s3Utils.set_object_tag
- Add
- Fix a bug in
diff_utils.
In
deployment_utils:In
CreateMappingOnDeployManager:Add
get_deploy_configwith slightly different arguments thanget_deployment_config, so CGAP and FF can be more easily compared.Change
--strictand--skipto not take an argument on the command line, and to default to False.NOTE: After some discussion, this was decided to be treated as a bug fix, not as an incompatible change, so the semantic version will not require a major version bump.
When testing, test with switch arguments, too.
In
env_utils:- Add
FF_ENV_PRODUCTION_BLUE_NEW(value'fourfront-production-blue') andFF_ENV_PRODUCTION_GREEN_NEW(value'fourfront-production-green') and teachis_stg_or_prd_envandget_standard_mirror_envabout them as alternative stg/prd hosts. - Add
is_beanstalk_envto detect traditional/legacy beanstalk names during transition.
- Add
In
qa_utils:- Add
MockedCommandArgs.
- Add
- In
diff_utils:- Add support for
.diffs(..., include_mappings=True) - Add support for
.diffs(..., normalizer=<fn>)where<fn>is a function of two keyword arguments,itemandlabelthat can rewrite a given expression to be compared into a canonical form (e.g., reducing a dictionary with auuidto just theuuid, which is what we added the functionality for).
- Add support for
- In
ff_utils:- In
get_metadata, strip leading slashes on ids in API functions.
- In
- Adds support for
creds_utils.- Class
KeyManager, with methods:KeyManager.get_keydict_for_env(self, env)KeyManager.get_keydict_for_server(self, server)KeyManager.get_keydicts(self)KeyManager.get_keypair_for_env(self, env)KeyManager.get_keypair_for_server(self, server)KeyManager.keydict_to_keypair(auth_dict)KeyManager.keypair_to_keydict(auth_tuple, *, server)
- Class
FourfrontKeyManager - Class
CGAPKeyManager
- Class
- In
docker_utils.py:- Add
docker_is_runningpredicate (used by the fix totest_ecr_utils_workflowto skip that test if docker is not running.
- Add
- In
test_ecr_utils.py:- Fix
test_ecr_utils_workflowto skip if docker is not enabled.
- Fix
- In
test_s3_utils.py:- Remove
test_s3utils_creation_cgap_ordinarybecause there are no more CGAP beanstalks. - Revise
test_regression_s3_utils_short_name_c4_706to usefourfront-mastertestrather than a CGAP env, since the CGAP beanstalk envs have gone away.
- Remove
- In
qa_utils.py:MockBoto3Session.MockBoto3SecretsManagerand support forMockBoto3to make it.
- In
secrets_utils.pyandtest_secrets_utils.py:- Add support for
SecretsTable. - Add unit tests for existing
secrets_utils.assume_identityand for newSecretsTablefunctionality.
- Add support for
- Small cosmetic adjustments to
Makefileto show a timestamp and info about current branch state whenmake teststarts and again when it ends. - A name containing an underscore will not be shortened by
short_env_namenor lengthened byfull_env_name(norfull_cgap_env_namenorfull_fourfront_env_name).
- Allow dcicutils to work in Python 3.9.
- Allow dcicutils to work in Python 3.8.
- In
ecs_utils:- No longer throw exception when listing services if <4 are returned
- In
s3_utils:- Add
HealthPageKey.PYTHON_VERSION
- Add
- In
ecs_utils:- Add
list_ecs_tasks - Add
run_ecs_task
- Add
- In
string_utils:- Add
string_list - Add
string_md5
- Add
- In
ff_utils:- Add
parse_s3_bucket_and_key_url.
- Add
- In
qa_utils:- In
MockBotoS3Client:- Fix
head_objectoperation to return theStorageClass(since the mock already allows you to declare it per-S3-client-class). - Add internal support to be expanded later for making individual S3 files have different storage classes from one another.
- Fix
- In
deployment_utils:- Default the value of
s3_encode_key_idto the empty string, notNone.
- Default the value of
- In
deployment_utils:- Add
create_file_from_template.
- Add
- In
qa_utils:- Fix an obscure bug in
os.removemocking byMockFileSystem.
- Fix an obscure bug in
- In
s3_utils:- Add
s3Utils.s3_encrypt_key_id. - Add
HealthPageKey.S3_ENCRYPT_KEY_ID.
- Add
- In
test/test_base.py:- Disable unit tests that are believed broken by WAF changes.
test_magic_cnames_by_production_ip_addresstest_magic_cnames_by_cname_consistency
- Disable unit tests that are believed broken by WAF changes.
- Add support for environment variable
ENCODED_S3_ENCRYPT_KEY_ID, to allowS3_ENCRYPT_KEY_IDin.inifiles.
- Codebuild support
- In
command_utils:- Allow a
no_executeargument toShellScriptto suppress all evaluation. (This is subprimitive. Most users still wantsimulate=) - New context manager method
ShellScript.done_firstusable in place ofShellScript.do_firstwhen there are several things to go at the start, so that they can execute forward instead of backward. - New function
setup_subrepoto download a repository and set up its virtual env.- New function
script_assure_envto help with that.
- New function
- Allow a
This PR is intended to phase out any importation of named constants from env_utils.
Named functions are preferred.
- New module
commonfor things that might otherwise go inbasebut are OK to import. (Thebasemodule is internal and not for use outside ofdcicutils.)- Moved
REGIONfrombasetocommon, leaving behind an import/exported pair for compatibility, but please importREGIONfromdcicutils.commongoing forward. OrchestratedAppandEnvNamefor type hinting.APP_CGAPandAPP_FOURFRONTas a more abstract way of referring to'cgap'and'fourfront', respectively, to talk about which orchestrated app is in play.
- Moved
- In
env_utils:- New function
default_workflow_envfor use in CGAP and Fourfront functionsrun_workflowandpseudo_run(insrc/types/workflow.py) so thatCGAP_ENV_WEBDEVandFF_ENV_WEBDEVdo not need to be imported. - New function
infer_foursight_url_from_env, similar toinfer_foursight_from_envbut returns a URL rather than an environment short name. - New function
short_env_namethat computes the short name of an environment. - New function
test_permit_load_datato gate whether aload-datacommand should actually load any data. - New function
prod_bucket_env_for_appto return the prod_bucket_env for an app. - New function
public_url_for_appto return the public production URL for an app.
- New function
- In
env_utils:- A small bit of error checking in
blue_green_mirror_env. - A bit of extra testing for
infer_foursight_from_env.
- A small bit of error checking in
The major version bump is to allow removal of some deprecated items and to further constrain the Python version.
Strictly speaking, this is an INCOMPATIBLE CHANGE, though we expect little or no impact.
In particular, searches of all 4dn-dcic and dbmi-cgap repositories on GitHub show
that only the torb repository is impacted, and since that repo is not
in active use, we're not worried about that. Also, minor code adjustments would
fix the problem uses allowing uses of version 3.0 or higher.
Specifics:
Supports versions of Python starting with 3.6.1 and below 3.8.
Removes support for previously-deprecated function name
whodaman, which onlytorbwas still using.compute_ff_prd_envcan be used as a direct replacement.Removes support for previously-deprecated variable
MAGIC_CNAMEwhich no one was using any more.Removes support for previously-deprecated variable
GOLDEN_DBwhich onlytorbwas still using._FF_GOLDEN_DBcould be used as a direct replacement in an emergency, but only for legacy environments. This is not a good solution for orchestrated environments (C4-689).The variables
FF_MAGIC_CNAME,CGAP_MAGIC_CNAME,FF_GOLDEN_DB, andCGAP_GOLDEN_DB, which had no uses outside ofdcicutilsitself, now have underscores ahead of their names to emphasize that they are internal todcicutilsonly._FF_MAGIC_CNAME,_CGAP_MAGIC_CNAME,_FF_GOLDEN_DB, and_CGAP_GOLDEN_DB, respectively, could be used as a direct replacement in an emergency, but only for legacy environments. This is not a good solution for orchestrated environments (C4-689).The function name
use_inputhas been renamedprompt_for_inputand the preferred place to import it from is nowmisc_utils, notbeanstalk_utils. (This is just a synonym for the poorly named Python functioninput.)The previously-deprecated class name
deployment_utils.Deployerhas been removed.IniFileManagercan be used as a direct replacement.The previously-deprecated function name
guess_mirror_envhas been removed.get_standard_mirror_envcan be used as a direct replacement.The deprecated function name
hms_nowand the deprecated variable nameHMS_TZhave been removed.ref_nowandREF_TZ, respectively, can be used as direct replacements.These previously-deprecated
s3_utils.s3Utilsclass variables have been removed:s3Utils.SYS_BUCKET_HEALTH_PAGE_KEYreplaced byHealthPageKey.SYSTEM_BUCKETs3Utils.OUTFILE_BUCKET_HEALTH_PAGE_KEYreplaced byHealthPageKey.PROCESSED_FILE_BUCKETs3Utils.RAW_BUCKET_HEALTH_PAGE_KEYreplaced byHealthPageKey.FILE_UPLOAD_BUCKETs3Utils.BLOB_BUCKET_HEALTH_PAGE_KEYreplaced byHealthPageKey.BLOB_BUCKETs3Utils.METADATA_BUCKET_HEALTH_PAGE_KEYreplaced byHealthPageKey.METADATA_BUNDLES_BUCKETs3Utils.TIBANNA_OUTPUT_BUCKET_HEALTH_PAGE_KEYreplaced byHealthPageKey.TIBANNA_OUTPUT_BUCKET
Among
4dn-dcicrepos, there was only one active use of any of these,TIBANNA_OUTPUT_BUCKET_HEALTH_PAGE_KEY, insrc/commands/setup_tibanna.pyin4dn-cloud-infra. It will need to be rewritten.Among
dbmi-bgmrepos, all are mentioned only insrc/encoded/root.pyandsrc/encoded/tests/test_root.py, but rewrites to useHealthPageKeyattributes will be needed there as well.
- No functional change. Cosmetic edits to various files in order to make certain file comparisons tidier.
- This change rearranges files to remove some bootstrapping issues caused by circular dependencies. This change is not supposed to affect the visible behavior, but the nature of the change creates a risk of change because things moved from file to file. An attempt was made to retain support for importable functions and variables in a way that would be non-disruptive.
- New module
ff_mockscontaining some test facilities that can be used by other repos to test FF and CGAP stuff.- Class
MockBoto4DNLegacyElasticBeanstalkClient. - Context manager
mocked_s3utilsfor mocking many typical situations.
- Class
- Support Central European Time for testing.
- In
s3_utils, fix C4-706, where short names of environments were not accepted as env arguments to s3Utils in legacy CGAP.
- In
qa_utilsadd some support for testing new functionality:- In
MockBoto3, create a different way to register client classes. - In
MockBotoS3Client:- Add minimal support for
head_bucket. - Add minimal support for
list_objects_v2. - Make
list_objectsandlist_objects_v2, return aKeyCountin the result.
- Add minimal support for
- New class
MockBotoElasticBeanstalkClientfor mocking beanstalk behavior.- New subclasses
MockBoto4DNLegacyElasticBeanstalkClientandMockBotoFooBarElasticBeanstalkClientthat mock behavior of our standard legacy setup and a setup with just afourfront-fooandfourfront-bar, respectively.
- New subclasses
- In
- In
s3_utils:- Add a class
HealthPageKeythat holds names of keys expected in health page json. This was ported fromcgap-portal, which can now start importing from here. Also:- Add
HealthPageKey.TIBANNA_CWLS_BUCKET.
- Add
- In
s3Utils:- Add
TIBANNA_CWLS_BUCKET_SUFFIX.
- Add
- Add an
EnvManagerobject to manage obtaining and parsing contents of the data in global env bucket. Specific capabilities include:- Static methods
.verify_and_get_env_config()and.fetch_health_page_json()moved froms3Utils. (Trampoline functions have been left behind on that class for compatibility.) - Static method
.global_env_bucket_name()to get the current global env bucket environment variable. - Static method (and context manager)
.global_env_bucket_named(name=...)to bind the name of the current global env bucket using Python'swith. - Virtual attributes
.portal_url,.es_url, andenv_namefor accessing the contents of the dictionary obtained from the global env bucket. - This class also creates suitable abstraction to allow for a future in which the contents of this dictionary
might include keys
portal_url,es_url, andenv_namein lieu of what are nowfourfront,es, andff_env, respectively. - When an
envargument is given in creation ofs3Utils, anEnvManagerobject will be placed in the.env_managerproperty of the resultings3Utilsinstance. (If noenvargument is given, no such object can usefully be created since there is insufficient information.)
- Static methods
- Add a class
- In
deployment_utils:- Support
ENCODED_TIBANNA_CWLS_BUCKETand a--tibanna-cwls-bucketcommand line argument that get merged intoTIBANNA_CWLS_BUCKETfor use in.initemplates. These default similarly to how the Tibanna output bucket does.
- Support
- In
env_utils:- Add
fourfront-cgapto the table ofCGAP_PUBLIC_URLS.
- Add
In
cloudformation_utils:- Add
hyphenifyto change underscores to hyphens.
- Add
In
command_utils:- Add
shell_scriptcontext manager and its implementation classShellScript. - Add
module_warnings_as_ordinary_outputto help work around the problem that S3Utils outputs text we'd sometimes rather see as ordinary output, not log output.
- Add
In
lang_utils:Add support for
string_pluralizeto pluralize 'nouns' that have attached prepositional phrases, as in:string_pluralize('file to load') 'files to load` string_pluralize('brother-in-law of a proband') 'brothers-in-law of probands' string_pluralize('brother-in-law of the proband') 'brothers-in-law of the proband'But, importantly, this also means one can give have arguments to functions that use these do something sophisticated in terms of wording with almost no effort at the point of need, such as:
[there_are(['foo.json', 'bar.json'][:n], kind='file to load') for n in range(3)] [ 'There are no files to load.', 'There is 1 file to load: foo.json', 'There are 2 files to load: foo.json, bar.json' ] [n_of(n, 'bucket to delete') for n in range(3)] [ '0 buckets to delete', '1 bucket to delete', '2 buckets to delete' ]
Miscellaneous other changes:
In
docs/source/dcicutils.rst, add autodoc for various modules that are not getting documented.In
test/test_misc.py, add unit test to make sure things don't get omitted from autodoc.Specifically, a test will now fail if you make a new file in
dcicutilsand do not add a corresponding autodoc entry indocs/source/dcicutils.rst.
- In
s3_utils, add various variables that can be used to assure values are synchronized across 4DN/CGAP products:- Add new slots on
s3Utilsto hold the token at the end of each kind of bucket:s3Utils.SYS_BUCKET_SUFFIX == "system"s3Utils.OUTFILE_BUCKET_SUFFIX == "wfoutput"s3Utils.RAW_BUCKET_SUFFIX == "files"s3Utils.BLOB_BUCKET_SUFFIX == "blobs"s3Utils.METADATA_BUCKET_SUFFIX == "metadata-bundles"s3Utils.TIBANNA_OUTPUT_BUCKET_SUFFIX == 'tibanna-output'
- Add new slots on
s3Utilsfor various bits of connective glue in setting up the template slots:s3Utils.EB_PREFIX == "elasticbeanstalk"s3Utils.EB_AND_ENV_PREFIX == "elasticbeanstalk-%s-"
- Add new slots on
s3Utilsfor expected keys on a health page corresponding to each kind of bucket:s3Utils.SYS_BUCKET_HEALTH_PAGE_KEY == 'system_bucket's3Utils.OUTFILE_BUCKET_HEALTH_PAGE_KEY == 'processed_file_bucket's3Utils.RAW_BUCKET_HEALTH_PAGE_KEY == 'file_upload_bucket's3Utils.BLOB_BUCKET_HEALTH_PAGE_KEY == 'blob_bucket's3Utils.METADATA_BUCKET_HEALTH_PAGE_KEY == 'metadata_bundles_bucket's3Utils.TIBANNA_OUTPUT_BUCKET_HEALTH_PAGE_KEY == 'tibanna_output_bucket'
- Add new slots on
- In
deployment_utils, use new variables froms3_utils.
PR 150: Add json_leaf_subst, conjoined_list and disjoined_list
We do not believe this is an incompatible major version, but there is a lot here, an hence some opportunity for difference in behavior to have crept in. As such, we opted to call this a new major version to highlight where that big change happened.
In
beanstalk_utils:- Add
'elasticbeanstalk-%s-metadata-bundles'to the list of buckets thatbeanstalk_utils.delete_s3_bucketsis willing to delete.
- Add
In
cloudformation_utils:- New functions
camelizeanddehyphenatebecause they're needed a lot in our4dn-cloud-infrarepo. - New implementation of functions
get_ecs_real_urlandget_ecr_repo_urlthat are not Alpha-specific. - New classes
AbstractOrchestrationManager,C4OrchestrationManager, andAwsemOrchestrationManagerwith various utilities ported from4dn-cloud-infra(so they could be used to re-implementget_ecs_real_url``and ``get_ecr_repo_url). - New
test_cloudformation_utils.pytesting each of the bits of functionality incloudformation_utilsalong normal paths, including sometimes mocking both the Alpha and KMP environments, hoping transitions will be smooth.
- New functions
In
deployment_utils:Support environment variable
ENCODED_IDENTITYand--identityto control environment variable$IDENTITYin construction ofproduction.ini.Support environment variable
ENCODED_TIBANNA_OUTPUT_BUCKETand--tibanna_output_bucketto control environment variable$TIBANNA_OUTPUT_BUCKETin construction ofproduction.ini.Support environment variable
ENCODED_APPLICATION_BUCKET_PREFIXand--application_bucket_prefixto control environment variable$APPLICATION_BUCKET_PREFIXin construction ofproduction.ini.Support environment variable
ENCODED_FOURSIGHT_BUCKET_PREFIXand--foursight_bucket_prefixto control environment variable$FOURSIGHT_BUCKET_PREFIXin construction ofproduction.ini.New class variable
APP_KINDinIniFileManager. Default isNone, but new subclasses adjust the default tocgaporfourfront.New class variable
APP_ORCHESTRATEDinIniFileManager. Default isNone, but new subclasses adjust the default toTrueorFalse.New classes
BasicCGAPIniFileManagerBasicLegacyCGAPIniFileManagerBasicOrchestratedCGAPIniFileManagerBasicFourfrontIniFileManagerBasicLegacyFourfrontIniFileManagerBasicOrchestratedFourfrontIniFileManager
In principle, this should allow some better defaulting.
In
exceptions:- Add
InvalidParameterError.
- Add
In
lang_utils:- Add
conjoined_listanddisjoined_listto get a comma-separated list in ordinary English form with an "and" or an "or" before the last element. (Note that these also support new functionsthere_areandmust_be_one_of). - Add
there areandmust_be_one_ofto handle construction of messages that are commonly needed but require nuanced adjustment of wording to sound right in English. (Note thatmust_be_one_ofalso supportsInvalidParameterError.)
- Add
In
misc_utils:- Add
json_leaf_substto do substitutions at the leaves (atomic parts) of a JSON object. - Add
NamedObjectfor creating named tokens. - Add a
separator=argument tocamel_case_to_snake_caseandsnake_case_to_camel_case.
- Add
In
qa_utils, support for mocking enough ofboto3.client('cloudformation')that we can testcloudformation_utils. TheMockBoto3Clientwas extended, and several mock classes were added, but most importantly:MockBotoCloudFormationClientMockBotoCloudFormationStackMockBotoCloudFormationResourceSummary
In
s3_utils:- Make initialize attribute
.metadata_bucketbetter. - Add an attribute
.tibanna_output_bucket
- Make initialize attribute
PR 148: Support auth0 client and secret in deployment_utils
In
deployment_utils, add support for managing auth0 client and secret:To pass client and secret into the ini file generator:
--auth0_clientand--auth0_secretcommand line arguments.$ENCODED_AUTH0_CLIENTandENCODED_AUTH0_SECRETas environment variables.
Ini file templates can just use
AUTH0_CLIENTandAUTH0_SECRETto obtain a properly defaulted value. It is recommended to put something like this in the ini file template:auth0.client = ${AUTH0_CLIENT} auth0.secret = ${AUTH0_SECRET}
PR 147: Init s3Utils via GLOBAL_ENV_BUCKET and misc S3_BUCKET_ORG support (C4-554) PR 146: Better S3 bucket management in deployment_utils
In
cloudformation_utils:- Small bug fix to
get_ecs_real_url. - Add
get_ecr_repo_url.
- Small bug fix to
In
deployment_utils:Add environment variables that can be set per stack/instance:
ENCODED_S3_BUCKET_ORG- a unique token for your organization to be used in auto-generating S3 bucket orgs. The defaulted value (which includes possible override by a--s3_bucket_orgargument in the generator command) will be usable as${S3_BUCKET_ORG}in.inifile templates.ENCODED_S3_BUCKET_ENV- a unique token for your organization to be used in auto-generating S3 bucket names. The defaulted value (which includes possible override by a--s3_bucket_envargument in the generator command) will be usable as${S3_BUCKET_ENV}in.inifile templates.ENCODED_FILE_UPLOAD_BUCKET- the name of the file upload bucket to use if a--file_upload_bucketargument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-filesis not desired. This fully defaulted value will be available as${FILE_UPLOAD_BUCKET}in.inifile templates, and is the recommended way to compute the proper value for thefile_upload_bucketconfiguration parameter.ENCODED_FILE_WFOUT_BUCKET- the name of the file wfout bucket to use if a--file_wfout_bucketargument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-wfoutputis not desired. This fully defaulted value will be available as${FILE_WFOUT_BUCKET}in.inifile templates, and is the recommended way to compute the proper value for thefile_wfout_bucketconfiguration parameter.ENCODED_BLOB_BUCKET- the name of the blob bucket to use if a--blob_bucketargument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-blobsis not desired. This fully defaulted value will be available as${BLOB_BUCKET}in.inifile templates, and is the recommended way to compute the proper value for theblob_bucketconfiguration parameter.ENCODED_SYSTEM_BUCKET- the name of the system bucket to use if a--system_bucketargument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-systemis not desired. This fully defaulted value will be available as${SYSTEM_BUCKET}in.inifile templates, and is the recommended way to compute the proper value for thesystem_bucketconfiguration parameter.ENCODED_METADATA_BUNDLES_BUCKET- the name of the metadata bundles bucket to use if a--metadata_bundles_bucketargument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-metadata-bundlesis not desired. This fully defaulted value will be available as${METADATA_BUNDLES_BUCKET}in.inifile templates, and is the recommended way to compute the proper value for themetadata_bundles_bucketconfiguration parameter.- Fixed a bug that the index_server argument was not being correctly passed into lower level functions when
--index_serverwas specified on the command line. - Fixed a bug where passing no
--encoded_data_setbut an explicit null-string value of the environment variableENCODED_DATA_SETdid not lead to further defaulting in some circumstances.
In
ff_utils:- Add
fetch_network_ids.
- Add
In
misc_utils:- Add
dict_zip.
- Add
In
s3_utils:Add new methods
fetch_health_page_jsonandverify_and_Get_env_configin support of new initialization protocol fors3Utils.Extend
s3Utilsinitialization protocol so that under certain conditions, environment variable ifGLOBAL_ENV_BUCKETis set, the init protocol will be discovered from that bucket.NOTE WELL: The name
GLOBAL_BUCKET_ENVis also supported as a synonm forGLOBAL_ENV_BUCKETbecause it was used in testing before we settled on a final name, and we're allowing a grace period. But this name should not be considered properly supported. That it works now is a courtesy and anyone concerned about incompatible changes should use the newer name,GLOBAL_ENV_BUCEKT.
PR 145: Fix internal import problems
- Make
lang_utilsimportignoredfrommisc_utils, notqa_utils. - Make
deployment_utilsimportoverride_environfrommisc_utils, notqa_utils. - Move
local_attrsfromqa_utilstomisc_utilsso that similar errors can be avoided in other libraries that import it.
PR 141: Port Application Dockerization utils
- Add additional ECS related APIs needed for orchestration/deployment.
PR 144: Add known_bug_expected and related support
- In
misc_utils:- Add
capitalize1to uppercase the first letter of something, leaving other case alone (rather than forcing it lower).
- Add
- In
qa_utils:- Add
known_bug_expectedto mark situations in testing where a named bug is expected (one for which there is a JIRA ticket), allowing managing of the error handling by setting the bug's status asfixed=False(the default) orfixed=True.
- Add
- In (new module)
exceptions:KnownBugErrorUnfixedBugErrorWrongErrorSeenExpectedErrorNotSeenFixedBugErrorWrongErrorSeenAfterFixUnexpectedErrorAfterFix
PR 142: Move override_environ and override_dict to misc_utils
- In
misc_utils:- Adds
override_environandoverride_dictwhich were previously defined inqa_utils. - Adds new function
exportedwhich is really a synonym forignoredbut highlights the reason for the presence of the named variable is so that other files can still import it.
- Adds
- In
qa_utils:- Leaves legacy support for
override_environandoverride_dict, which are now defined inmisc_utils.
- Leaves legacy support for
PR 138: JH Docker Mount Update
- In
jh_utils.find_valid_file_or_extra_file, account for file metadata containing an"open_data_url".
PR 140: Add misc_utils.is_valid_absolute_uri (C4-651)
- Adds
misc_utils.is_valid_absolute_urifor RFC 3986 compliance.
PR 139: Add ES cluster resize capability
- Adds ElasticSearchServiceClient, a wrapper for boto3.client('es')
- Implements resize_elasticsearch_cluster, issuing an update to the relevant settings
- Integrated test was performed on staging
- Unit tests mock the boto3 API
PR 137: Docker, ECR, ECS Utils
- Adds 3 new modules with basic functionality needed for further development on the alpha stack
- Deprecates Python 3.4
PR 136: Support for VirtualApp.post
- Add a
postmethod toVirtualAppfor situations wherepost_jsonis not appropriate.
PR 135: Support for ElasticSearchDataCache
- Support for
ElasticSearchDataCacheand thees_data_cachedecorator in the newsnapshot_utilsmodule to allow local snapshot isolation on tests. For now this feature is entirely OFF unless one uses environment variable ENABLE_SNAPSHOTS=TRUE in the command invocation. - Extend the mock for
openinqa_utils.MockFileSystemto handle file open modes involving "t" and "+". - Support for
qa_utils.MockFileSystem:- New keyword arguments
auto_mirror_files_for_readanddo_not_auto_mirror. - New context manager method
mock_exists_open_removethat mocks these common methods for the mock file system that is itsself.
- New keyword arguments
- In
misc_utils:- Extend
find_associationto allow a predicate as a search value. - New function
find_associationswhich is likefind_associationbut returns a list of results, so doesn't err if more than one found.
- Extend
PR 134: Fixes to env_utils.data_set_for_env for CGAP (C4-634)
- Fix
env_utils.data_set_for_envwhich were returning'test'forfourfront-cgapwolfandfourfront-cgaptest. Oddly, the proper value is'prod'.
PR 133: Fix ControlledTime.utcnow on AWS (C4-623)
- Fix
qa_utils.ControlledTime.utcnowon AWS (C4-623).
PR 132: Miscellaneous support for cgap-portal, and some unit testing (part of C4-601)
- For
jh_utils:- Better unit test for
find_valid_file_or_extra_file(part of fixing C4-601).
- Better unit test for
- For
misc_utils:- New function
ignorablewhich is basically a synonym forignore, but with the sense that it's OK for the variables given as its arguments to be used elsewhere or not. - New function
ancestor_classesthat returns a list of the classes from which a given class inherits. - New function
is_proper_subclassthat is likeissubclassbut returnsTrueonly if its two arguments _are_ not the same class. - New function
identitythat returns its argument. - New functions
countandcount_iffor counting things in a sequence. - New function
find_associationfor finding dictionaries in a list based on specified field criteria. - New
@decoratordecorator for defining (what else?) decorators. Specifically, this addresses the@foovs@foo()issue, allowing both syntaxes.
- New function
PR 131: Misc functionality in service of C4-183
- In
dcicutils.misc_utils:- New function
remove_elementto remove an element from a list. - New class
TestAppwhich is a synonym forwebtest.TestAppbut declared not to be a test case. - Make
_VirtualAppHelperuse newTestApp.
- New function
PR 130: Fix bug that sometimes results in duplicated search results (C4-336)
- Fixes bug C4-336, in which sometimes
ff_utils.search_metadata, by doing a series of Elastic Search calls that it pastes together into a single result, can return a list containing duplicated items.
PR 129: Fix problematic pytest dependency (C4-521)
- Fix problem in 1.9.0 with unwanted dependency on
pytest.PytestConfigWarning(C4-521). - Added some unit tests to run instead of integration tests for
s3_utilsin a number of cases.
PR 128: Changelog Warnings (C4-511) and Publish Fixes (C4-512)
- Make changelog problems issue a warning rather than fail testing.
- Make publication for GitHub Actions (GA) not query interactively for confirmation.
Some other fixes are included because the test_unzip_s3_to_s3
and test_unzip_s3_to_s3_2 tests were intermittently failing.
Those tests were refactored, and the following additional support was added:
- In
MockBotoS3Client, added support for some cases of: *.put_object()*.list_objects()
- Parses Beanstalk API correctly and passes region.
No PR: Just fixes to GA PyPi deploy
PR 126: C4-503 Grab Environment API
- Adds get_beanstalk_environment_variables, which will return information necessary to simulate any application given the caller has the appropriate access keys.
- Removes an obsolete tag from create_db_snapshot, which was set erroneously.
PR 125: Edits to getting_started doc
- Edited getting_started.rst doc to reflect updated account creation protocol.
- Add
misc_utils.url_path_joinfor merging parts of URLs. - Add
make retestto rerun failed tests from previous test run.
- Adds 3 Github Actions for building the library, building docs and deploying to PyPi
PR 122: Speed up ff_utils unit tests, and misc small bits of functionality
- Added an
integratedxmark to possible marks inpytest.ini. These are the same asintegratedbut they represent test cases that have an associated unit test that is redundant, so that theintegratedxtest doesn't have to be run to get full coverage. - For
ff_utils:- Split tests into a
xxx_unitandxxx_integratedversion. The latter is marked with newintegratedxmark.
- Split tests into a
- For
env_utils:- Added some test cases.
- For
s3_utils:- Small remodularization of
s3Utilsfor easier access to some constants in testing. - Improvements to error reporting in
s3Utils.get_access_keys().
- Small remodularization of
- For
qa_utils:- In
MockFileSystem, fixed a typo in debugging typeout. - In
MockResponse:- Added a
url=init arg and.urlproperty. - Added a .text as synonym for
.content.
- Added a
- In
MockBotoS3Client:- Extended to handle
region_name=. - Added
mock_other_required_arguments=andmock_s3_files=init args for use in testing. - Added
MockBotoS3Client, add.get_object(Bucket, Key).
- Extended to handle
- In
- For
ff_utils:- Used
ValueErrorrather thanExceptionin several places errors are raised. - Some very small other refactoring was also done for modularity that should not affect behavior.
- Used
In misc_utils:
- Fix
as_datetimeto raise an error on bad input, allowingraise_error=Falseto suppress that if needed. - Add
as_ref_datetimeto convert times to the reference timezone (US/Eastern by default). - Add
as_utc_datetimeto convert times to UTC. - Extend
in_datetime_intervalto parse all string arguments usingas_ref_datetime. - Rename
HMS_TZtoREF_TZ, but keepHMS_TZas a synonym for compatibility for now. - Rename
hms_nowtoref_now, but again keephms_nowas a synonym for compatibility for now.
The rationale for these changes is that if we deploy at other locations, it may not be HMS that is relevant, so we could be at some place with another timezone.
- Updates elasticsearch library to 6.8.1 to take a bug fix.
PR 119: More env_utils support**
- Add
env_utils.classify_server_url.
PR 118: Various bits of functionality in support of 4dn-status (C4-363)
- New feature in
qa_utils:- ControlledTime can now be used as a mock for the datetime module itself in some situations, though some care is required.
- New features in
misc_utils:as_secondsso that, for exampleas_seconds(minutes=3)can be used to get 180.hms_nowto get the value ofdatetime.datetime.now()in HMS local time (EST or EDT as appropriate).in_datetime_intervalto test that a given time is within a given time interval.as_datetimeto coerce a properly formattedstrto adatetime.datetime.
PR 117: Repair handling of sentry_dsn in deployment_utils (C4-361)
- Fixes to
deployment_utils:- Changes the handling of sentry DSN as an argument (
--sentry_dsn) to the deployer. - Doesn't raise an error if environment variables collide but with the same value.
- Uses better binding technology for binding environment variables.
- Factors in a change to the tests to not use a deprecated name (Deployer changed to IniFileMaker) for one of the classes.
- PEP8 adjustments.
- Changes the handling of sentry DSN as an argument (
- Fixes to
qa_utils:- Don't do changelog cross-check for beta versions.
- PEP8 adjustments to
test_env_utilsandtest_s3_utils.
PR 115: Miscellaneous fixes 2020-10-06
- Fix a lurking bug in
beanstalk_utilswheredelete_dbhad the wrong scope. - Add
qa_utils.raises_regexpfor conceptual compatibility withAssertRaisesinunittest. - Add
misc_utils.CustomizablePropertyand companionmisc_utils.getattr_customized. - Add
qa_utils.override_dict, factored out ofqa_utils.override_environ. - Add
qa_utils.check_duplicated_items_by_keyto aid in error reporting for search results. - Add
qa_utils.MockUUIDModulefor being able to mockuuid.uuid4(). - Add
qa_utils.MockBoto3. - Add
qa_utils.MockBotoSQSClientso thatget_queue_urlandget_queue_attributescan be used in testing offf_utils.stuff_in_queue. - Add support for
sentry_dsnand aENCODED_SENTRY_DSNbeanstalk environment variable indeployment_utils. - In tests for
ff_utils, convert tests forsearch_metadataandstuff_in_queueto be proper unit tests, to avoid some timing errors that occur during integration testing.
- New
ff_utilsfunctions for common pages/info we'd like to obtain:get_health_page,get_counts_page,get_indexing_status, andget_counts_summary. - New
CachedFieldfacility. - New
misc_utilsfunctionscamel_case_to_snake_case,snake_case_to_camel_case, andmake_counter.
PR 113: Deprecations, updates + CNAME swap
- Implements an
obsoletedecorator, applied to many functions inbeanstalk_utils. - Fixes some functions in
beanstalk_utilsthat do not work with ES6 - Pull full
CNAMEswap code fromTorbintodcicutils.
PR 112: Miscellaneous utilities ported from cgap-portal and SubmitCGAP repos
This still has a beta version number 1.1.0b1.
Ported functionality from cgap-portal and SubmitCGAP repos:
- New functions in
env_utils:is_cgap_serverandis_fourfront_server. - New functions
misc_utils:full_object_name,full_class_name,constantly,keyword_as_title,file_contents. - New classes in
qa_utils:MockResponseandMockBotoS3Client. - New functions in
qa_utils:printed_output(context manager), - Extend
lang_utils.n_ofto take a list as its first argument without callinglen. - Tests for
misc_utils.VirtualApp.put_json.
PR 111: ES6 - Fix create_es_client
This is a major change, with beta version number 1.0.0.b1:
- Fixes to
es_utils.create_es_client.
PR 110: Add VirtualApp.put_json (C4-272)
- Add
misc_utils.VirtualApp.put_json.
A record of older changes can be found
in GitHub.
To find the specific version numbers, see the version value in
the poetry.app section of pyproject.toml for the corresponding change, as in:
[poetry.app] name = "dcicutils" version = "100.200.300" ...etc.
This would correspond with dcicutils 100.200.300.