- 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_properties
inbundle_utils
which implicitly addsidentifier
toidentifyingProperties
. - Added support for
portal_vapp
to to ff_utils.get_metadata`.
New module
bundle_utils.py
that is intended for schema-respecting worksheets ("metadata bundle"). There are various modular bits of functionality here, but the main entry point here is:load_items
to 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:CsvReader
JsonSchema
Regexp
In
lang_utils.py
:- New arguments
just_are=
tothere_are
get 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_list
anddisjoin_list
now callstr
on their sequence elements so that things likeconjoined_list([2, 3, 4])
are possible.
- New arguments
In
misc_utils.py
, miscellaneous new functionality:- New class
AbstractVirtualApp
that is either an actual VirtualApp or can be used to make mocks if the thing being called expects anAbstractVirtualApp
instead of aVirtualApp
. - New function
to_snake_case
that 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_PATTERN
to 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.py
for 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_set
if you are not working with schemas. For schema-related support, seebundle_utils.py
.New module
validation_utils.py
with these facilities:- New class
SchemaManager
for 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_set
insheet_utils.py
) in order to pre-process it as a metadata bundle for checking purposes. - New functions:
validate_data_against_schemas
to validate that table sets (workbooks, or the equivalent) have rows in each tab conforming to the schema for that tab.summary_of_data_validation_errors
to 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
ParkLabCommonLicenseChecker
park-lab-common
New
ParkLabGplPipelineLicenseChecker
park-lab-gpl-pipeline
New
ParkLabCommonServerLicenseChecker
park-lab-common-server
New
C4InfrastructureLicenseChecker
c4-infastructure
Refactored
C4PythonInfrastructureLicenseChecker
c4-python-infrastructure
Refactored
Scan2PipelineLicenseChecker
scan2-pipeline
New
In
misc_utils
:- New function
json_file_contents
- New function
In
scripts
:- Add a
run-license-checker
script, 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_schema
andget_schemas
for theportal_vapp
case needing a leading slash on the URL. - Fix in
get_schema
andget_schemas
for theportal_vapp
returning webtest.response.TestResponse which has ajson
object property rather than a function.
- Fix in
- In
ff_utils
:- New arguments
portal_env=
andportal_vapp
toget_schema
for functionget_schema
andget_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
chardet
library.
- Allow C4 infrastructure to use the
- In
misc_utils
:- New function
to_camelcase
that can take either snake_case or CamelCase input.
- New function
- In
qa_utils
:- New function
is_subdict
for asymmetric testing of dictionary equivalence.
- New function
- In
ff_utils
:- New function
get_schema
that will pull down an individual schema definition. - New function
get_schemas
that will pull down all schema definitions. - New argument
allow_abstract
toget_schema_names
for conceptual compatibility withget_schemas
. - Minor tweaks to
dump_results_to_json
for style reasons, and repairs to its overly complex and error-prone unit test.
- New function
- Add
variant_utils
with tools to filter through CGAP data.
- In
license_utils
:- In
license_utils.C4InfrastructureLicenseChecker
, allow exceptions for librariesdnslib
,dnspython
,node-forge
andudn-browser
.
- In
- Fix tests are failing on utils master branch (C4-1081), a problem with the
project_utils
test namedtest_project_registry_make_project_autoload
.
Add
license_utils
with 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-licenses
before running tests.)Add
contribution_utils
with 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_pypi
default 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_pluralize
about words ending in-ses
becausecgap-portal
needs this.
- Teach
- New module
project_utils
with support for Project mechanism.- New decorators
ProjectRegistry
andC4ProjectRegistry
- New class
Project
andC4Project
- 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_json
as 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_location
inrestore_glacier_phase_two_copy
.
- Fix calls to
- In
qa_utils.py
:- Make
boto3.client('s3').put_object
handle either a string or bytes object correctly.
- Make
- Actively mark tests that are already marked with
pytest.mark.beanstalk_failure
to also usepytest.mark.skip
so 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_utils
added functionget_portal_url
which is the same asget_env_real_url
but 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_error
to 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
print
statement 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
coveralls
dependency only dynamically in GA workflow, not in poetry, because it implicatesdocopt
library, 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
hotseat
in live ecosystem integration testing bytests/test_s3_utils.py
- New
trace_utils
module- New decorator
@Trace
- New function
make_trace_decorator
to make similar ones.
- New decorator
- Fix to
obfuscation_utils
relating to dicts containing lists. - In
dcicutils.misc_utils
:- New function
deduplicate_list
- New function
- In
dcicutils.qa_utils
:- Fixes to the
printed_output
context manager relating to multi-linePRINT
statements.
- Fixes to the
- New files:
dcicutils.redis_utils
anddcicutils.redis_tools
plus associated test files - In
dcicutils.redis_utils
:- Implement the
RedisBase
object, which takes the output ofcreate_redis_client
and returns an object that implements some base APIs for interacting with Redis.
- Implement the
- In
dcicutils.redis_tools
:- Implement the
RedisSessionToken
object, which creates higher level APIs for creating session tokens that are backed by Redis. This object operates on theRedisBase
class. - 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_errors
context manager return afail
function 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_authentication
to be object-oriented. - Add some type hinting.
- Refactor
- In
dcicutisl.env_base
anddcicutils.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 onlysecret
andserver
are 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_sse
fromtest_ff_utils.py
toff_mocks.py
.
- In
dcicutils.misc_utils
:- Add method
is_c4_arn
to check if given ARN looks like CGAP or Fourfront entity.
- Add method
- In
dcicutils.deployment_utils
:- Add support for
Auth0Domain
andAuth0AllowedConnections
- 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
consistent
that 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_dict
function (and associated unit test).
- Add
- In
dcicutils.qa_utils
:- Add
Eventually.call_assertion
.
- Add
- Minor fix to
obfuscate_dict
inobfuscation_utils
to respect passedobfuscated
argument recursively.
- In
misc_utils
:- New class
TopologicalSorter
for topological sorting of graphs
- New class
- New function
env_equals
inenv_utils
module.
- Add
opensearch_utils
, a forward-compatible OpenSearch client we should migrate to over time - In
codebuild_utils
:- New method
run_project_build_with_overrides
to 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 ofSingletonManager
might 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
MockId
for mocking theid
function in a predictable way. - Adjust
MOCK_QUEUE_URL_PREFIX
to use a mocked URL that looks more like modern AWS url, wherequeue.amazonaws.com
has 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
TestRecorder
into anAbstractTestRecorder
with two concrete classes,RequestsTestRecorder
andAuthorizedRequestsTestRecorder
. 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_used
argument in favor of a simpler implementation. - Slightly rerefactored the class hierarchy so that
StaticChecker
is a smaller class that doesn't have quite as much functionality, andStaticSourcesChecker
corresponds to whatStaticChecker
previously 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
IntegratedFixture
happen at instance-creation time. That simplifies the loading actions needed. Those can happen inconftest.py
rather than indcicutils.ff_mocks
, which in turn should allowdcicutils.ff_mocks
to be imported without error, fixing C4-932
Some functionality moved from
qa_utils
toqa_checkers
. In each case, to be compatible, theqa_utils
module 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_utils
is deprecated. Please update programs to import these fromdcicutils.qa_checkers
instead.- 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
pytest
markerstatic
for static tests.New
make
targettest-static
to 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.ECRUtils
in support of planned changes to Foursight:- Add
ECRTagWatcher
class that can be used to watch for a new image with a given tag in an ECS repository.
- Add
New functionality in
qa_utils
to support a mock ECR client.Refactor parts of
ecr_utils
andecr_scripts
to move some general-purpose parts out ofecr_scripts
(top-level variables and classECRCommandContext
) and intoecr_utils
(classECRUtils
):Changes to arguments for
ECRUtils
constructor:- Allow additional arguments needed for moved methods.
- Default more arguments so that only relevant ones need be passed.
Move some methods from
ECRCommandContext
toECRUtils
:get_images_descriptions
_apply_image_descriptions_limit
Certain variables at
ecr_scripts
top-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_name
arguments to:apply_identity
assumed_identity_if
assumed_identity
get_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_pluralize
to 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 values
to 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_obfuscated
to predicate whether something is in obfuscated form. Among other things, this enables better testing. - Add an
obfuscated=
argument toobfuscate
andobfuscate_dict
, allowing the choice of what obfuscated value to use. The argument must be something for whichis_obfuscated
returns 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_errors
context manager, borrowed fromSubmitCGAP
.
- Add
- In
ff_utils
:- Add
is_bodyless
predicate on http methods (verbs) to say if they want a data arg.
- Add
- In
env_base
:- Add
EnvBase.set_global_env_bucket
to avoid settingos.environ['GLOBAL_ENV_BUCKET']
directly.
- Add
- Add better
CHANGELOG.rst
for 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_STRICT
in GAC to allow$CREATE_MAPPING_SKIP,
$CREATE_MAPPING_WIPE_ES
, and$CREATE_MAPPING_STRICT
in.ini
files. - Allow
get_foursight_bucket
to infer a bucket prefix if one is not explicitly supplied. (The heuristic removes-envs
from 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_name
to get the orchestrated app name. - Added
EnvUtils.app_case
to conditionalize onif_cgap=
andif_fourfront=
.
- Added
- In
qa_utils
:- Added an
input_mocked
context manager. - Added
MockLog
and alogged_messages
context manager.
- Added an
- In
cloudformation_utils
:- New function
find_lambda_function_names
inAbstractOrchestrationManager
which factors out the lookup part from thediscover_foursight_check_runner_name
function.
- New function
- In
obfuscation_utils
:- Changed
should_obfuscate
to include "session" related keys.
- Changed
- In
qa_utils
:- New class
MockBoto3Ec2
geared toward security group rules related unit testing.
- New class
- New
obfuscation_utils
module.
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_scripts
has support for command line scripts related to ECR repositories.env_base
has support for bits of environmental foothold needed beforeenv_utils
ors3_utils
are ready.env_manager
is a higher-level environmental abstraction built afterenv_utils
is available.env_scripts
has support for command line scripts related to configurable environments and the global env bucket.
- New
make
targets:make test-all
runs all testsmake test-most
runs all unit and integration tests (markedunit
,integration
orintegrationx
), but not things likely to fail (markedbeanstalk failure
ordirect_es_query
).make test-integrations
runs all integration tests (markedintegration
orintegrationx
), but not things likely to fail (markedbeanstalk failure
ordirect_es_query
).make test-direct-es-query
runs any test markeddirect_es_query`
.test-units-with-coverage
runs unit tests with thecoverage
feature.test-for-ga
is 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_project
compute_stg_env_for_project
get_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_info
is deprecated. Usebeanstalk_utils.get_env_info
.get_beanstalk_real_url
is 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_ECOSYSTEM
tocloudformation_utils
. Importing it from this library is now deprecated.
In
common
:- New variables:
CHALICE_STAGE_DEV
CHALICE_STAGE_PROD
CHALICE_STAGES
DEFAULT_ECOSYSTEM
(moved fromcloudformation_utils
)LEGACY_CGAP_GLOBAL_ENV_BUCKET
LEGACY_GLOBAL_ENV_BUCKET
- New type hint (variable):
ChaliceStage
- New variables:
In
ecr_utils
:- Removed
CGAP_ECR_LAYOUT
. UseECRUtils.ECR_LAYOUT
instead. - Deprecated
CGAP_ECR_REGION
. UseECRUtils.REGION
orcommon.REGION
instead.
- Removed
In
ecs_utils
:- Added
ECSUtils.REGION
.
- Added
In
env_base
:- Moved
EnvBase
to here froms3_utils
. - Added
s3_utils.s3Base
(factored out ofs3_utils.s3Utils
)
- Moved
In
env_utils
:Removed:
guess_mirror_env
make_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_env
compute_prd_env_for_project
data_set_for_env
ecr_repository_for_env
full_cgap_env_name
full_fourfront_env_name
get_env_from_context
get_env_real_url
(replacesbeanstalk_utils.get_beanstalk_real_url
)get_foursight_bucket
get_foursight_bucket_prefix
get_standard_mirror_env
has_declared_stg_env
indexer_env_for_env
(introduced _and_ deprecated during beta)infer_foursight_from_env
infer_foursight_url_from_env
is_indexer_env
(introduced _and_ deprecated during beta)is_orchestrated
maybe_get_declared_prd_env_name
permit_load_data
New classes:
ClassificationParts
EnvNames
EnvUtils
PublicUrlParts
Always erring:
indexer_env_for_env
is_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_utils
variables, 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_utils
functionality should be accessed through functions, not variables.
In
exceptions
:BeanstalkOperationNotImplemented
EnvUtilsLoadError
IncompleteFoursightBucketTable
LegacyDispatchDisabled
MissingFoursightBucketTable
NotUsingBeanstalksAnyMore
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 disabledrecordable
declares 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
PRINT
can be tested bywith printed_output as printed
usingprinted.file_last[fp]
andprinted.file_lines[fp]
.
- Extend the mocking so that output to files by
- In
ecs_utils
: * Adds theservice_has_active_deployment
method.
- 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_config
with slightly different arguments thanget_deployment_config
, so CGAP and FF can be more easily compared.Change
--strict
and--skip
to 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_env
andget_standard_mirror_env
about them as alternative stg/prd hosts. - Add
is_beanstalk_env
to 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,item
andlabel
that can rewrite a given expression to be compared into a canonical form (e.g., reducing a dictionary with auuid
to 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_running
predicate (used by the fix totest_ecr_utils_workflow
to skip that test if docker is not running.
- Add
- In
test_ecr_utils.py
:- Fix
test_ecr_utils_workflow
to skip if docker is not enabled.
- Fix
- In
test_s3_utils.py
:- Remove
test_s3utils_creation_cgap_ordinary
because there are no more CGAP beanstalks. - Revise
test_regression_s3_utils_short_name_c4_706
to usefourfront-mastertest
rather than a CGAP env, since the CGAP beanstalk envs have gone away.
- Remove
- In
qa_utils.py
:MockBoto3Session
.MockBoto3SecretsManager
and support forMockBoto3
to make it.
- In
secrets_utils.py
andtest_secrets_utils.py
:- Add support for
SecretsTable
. - Add unit tests for existing
secrets_utils.assume_identity
and for newSecretsTable
functionality.
- Add support for
- Small cosmetic adjustments to
Makefile
to show a timestamp and info about current branch state whenmake test
starts and again when it ends. - A name containing an underscore will not be shortened by
short_env_name
nor lengthened byfull_env_name
(norfull_cgap_env_name
norfull_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_object
operation 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_id
to 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.remove
mocking 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_address
test_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_ID
in.ini
files.
- Codebuild support
- In
command_utils
:- Allow a
no_execute
argument toShellScript
to suppress all evaluation. (This is subprimitive. Most users still wantsimulate=
) - New context manager method
ShellScript.done_first
usable in place ofShellScript.do_first
when there are several things to go at the start, so that they can execute forward instead of backward. - New function
setup_subrepo
to download a repository and set up its virtual env.- New function
script_assure_env
to 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
common
for things that might otherwise go inbase
but are OK to import. (Thebase
module is internal and not for use outside ofdcicutils
.)- Moved
REGION
frombase
tocommon
, leaving behind an import/exported pair for compatibility, but please importREGION
fromdcicutils.common
going forward. OrchestratedApp
andEnvName
for type hinting.APP_CGAP
andAPP_FOURFRONT
as 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_env
for use in CGAP and Fourfront functionsrun_workflow
andpseudo_run
(insrc/types/workflow.py
) so thatCGAP_ENV_WEBDEV
andFF_ENV_WEBDEV
do not need to be imported. - New function
infer_foursight_url_from_env
, similar toinfer_foursight_from_env
but returns a URL rather than an environment short name. - New function
short_env_name
that computes the short name of an environment. - New function
test_permit_load_data
to gate whether aload-data
command should actually load any data. - New function
prod_bucket_env_for_app
to return the prod_bucket_env for an app. - New function
public_url_for_app
to 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 onlytorb
was still using.compute_ff_prd_env
can be used as a direct replacement.Removes support for previously-deprecated variable
MAGIC_CNAME
which no one was using any more.Removes support for previously-deprecated variable
GOLDEN_DB
which onlytorb
was still using._FF_GOLDEN_DB
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 variables
FF_MAGIC_CNAME
,CGAP_MAGIC_CNAME
,FF_GOLDEN_DB
, andCGAP_GOLDEN_DB
, which had no uses outside ofdcicutils
itself, now have underscores ahead of their names to emphasize that they are internal todcicutils
only._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_input
has been renamedprompt_for_input
and 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.Deployer
has been removed.IniFileManager
can be used as a direct replacement.The previously-deprecated function name
guess_mirror_env
has been removed.get_standard_mirror_env
can be used as a direct replacement.The deprecated function name
hms_now
and the deprecated variable nameHMS_TZ
have been removed.ref_now
andREF_TZ
, respectively, can be used as direct replacements.These previously-deprecated
s3_utils.s3Utils
class variables have been removed:s3Utils.SYS_BUCKET_HEALTH_PAGE_KEY
replaced byHealthPageKey.SYSTEM_BUCKET
s3Utils.OUTFILE_BUCKET_HEALTH_PAGE_KEY
replaced byHealthPageKey.PROCESSED_FILE_BUCKET
s3Utils.RAW_BUCKET_HEALTH_PAGE_KEY
replaced byHealthPageKey.FILE_UPLOAD_BUCKET
s3Utils.BLOB_BUCKET_HEALTH_PAGE_KEY
replaced byHealthPageKey.BLOB_BUCKET
s3Utils.METADATA_BUCKET_HEALTH_PAGE_KEY
replaced byHealthPageKey.METADATA_BUNDLES_BUCKET
s3Utils.TIBANNA_OUTPUT_BUCKET_HEALTH_PAGE_KEY
replaced byHealthPageKey.TIBANNA_OUTPUT_BUCKET
Among
4dn-dcic
repos, there was only one active use of any of these,TIBANNA_OUTPUT_BUCKET_HEALTH_PAGE_KEY
, insrc/commands/setup_tibanna.py
in4dn-cloud-infra
. It will need to be rewritten.Among
dbmi-bgm
repos, all are mentioned only insrc/encoded/root.py
andsrc/encoded/tests/test_root.py
, but rewrites to useHealthPageKey
attributes 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_mocks
containing some test facilities that can be used by other repos to test FF and CGAP stuff.- Class
MockBoto4DNLegacyElasticBeanstalkClient
. - Context manager
mocked_s3utils
for 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_utils
add 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_objects
andlist_objects_v2
, return aKeyCount
in the result.
- Add minimal support for
- New class
MockBotoElasticBeanstalkClient
for mocking beanstalk behavior.- New subclasses
MockBoto4DNLegacyElasticBeanstalkClient
andMockBotoFooBarElasticBeanstalkClient
that mock behavior of our standard legacy setup and a setup with just afourfront-foo
andfourfront-bar
, respectively.
- New subclasses
- In
- In
s3_utils
:- Add a class
HealthPageKey
that 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
EnvManager
object 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_name
for 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_name
in lieu of what are nowfourfront
,es
, andff_env
, respectively. - When an
env
argument is given in creation ofs3Utils
, anEnvManager
object will be placed in the.env_manager
property of the resultings3Utils
instance. (If noenv
argument 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_BUCKET
and a--tibanna-cwls-bucket
command line argument that get merged intoTIBANNA_CWLS_BUCKET
for use in.ini
templates. These default similarly to how the Tibanna output bucket does.
- Support
- In
env_utils
:- Add
fourfront-cgap
to the table ofCGAP_PUBLIC_URLS
.
- Add
In
cloudformation_utils
:- Add
hyphenify
to change underscores to hyphens.
- Add
In
command_utils
:- Add
shell_script
context manager and its implementation classShellScript
. - Add
module_warnings_as_ordinary_output
to 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_pluralize
to 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
dcicutils
and 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
s3Utils
to 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
s3Utils
for 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
s3Utils
for 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_buckets
is willing to delete.
- Add
In
cloudformation_utils
:- New functions
camelize
anddehyphenate
because they're needed a lot in our4dn-cloud-infra
repo. - New implementation of functions
get_ecs_real_url
andget_ecr_repo_url
that are not Alpha-specific. - New classes
AbstractOrchestrationManager
,C4OrchestrationManager
, andAwsemOrchestrationManager
with 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.py
testing each of the bits of functionality incloudformation_utils
along 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_IDENTITY
and--identity
to control environment variable$IDENTITY
in construction ofproduction.ini
.Support environment variable
ENCODED_TIBANNA_OUTPUT_BUCKET
and--tibanna_output_bucket
to control environment variable$TIBANNA_OUTPUT_BUCKET
in construction ofproduction.ini
.Support environment variable
ENCODED_APPLICATION_BUCKET_PREFIX
and--application_bucket_prefix
to control environment variable$APPLICATION_BUCKET_PREFIX
in construction ofproduction.ini
.Support environment variable
ENCODED_FOURSIGHT_BUCKET_PREFIX
and--foursight_bucket_prefix
to control environment variable$FOURSIGHT_BUCKET_PREFIX
in construction ofproduction.ini
.New class variable
APP_KIND
inIniFileManager
. Default isNone
, but new subclasses adjust the default tocgap
orfourfront
.New class variable
APP_ORCHESTRATED
inIniFileManager
. Default isNone
, but new subclasses adjust the default toTrue
orFalse
.New classes
BasicCGAPIniFileManager
BasicLegacyCGAPIniFileManager
BasicOrchestratedCGAPIniFileManager
BasicFourfrontIniFileManager
BasicLegacyFourfrontIniFileManager
BasicOrchestratedFourfrontIniFileManager
In principle, this should allow some better defaulting.
In
exceptions
:- Add
InvalidParameterError
.
- Add
In
lang_utils
:- Add
conjoined_list
anddisjoined_list
to 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_are
andmust_be_one_of
). - Add
there are
andmust_be_one_of
to handle construction of messages that are commonly needed but require nuanced adjustment of wording to sound right in English. (Note thatmust_be_one_of
also supportsInvalidParameterError
.)
- Add
In
misc_utils
:- Add
json_leaf_subst
to do substitutions at the leaves (atomic parts) of a JSON object. - Add
NamedObject
for creating named tokens. - Add a
separator=
argument tocamel_case_to_snake_case
andsnake_case_to_camel_case
.
- Add
In
qa_utils
, support for mocking enough ofboto3.client('cloudformation')
that we can testcloudformation_utils
. TheMockBoto3Client
was extended, and several mock classes were added, but most importantly:MockBotoCloudFormationClient
MockBotoCloudFormationStack
MockBotoCloudFormationResourceSummary
In
s3_utils
:- Make initialize attribute
.metadata_bucket
better. - 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_client
and--auth0_secret
command line arguments.$ENCODED_AUTH0_CLIENT
andENCODED_AUTH0_SECRET
as environment variables.
Ini file templates can just use
AUTH0_CLIENT
andAUTH0_SECRET
to 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_org
argument in the generator command) will be usable as${S3_BUCKET_ORG}
in.ini
file 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_env
argument in the generator command) will be usable as${S3_BUCKET_ENV}
in.ini
file templates.ENCODED_FILE_UPLOAD_BUCKET
- the name of the file upload bucket to use if a--file_upload_bucket
argument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-files
is not desired. This fully defaulted value will be available as${FILE_UPLOAD_BUCKET}
in.ini
file templates, and is the recommended way to compute the proper value for thefile_upload_bucket
configuration parameter.ENCODED_FILE_WFOUT_BUCKET
- the name of the file wfout bucket to use if a--file_wfout_bucket
argument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-wfoutput
is not desired. This fully defaulted value will be available as${FILE_WFOUT_BUCKET}
in.ini
file templates, and is the recommended way to compute the proper value for thefile_wfout_bucket
configuration parameter.ENCODED_BLOB_BUCKET
- the name of the blob bucket to use if a--blob_bucket
argument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-blobs
is not desired. This fully defaulted value will be available as${BLOB_BUCKET}
in.ini
file templates, and is the recommended way to compute the proper value for theblob_bucket
configuration parameter.ENCODED_SYSTEM_BUCKET
- the name of the system bucket to use if a--system_bucket
argument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-system
is not desired. This fully defaulted value will be available as${SYSTEM_BUCKET}
in.ini
file templates, and is the recommended way to compute the proper value for thesystem_bucket
configuration parameter.ENCODED_METADATA_BUNDLES_BUCKET
- the name of the metadata bundles bucket to use if a--metadata_bundles_bucket
argument is not given in the generator command, and the default of${S3_BUCKET_ORG}-${S3_BUCKET_ENV}-metadata-bundles
is not desired. This fully defaulted value will be available as${METADATA_BUNDLES_BUCKET}
in.ini
file templates, and is the recommended way to compute the proper value for themetadata_bundles_bucket
configuration parameter.- Fixed a bug that the index_server argument was not being correctly passed into lower level functions when
--index_server
was specified on the command line. - Fixed a bug where passing no
--encoded_data_set
but an explicit null-string value of the environment variableENCODED_DATA_SET
did 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_json
andverify_and_Get_env_config
in support of new initialization protocol fors3Utils
.Extend
s3Utils
initialization protocol so that under certain conditions, environment variable ifGLOBAL_ENV_BUCKET
is set, the init protocol will be discovered from that bucket.NOTE WELL: The name
GLOBAL_BUCKET_ENV
is also supported as a synonm forGLOBAL_ENV_BUCKET
because 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_utils
importignored
frommisc_utils
, notqa_utils
. - Make
deployment_utils
importoverride_environ
frommisc_utils
, notqa_utils
. - Move
local_attrs
fromqa_utils
tomisc_utils
so 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
capitalize1
to uppercase the first letter of something, leaving other case alone (rather than forcing it lower).
- Add
- In
qa_utils
:- Add
known_bug_expected
to 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
:KnownBugError
UnfixedBugError
WrongErrorSeen
ExpectedErrorNotSeen
FixedBugError
WrongErrorSeenAfterFix
UnexpectedErrorAfterFix
PR 142: Move override_environ and override_dict to misc_utils
- In
misc_utils
:- Adds
override_environ
andoverride_dict
which were previously defined inqa_utils
. - Adds new function
exported
which is really a synonym forignored
but 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_environ
andoverride_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_uri
for 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
post
method toVirtualApp
for situations wherepost_json
is not appropriate.
PR 135: Support for ElasticSearchDataCache
- Support for
ElasticSearchDataCache
and thees_data_cache
decorator in the newsnapshot_utils
module 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
open
inqa_utils.MockFileSystem
to handle file open modes involving "t" and "+". - Support for
qa_utils.MockFileSystem
:- New keyword arguments
auto_mirror_files_for_read
anddo_not_auto_mirror
. - New context manager method
mock_exists_open_remove
that mocks these common methods for the mock file system that is itsself
.
- New keyword arguments
- In
misc_utils
:- Extend
find_association
to allow a predicate as a search value. - New function
find_associations
which is likefind_association
but 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_env
which were returning'test'
forfourfront-cgapwolf
andfourfront-cgaptest
. Oddly, the proper value is'prod'
.
PR 133: Fix ControlledTime.utcnow on AWS (C4-623)
- Fix
qa_utils.ControlledTime.utcnow
on 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
ignorable
which 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_classes
that returns a list of the classes from which a given class inherits. - New function
is_proper_subclass
that is likeissubclass
but returnsTrue
only if its two arguments _are_ not the same class. - New function
identity
that returns its argument. - New functions
count
andcount_if
for counting things in a sequence. - New function
find_association
for finding dictionaries in a list based on specified field criteria. - New
@decorator
decorator for defining (what else?) decorators. Specifically, this addresses the@foo
vs@foo()
issue, allowing both syntaxes.
- New function
PR 131: Misc functionality in service of C4-183
- In
dcicutils.misc_utils
:- New function
remove_element
to remove an element from a list. - New class
TestApp
which is a synonym forwebtest.TestApp
but declared not to be a test case. - Make
_VirtualAppHelper
use 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_utils
in 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_join
for merging parts of URLs. - Add
make retest
to 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
integratedx
mark to possible marks inpytest.ini
. These are the same asintegrated
but they represent test cases that have an associated unit test that is redundant, so that theintegratedx
test doesn't have to be run to get full coverage. - For
ff_utils
:- Split tests into a
xxx_unit
andxxx_integrated
version. The latter is marked with newintegratedx
mark.
- Split tests into a
- For
env_utils
:- Added some test cases.
- For
s3_utils
:- Small remodularization of
s3Utils
for 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.url
property. - 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
ValueError
rather thanException
in 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_datetime
to raise an error on bad input, allowingraise_error=False
to suppress that if needed. - Add
as_ref_datetime
to convert times to the reference timezone (US/Eastern by default). - Add
as_utc_datetime
to convert times to UTC. - Extend
in_datetime_interval
to parse all string arguments usingas_ref_datetime
. - Rename
HMS_TZ
toREF_TZ
, but keepHMS_TZ
as a synonym for compatibility for now. - Rename
hms_now
toref_now
, but again keephms_now
as 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_seconds
so that, for exampleas_seconds(minutes=3)
can be used to get 180.hms_now
to get the value ofdatetime.datetime.now()
in HMS local time (EST or EDT as appropriate).in_datetime_interval
to test that a given time is within a given time interval.as_datetime
to coerce a properly formattedstr
to 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_utils
andtest_s3_utils
.
PR 115: Miscellaneous fixes 2020-10-06
- Fix a lurking bug in
beanstalk_utils
wheredelete_db
had the wrong scope. - Add
qa_utils.raises_regexp
for conceptual compatibility withAssertRaises
inunittest
. - Add
misc_utils.CustomizableProperty
and companionmisc_utils.getattr_customized
. - Add
qa_utils.override_dict
, factored out ofqa_utils.override_environ
. - Add
qa_utils.check_duplicated_items_by_key
to aid in error reporting for search results. - Add
qa_utils.MockUUIDModule
for being able to mockuuid.uuid4()
. - Add
qa_utils.MockBoto3
. - Add
qa_utils.MockBotoSQSClient
so thatget_queue_url
andget_queue_attributes
can be used in testing offf_utils.stuff_in_queue
. - Add support for
sentry_dsn
and aENCODED_SENTRY_DSN
beanstalk environment variable indeployment_utils
. - In tests for
ff_utils
, convert tests forsearch_metadata
andstuff_in_queue
to be proper unit tests, to avoid some timing errors that occur during integration testing.
- New
ff_utils
functions for common pages/info we'd like to obtain:get_health_page
,get_counts_page
,get_indexing_status
, andget_counts_summary
. - New
CachedField
facility. - New
misc_utils
functionscamel_case_to_snake_case
,snake_case_to_camel_case
, andmake_counter
.
PR 113: Deprecations, updates + CNAME swap
- Implements an
obsolete
decorator, applied to many functions inbeanstalk_utils
. - Fixes some functions in
beanstalk_utils
that do not work with ES6 - Pull full
CNAME
swap code fromTorb
intodcicutils
.
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_server
andis_fourfront_server
. - New functions
misc_utils
:full_object_name
,full_class_name
,constantly
,keyword_as_title
,file_contents
. - New classes in
qa_utils
:MockResponse
andMockBotoS3Client
. - New functions in
qa_utils
:printed_output
(context manager), - Extend
lang_utils.n_of
to 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
.