Skip to content

Commit 025790a

Browse files
authored
Add CI for windows (#384)
Also: ``copy_X = False`` will now raise a value error when ``X`` has dtype ``int32`` or ``int64``. Previously, it would only raise for dtype ``int64``.
1 parent fdf378f commit 025790a

File tree

6 files changed

+149
-5
lines changed

6 files changed

+149
-5
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
windows-ci:
8+
name: "Win - tests - Python ${{ matrix.PYTHON_VERSION }}"
9+
runs-on: windows-latest
10+
env:
11+
CI: True
12+
***REMOVED***: ${{ secrets.***REMOVED*** }}
13+
***REMOVED***: ${{ secrets.***REMOVED*** }}
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
PYTHON_VERSION: ['3.7']
18+
steps:
19+
- name: Set git to use LF
20+
run: |
21+
git config --global core.autocrlf false
22+
git config --global core.eol lf
23+
- name: Checkout branch
24+
uses: actions/[email protected]
25+
with:
26+
ref: ${{ github.head_ref }}
27+
- name: Create .condarc
28+
shell: pwsh
29+
run: |
30+
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
31+
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
32+
- uses: conda-incubator/setup-miniconda@723ab12c1d66bb893c5ac701f8e387f00b24549e
33+
with:
34+
python-version: ${{ matrix.PYTHON_VERSION }}
35+
miniforge-variant: Mambaforge
36+
miniforge-version: 4.10.0-0
37+
use-mamba: true
38+
condarc-file: .github/workflows/.condarc
39+
environment-file: environment-win.yml
40+
activate-environment: quantcore.glm
41+
- name: Run Unit Tests
42+
shell: pwsh
43+
run: |
44+
python -m pip install -e . --no-deps -vv --no-use-pep517 --disable-pip-version-check
45+
pytest tests --doctest-modules src/

.github/workflows/tests-win.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
on:
3+
push:
4+
paths:
5+
- '.github/**'
6+
- '**/*.pyx'
7+
- '**/*.cpp'
8+
jobs:
9+
windows-ci:
10+
name: "Win - tests - Python ${{ matrix.PYTHON_VERSION }}"
11+
runs-on: windows-latest
12+
env:
13+
CI: True
14+
***REMOVED***: ${{ secrets.***REMOVED*** }}
15+
***REMOVED***: ${{ secrets.***REMOVED*** }}
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
PYTHON_VERSION: ['3.7']
20+
steps:
21+
- name: Set git to use LF
22+
run: |
23+
git config --global core.autocrlf false
24+
git config --global core.eol lf
25+
- name: Checkout branch
26+
uses: actions/[email protected]
27+
with:
28+
ref: ${{ github.head_ref }}
29+
- name: Create .condarc
30+
shell: pwsh
31+
run: |
32+
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
33+
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
34+
- uses: conda-incubator/setup-miniconda@723ab12c1d66bb893c5ac701f8e387f00b24549e
35+
with:
36+
python-version: ${{ matrix.PYTHON_VERSION }}
37+
miniforge-variant: Mambaforge
38+
miniforge-version: 4.10.0-0
39+
use-mamba: true
40+
condarc-file: .github/workflows/.condarc
41+
environment-file: environment-win.yml
42+
activate-environment: quantcore.glm
43+
- name: Run Unit Tests
44+
shell: pwsh
45+
run: |
46+
python -m pip install -e . --no-deps -vv --no-use-pep517 --disable-pip-version-check
47+
pytest tests --doctest-modules src/

CHANGELOG.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
Changelog
88
=========
99

10-
Unreleased
11-
----------
10+
1.4.3 - 2021-06-25
11+
------------------
12+
13+
**Bug fix:**
1214

15+
- ``copy_X = False`` will now raise a value error when ``X`` has dtype ``int32`` or ``int64``. Previously, it would only raise for dtype ``int64``.
1316

1417
1.4.2 - 2021-06-15
1518
------------------

environment-win.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: quantcore.glm
2+
channels:
3+
- ***REMOVED***
4+
- conda-forge
5+
- nodefaults
6+
dependencies:
7+
- altair
8+
- black
9+
- c-compiler
10+
- cxx-compiler
11+
- cython
12+
- dask-ml
13+
- flake8
14+
- git_root
15+
- h2o-py
16+
- ipdb
17+
- ipython
18+
- jinja2==2.11.3
19+
- johnlees-glmnet_python
20+
- jupyterlab
21+
- jupytext
22+
- libblas>=0=*mkl
23+
- libpysal
24+
- line_profiler
25+
- make
26+
- mako
27+
- memory_profiler
28+
- mkl-include
29+
- nbclassic=0.2.7
30+
- nbsphinx=0.8.3
31+
- numexpr
32+
- openjdk
33+
- openml
34+
- pandas
35+
- pip
36+
- pre-commit
37+
- pyarrow
38+
- pyshp
39+
- pytest
40+
- pytest-xdist
41+
- quantcore.matrix>=2.0.1
42+
- rpy2
43+
- scikit-learn
44+
- setuptools_scm
45+
- shapely
46+
- sparse_dot_mkl>=0.5.3
47+
- sphinx=3.5.3
48+
- sphinx_rtd_theme
49+
- sphinxcontrib-apidoc
50+
- tqdm
51+
- xsimd

src/quantcore/glm/_glm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ def set_up_and_check_fit_args(
14291429
if (
14301430
not isinstance(X, mx.CategoricalMatrix)
14311431
and hasattr(X, "dtype")
1432-
and X.dtype == np.int64 # type: ignore
1432+
and np.issubdtype(X.dtype, np.integer) # type: ignore
14331433
):
14341434
if self.copy_X is not None and not self.copy_X:
14351435
raise ValueError(

tests/glm/test_glm.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,6 @@ def test_glm_identity_regression_categorical_data(solver, offset, convert_x_fn):
865865
np.testing.assert_almost_equal(X.A if hasattr(X, "A") else X, x_mat)
866866
res = glm.fit(X, y, offset=offset)
867867

868-
fit_coef = res.coef_
869-
assert fit_coef.dtype.itemsize == X.dtype.itemsize
870868
assert_allclose(res.coef_, coef, rtol=1e-6)
871869

872870

0 commit comments

Comments
 (0)