From 3cd73bbd56efea80ed4f4112b7fb623b34e6cd27 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Tue, 14 May 2024 14:21:58 -0600 Subject: [PATCH 1/6] Updated ryp2 dependency --- CHANGELOG.md | 8 ++++++++ environment.yml | 2 +- setup.py | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1efb0896..04850d2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.7] - 2024-05-14 16:30:00 + +### Added + +- Updates the dependency `rpy2>=3.5.12` in `environment.yml` and `setup.py`. + + ## [0.1.6] - 2024-05-08 10:30:00 ### Added @@ -90,6 +97,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[0.1.7]: https://github.com/PSLmodels/OG-USA/compare/v0.1.6...v0.1.7 [0.1.6]: https://github.com/PSLmodels/OG-USA/compare/v0.1.5...v0.1.6 [0.1.5]: https://github.com/PSLmodels/OG-USA/compare/v0.1.4...v0.1.5 [0.1.4]: https://github.com/PSLmodels/OG-USA/compare/v0.1.3...v0.1.4 diff --git a/environment.yml b/environment.yml index d2e34748..b48e4426 100644 --- a/environment.yml +++ b/environment.yml @@ -26,7 +26,7 @@ dependencies: - xlwt - statsmodels - linearmodels -- rpy2<=3.5.11 +- rpy2>=3.5.12 - black>=24.1.1 - pip - pip: diff --git a/setup.py b/setup.py index 1368425b..129496b6 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="ogusa", - version="0.1.6", + version="0.1.7", author="Jason DeBacker and Richard W. Evans", license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", description="USA calibration for OG-Core", @@ -32,7 +32,7 @@ "paramtools>=0.15.0", "taxcalc>=3.0.0", "requests", - "rpy2<=3.5.11", + "rpy2>=3.5.12", "pandas-datareader", "xlwt", "openpyxl>=3.1.2", From 28ea7b1bda5245eb364dfd73132211523d7df34a Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Tue, 14 May 2024 14:31:16 -0600 Subject: [PATCH 2/6] Moved rpy2 dependency to pip downloads --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index b48e4426..d84907f9 100644 --- a/environment.yml +++ b/environment.yml @@ -26,10 +26,10 @@ dependencies: - xlwt - statsmodels - linearmodels -- rpy2>=3.5.12 - black>=24.1.1 - pip - pip: + - rpy2>=3.5.12 - openpyxl>=3.1.2 - cs-kit - cs2tc From 2b622f3180c6554a5142d5f51a2620480ad67a41 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 16 May 2024 13:55:19 -0600 Subject: [PATCH 3/6] Updated rpy2 API calls in psid_data_setup.py --- ogusa/psid_data_setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ogusa/psid_data_setup.py b/ogusa/psid_data_setup.py index 5fb87182..4f36b1a7 100644 --- a/ogusa/psid_data_setup.py +++ b/ogusa/psid_data_setup.py @@ -6,9 +6,13 @@ import datetime from linearmodels import PanelOLS from rpy2.robjects import r +from rpy2.robjects import conversion +from rpy2.robjects import default_converter from rpy2.robjects import pandas2ri +from rpy2.robjects.packages import importr from ogusa.constants import PSID_NOMINAL_VARS, PSID_CONSTANT_VARS + pandas2ri.activate() pd.options.mode.chained_assignment = "raise" @@ -34,7 +38,9 @@ def prep_data(data="psid1968to2015.RData"): """ # Read data from R into pandas dataframe r["load"](os.path.join(CURDIR, "..", "data", "PSID", data)) - raw_df = r("psid_df") + raw_r_df = r("psid_df") + with (default_converter + pandas2ri.converter).context(): + raw_df = conversion.get_conversion().rpy2py(raw_r_df) # Create unique identifier for each household # note that will define a new household if head or spouse changes From 478911ea2c75b8c241ab6bbb0cc56d11175b1e35 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 16 May 2024 14:11:56 -0600 Subject: [PATCH 4/6] Added wheel to environment.yml --- environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment.yml b/environment.yml index d84907f9..a7cbd2d4 100644 --- a/environment.yml +++ b/environment.yml @@ -5,6 +5,7 @@ dependencies: - python>=3.7.7,<3.12 - numpy - setuptools +- wheel - numba>=0.54 - scipy>=1.7.1 - pandas>=1.2.5 From 0bc89110b90e3aa5adc6fc6ce15a995bf1269cc5 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 16 May 2024 14:42:05 -0600 Subject: [PATCH 5/6] Added R installation to build_and_test.yml --- .github/workflows/build_and_test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 84494712..4991b88c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -44,6 +44,10 @@ jobs: environment-file: environment.yml python-version: ${{ matrix.python-version }} auto-activate-base: false + - name: Set up R ${{ matrix.r-version }} + uses: r-lib/actions/setup-r@v2 + with: + r-version: release - name: Build shell: bash -l {0} run: | From 63e927bd03d3443607720bd23867233ccfd6b1f4 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 16 May 2024 14:46:29 -0600 Subject: [PATCH 6/6] Rearranged order of R setup in build_and_test.yml --- .github/workflows/build_and_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4991b88c..1f19d5cc 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -35,6 +35,10 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + - name: Set up R ${{ matrix.r-version }} + uses: r-lib/actions/setup-r@v2 + with: + r-version: release - name: Setup Miniconda using Python ${{ matrix.python-version }} uses: conda-incubator/setup-miniconda@v3 with: @@ -44,10 +48,6 @@ jobs: environment-file: environment.yml python-version: ${{ matrix.python-version }} auto-activate-base: false - - name: Set up R ${{ matrix.r-version }} - uses: r-lib/actions/setup-r@v2 - with: - r-version: release - name: Build shell: bash -l {0} run: |