Skip to content

Commit

Permalink
Merge pull request #203 from Roche/dev
Browse files Browse the repository at this point in the history
version 1.1.9
  • Loading branch information
ofajardo committed Jul 12, 2022
2 parents df89153 + 5f67bea commit 0a0bf50
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors:
given-names: "Otto"
orcid: "https://orcid.org/0000-0002-3363-9287"
title: "Pyreadstat"
version: 1.1.8
version: 1.1.9
doi: 10.5281/zenodo.6612282
date-released: 2018-09-24
url: "https://github.com/Roche/pyreadstat"
5 changes: 4 additions & 1 deletion change_log.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# 1.1.8 (github, pypi and conda 2022.07.11)
# 1.1.8 (github, pypi and conda 2022.07.12)
* Adapted setup.py to work with conda forge libraries on windows

# 1.1.8 (github, pypi 2022.07.11)
* Changed windows compilation to use MSVC 2019. Static compilation for windows, no
longer need for dll files.

Expand Down
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: a880d0b541bc0b281316749f4e6def72
config: fee3178dccf7c937ff6554547f500e6c
tags: 645f666f9bcd5a90fca523b33c5a78b7
2 changes: 1 addition & 1 deletion docs/_build/html/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.1.8',
VERSION: '1.1.9',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &mdash; pyreadstat 1.1.8 documentation</title>
<title>Index &mdash; pyreadstat 1.1.9 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to pyreadstat’s documentation! &mdash; pyreadstat 1.1.8 documentation</title>
<title>Welcome to pyreadstat’s documentation! &mdash; pyreadstat 1.1.9 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Module Index &mdash; pyreadstat 1.1.8 documentation</title>
<title>Python Module Index &mdash; pyreadstat 1.1.9 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &mdash; pyreadstat 1.1.8 documentation</title>
<title>Search &mdash; pyreadstat 1.1.9 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '1.1.8'
release = '1.1.9'


# -- General configuration ---------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion pyreadstat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
from .pyreadstat import read_file_in_chunks, read_file_multiprocessing
from ._readstat_parser import ReadstatError, metadata_container

__version__ = "1.1.8"
__version__ = "1.1.9"

32 changes: 17 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

dir_path = os.path.dirname(os.path.realpath(__file__))
source_dir_root = "src"
python_dir = sys.exec_prefix

