diff --git a/.github/actions/windows_actions/action.yml b/.github/actions/windows_actions/action.yml new file mode 100644 index 0000000..ef9529f --- /dev/null +++ b/.github/actions/windows_actions/action.yml @@ -0,0 +1,39 @@ +name: Windows Specific steps +description: "Builds libiconv and zlib with MSVC for Windows" + +runs: + using: "composite" + steps: + - name: Checkout libiconv + uses: actions/checkout@v4 + with: + repository: kiyolee/libiconv-win-build + ref: dff1030d222ba934e0f4a9cdab9c34134f072f68 # v1.18 + path: libiconv-win-build + persist-credentials: false + + - name: Checkout zlib + uses: actions/checkout@v4 + with: + repository: kiyolee/zlib-win-build + ref: 30623e05e64fe4b97f2073ddaf8d3ba0e99d7249 + path: zlib-win-build + persist-credentials: false + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Build libiconv + run: | + msbuild.exe libiconv-win-build/build-VS2022-MT/libiconv.sln /property:Configuration=Release;Platform=X64 + copy libiconv-win-build\\include\\iconv.h win_libs\\64bit + copy libiconv-win-build\\build-VS2022-MT\\x64\\Release\\libiconv-static.lib win_libs\\64bit + shell: cmd + + - name: Build zlib + run: | + msbuild.exe zlib-win-build/build-VS2022-MT/zlib.sln /property:Configuration=Release;Platform=X64 + copy zlib-win-build\\zlib.h win_libs\\64bit + copy zlib-win-build\\zconf.h win_libs\\64bit + copy zlib-win-build\\build-VS2022-MT\\x64\\Release\\libz-static.lib win_libs\\64bit + shell: cmd diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f922e77 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI Tests + +on: [push, pull_request] + +jobs: + test: + name: Test ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-2022] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install Linux dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y zlib1g-dev + + - name: Build Windows Libraries + if: runner.os == 'Windows' + uses: ./.github/actions/windows_actions + + - name: Install Python dependencies + run: | + pip install cython setuptools numpy narwhals + pip install pandas polars + pip install pytest mypy pytest-mypy-plugins pandas-stubs + + # The ReadStat C library (src/) contains strict-aliasing violations + # (e.g. void* <-> readstat_variable_t** casts in readstat_writer.c). + # gcc 13+ at -O2 exploits this UB and optimizes away value-label writes. + # -fno-strict-aliasing disables that assumption while keeping other -O2 opts. + - name: Install package + run: pip install . + env: + CFLAGS: ${{ runner.os == 'Linux' && '-O2 -fno-strict-aliasing' || '' }} + + - name: Run basic tests + run: python tests/test_basic.py + + - name: Run narwhals pandas tests + run: python tests/test_narwhalified.py --backend=pandas + + - name: Run narwhals polars tests + run: python tests/test_narwhalified.py --backend=polars + + - name: Run HTTP integration tests + run: python tests/test_http_integration.py + + - name: Run runtime type tests + run: python tests/test_runtime_types.py + + - name: Run typing tests + run: pytest tests/test_typing.yml --mypy-ini-file=tests/test_mypy_setup.ini diff --git a/CITATION.cff b/CITATION.cff index 3472b2c..ef8b5e1 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -5,7 +5,7 @@ authors: given-names: "Otto" orcid: "https://orcid.org/0000-0002-3363-9287" title: "Pyreadstat" -version: 1.3.3 +version: 1.3.4 doi: 10.5281/zenodo.6612282 date-released: 2018-09-24 url: "https://github.com/Roche/pyreadstat" diff --git a/MANIFEST.in b/MANIFEST.in index e470bfc..b7eb7b5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,4 +5,4 @@ include *.pyx recursive-include pyreadstat *.pyx include *.pxd recursive-include pyreadstat *.pxd - +recursive-include pyreadstat py.typed diff --git a/README.md b/README.md index 87f1ff8..d1fb846 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,13 @@ pip install git+https://github.com/Roche/pyreadstat.git You need a working C compiler and cython >=3.0.0. +On some Linux distributions (e.g. Ubuntu) iconv is part of glibc and does not need +to be linked explicitly, while on others it may require linking. Additionally, +conda/miniforge environments bundle their own iconv, so pyreadstat will automatically +link it when it detects a conda environment (Python 3.11-3.13, outside of conda-build). +If your setup needs iconv linking for a different reason, you can force it by setting +the environment variable PYREADSTAT_LINK_ICONV=1. Set it to 0 to disable. + ### Compiling on Windows and Mac Compiling on linux is very easy, but on windows you need some extra preparation. diff --git a/change_log.md b/change_log.md index b1b6182..cc62f26 100644 --- a/change_log.md +++ b/change_log.md @@ -1,3 +1,8 @@ +# 1.3.4 (github, pypi and conda 2026.xx.xx) +* Refactored pyreadstat.pyx to pyreadstat.py solves #299 +* Added env variable PYREADSTAT_LINK_ICONV to link iconv at compiling time +* Adding typing annotations solves #299 + # 1.3.3 (github, pypi and conda 2026.01.23) * bumped narwhals requirement version to 2.10.1 * Added reading from file handles, solves #308 diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index 950d860..564b1ea 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index 33a5ad4..82165eb 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index 21da5c2..f8edd7e 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: a00fbade8350e617c6a624dde88d788b +config: 52108008ddbffab0993edd96bc05016e tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/.buildinfo.bak b/docs/_build/html/.buildinfo.bak index d373e36..21da5c2 100644 --- a/docs/_build/html/.buildinfo.bak +++ b/docs/_build/html/.buildinfo.bak @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 75a9de938a44ab293aeee5172fdca7b5 +config: a00fbade8350e617c6a624dde88d788b tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/_static/documentation_options.js b/docs/_build/html/_static/documentation_options.js index b1151d0..14a4c29 100644 --- a/docs/_build/html/_static/documentation_options.js +++ b/docs/_build/html/_static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: '1.3.3', + VERSION: '1.3.4', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index 08c4d60..8c6027c 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -5,12 +5,12 @@ - Index — pyreadstat 1.3.3 documentation + Index — pyreadstat 1.3.4 documentation - + @@ -66,12 +66,22 @@

Index

- M + F + | M | P | R + | S | W
+

F

+ + +
+

M