From 3833c36b39bb2aaad0f359937016dda700782d67 Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Wed, 25 Oct 2023 14:33:25 -0500 Subject: [PATCH 1/4] Add pyenv .python-version file to repo --- .gitignore | 1 - .python-version | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .python-version diff --git a/.gitignore b/.gitignore index 6b6430047..bb85609f6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ *swp .cache .coverage -.python-version .tox .venv/ __pycache__ diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..b326afbc9 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.9.15 From 897d6e9721526c028171a9abc1b85df6d9cca135 Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Wed, 25 Oct 2023 14:35:07 -0500 Subject: [PATCH 2/4] Stop tracking pycharm files --- .idea/misc.xml | 4 ---- .idea/openstates-core.iml | 15 --------------- 2 files changed, 19 deletions(-) delete mode 100644 .idea/misc.xml delete mode 100644 .idea/openstates-core.iml diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d56657add..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/openstates-core.iml b/.idea/openstates-core.iml deleted file mode 100644 index 5fdd65ba2..000000000 --- a/.idea/openstates-core.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file From db7af4d314fa5dd6b5ce3864627c38799d46db78 Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Wed, 25 Oct 2023 14:36:27 -0500 Subject: [PATCH 3/4] Add do_postimport flag to importers, allowing postimport to be skipped --- openstates/importers/base.py | 7 ++++--- openstates/importers/bills.py | 4 ++-- openstates/importers/events.py | 3 ++- openstates/importers/vote_events.py | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openstates/importers/base.py b/openstates/importers/base.py index eff70ecf9..a9778aa8c 100644 --- a/openstates/importers/base.py +++ b/openstates/importers/base.py @@ -119,8 +119,9 @@ class BaseImporter: merge_related: typing.Dict[str, typing.List[str]] = {} cached_transformers: _TransformerMapping = {} - def __init__(self, jurisdiction_id: str) -> None: + def __init__(self, jurisdiction_id: str, do_postimport=True) -> None: self.jurisdiction_id = jurisdiction_id + self.do_postimport = do_postimport self.json_to_db_id: typing.Dict[str, _ID] = {} self.duplicates: typing.Dict[str, str] = {} self.pseudo_id_cache: typing.Dict[str, typing.Optional[_ID]] = {} @@ -305,8 +306,8 @@ def import_data( record[what] += 1 # all objects are loaded, a perfect time to do inter-object resolution and other tasks - if self.json_to_db_id: - # only do postimport step if there are some items of this type + if self.json_to_db_id and self.do_postimport: + # only do postimport step if requested by client code AND there are some items of this type # resolution of bills take a long time if not # and events & votes get deleted! self.postimport() diff --git a/openstates/importers/bills.py b/openstates/importers/bills.py index 8dbc805ab..ec67dfb3b 100644 --- a/openstates/importers/bills.py +++ b/openstates/importers/bills.py @@ -48,8 +48,8 @@ class BillImporter(BaseImporter): } preserve_order = {"actions"} - def __init__(self, jurisdiction_id: str): - super(BillImporter, self).__init__(jurisdiction_id) + def __init__(self, jurisdiction_id: str, do_postimport=True): + super(BillImporter, self).__init__(jurisdiction_id, do_postimport) self.org_importer = OrganizationImporter(jurisdiction_id) def get_object(self, bill: _JsonDict) -> Model: diff --git a/openstates/importers/events.py b/openstates/importers/events.py index 00c108203..645c1c90d 100644 --- a/openstates/importers/events.py +++ b/openstates/importers/events.py @@ -41,8 +41,9 @@ def __init__( self, jurisdiction_id: str, vote_event_importer: VoteEventImporter, + do_postimport=True, ): - super(EventImporter, self).__init__(jurisdiction_id) + super(EventImporter, self).__init__(jurisdiction_id, do_postimport) self.org_importer = OrganizationImporter(jurisdiction_id) self.vote_event_importer = vote_event_importer diff --git a/openstates/importers/vote_events.py b/openstates/importers/vote_events.py index 262fddbe8..42222c230 100644 --- a/openstates/importers/vote_events.py +++ b/openstates/importers/vote_events.py @@ -17,8 +17,8 @@ class VoteEventImporter(BaseImporter): "sources": (VoteSource, "vote_event_id", {}), } - def __init__(self, jurisdiction_id: str, bill_importer: BillImporter): - super(VoteEventImporter, self).__init__(jurisdiction_id) + def __init__(self, jurisdiction_id: str, bill_importer: BillImporter, do_postimport=True): + super(VoteEventImporter, self).__init__(jurisdiction_id, do_postimport) self.org_importer = OrganizationImporter(jurisdiction_id) self.bill_importer = bill_importer self.seen_bill_ids: typing.Set[str] = set() From 09db4e41fa7f75a189e32c0750da8c4e553c0d67 Mon Sep 17 00:00:00 2001 From: NewAgeAirbender <34139325+NewAgeAirbender@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:15:58 -0500 Subject: [PATCH 4/4] update for release 6.17.9 --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e09024bb0..9e7f2a1c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 6.17.9 - October 26, 2023 + +* allow postimport hook to be skipped in os-update command + ## 6.17.8 - October 16, 2023 * set application_name for better performance monitoring diff --git a/pyproject.toml b/pyproject.toml index b1fbc0ba3..c7e2622ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "openstates" -version = "6.17.8" +version = "6.17.9" description = "core infrastructure for the openstates project" authors = ["James Turk "] license = "MIT"