# Get a list of C source files and C source directories but omitting certain things
omitted_sources = [
Expand All @@ -54,27 +55,28 @@

source_dirs = [dirname for dirname, _, _ in os.walk(source_dir_root) if dirname not in omitted_source_dirs]

# libraries and data (in this case data are windows dlls)
# altough these are win specific we want them to be in the source distribution
# therefore we will always include them.

data_files = []
libraries = []
include_dirs = [source_dir_root] + source_dirs + ["pyreadstat", "."]
library_dirs = []
# Windows
# On Windows we have two possible setups: the user has included the static libraries in win_libs/64bit
# Or the user is going to use the Conda forge versions of those. See the windows compilation document
# for more details
if os.name == 'nt':
is64bit = sys.maxsize > 2 ** 32
#win_install_dir = "Lib/site-packages/pyreadstat"
#if is64bit:
#data_folder = "win_libs/64bit/"
#data_files = [(win_install_dir, [data_folder + "zlib1.dll", data_folder + "libiconv-2.dll"])]
#else:
#data_folder = "win_libs/32bit/"
#data_files = [(win_install_dir, [data_folder + "zlib1.dll", data_folder + "libiconv-2.dll", data_folder +"libwinpthread-1.dll", data_folder + "libgcc_s_dw2-1.dll"])]
#data_files = [("", [data_folder + "zlib1.dll", data_folder + "libiconv-2.dll"])]
libraries.extend(["libiconv-static", "libz-static"])
include_dirs.append("win_libs/64bit")
library_dirs.append("win_libs/64bit")
# The user included the compiled static libraries
if os.path.isfile("win_libs/64bit/libiconv-static.lib") and os.path.isfile("win_libs/64bit/libz-static.lib"):
libraries.extend(["libiconv-static", "libz-static"])
include_dirs.append("win_libs/64bit")
library_dirs.append("win_libs/64bit")
# conda forge libraries
else:
libraries.extend(["iconv", "zlib"])
include_dirs.append(os.path.join(python_dir, "Library", "include"))
library_dirs.append(os.path.join(python_dir, "Library", "bin"))
library_dirs.append(os.path.join(python_dir, "Library", "lib"))
else:
libraries.extend(["m", "z"])
_platform = sys.platform
Expand Down Expand Up @@ -125,7 +127,7 @@

setup(
name='pyreadstat',
version='1.1.8',
version='1.1.9',
description=short_description,
author="Otto Fajardo",
author_email="pleasecontactviagithub@notvalid.com",
Expand Down
3 changes: 1 addition & 2 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ def _prepare_data(self):
df_dates1["time"] = pd.to_datetime(df_dates1["time"])
df_dates1["time"] = df_dates1["time"].apply(lambda x: x.time())
self.df_sas_dates_as_pandas = df_dates1
#self.df_sas_dates_as_pandas2 = self.df_sas_dates_as_pandas.append(pd.DataFrame([[pd.NaT, pd.NaT, np.NaN]],columns=["date", "dtime", "time"]), ignore_index=True)

df_dates2 = df_dates1.copy()
df_dates2["date"] = df_dates2["date"].apply(lambda x: x.date())
self.df_sas_dates = df_dates2
self.df_sas_dates2 = self.df_sas_dates.append(pd.DataFrame([[np.NaN, pd.NaT, np.NaN]],columns=["date", "dtime", "time"]), ignore_index=True)
self.df_sas_dates2 = pd.concat([self.df_sas_dates, pd.DataFrame([[np.NaN, pd.NaT, np.NaN]],columns=["date", "dtime", "time"])], ignore_index=True)

# missing data
pandas_missing_sav_csv = os.path.join(self.basic_data_folder, "sample_missing.csv")
Expand Down
Empty file added win_libs/64bit/.gitkeep
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 21 additions & 3 deletions windows_compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ the recommended way. I keep here also at the end how to compile with mingw with

## Using Microsoft Visual Studio Compiler

This assumes that MSVC is installed and working. The only pre-requisite before compiling is that we need two external libraries
compiled with the same MSVC version as we pretend to compile pyreadstat, and the static libraries and header files should be copied
This assumes that MSVC is installed and working. The only pre-requisite before compiling is that we need two external libraries.
There are two ways of getting them:

### Compiling external libraries

The advantage of this way is that we can do a static compilation of those libraries, therefore pyreadstat is not going to depend on any dll file.
This is the way used to produce the wheels on pypi.
The libraries must be compiled with the same MSVC version as we pretend to compile pyreadstat, and the static libraries and header files should be copied
to the win\_libs/64bit folder in pyreadstat:

```
Expand All @@ -34,7 +40,7 @@ copy zlib-win-build\\zconf.h pyreadstat\\win_libs\\64bit
copy zlib-win-build\\build-VS2019-MT\\x64\\Release\\libz-static.lib pyreadstat\\win_libs\\64bit
```

Maybe you observed that win\_libs/64 bit already contains the files needed. It may be therefore that those already
Maybe you observed that win\_libs/samples\_64bit already contains the files needed. It may be therefore that those already
works for you, but chances are that MSVC is going to compile that those files were not generated with the same
MSVC version as you have, and therefore you have to do what is descrived before.

Expand All @@ -45,9 +51,21 @@ python setup.py build_ext --inplace

Of course any other variant of installation (setup.py install, pip etc) should work as well.

### Installing libraries with conda

You can also install the libraries with conda, and then install as usual:
This is the way used for the conda packages.

```
conda install -c conda-forge libiconv
conda install -c conda-forge zlib
python setup.py build_ext --inplace # or any other way of installing/building
```

## Using m2w64-toolchain

Warning: This method is not working starting from release 1.1.8, but it is the way to compile for version 1.1.7 and before.

Initially I compiled using purely Msys2/MingW64. This approach however requires lot of manual tweaking (see later) and is not
compatible with CI services such as appveyor. Now I am using m2w64-toolchain which is a conda package that makes the
process much easier and is compatible with Appveyor.
Expand Down

0 comments on commit 0a0bf50

Please sign in to comment.