Skip to content

switched to nox #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jobs:
- image: circleci/python:3.6
steps:
- checkout
- run: pip install --user tox
- run: ~/.local/bin/tox
- run: pip install --user nox
- run: ~/.local/bin/nox

workflows:
version: 2
Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,32 @@

name: Upload Python Package

on: [workflow_dispatch]
on:
workflow_dispatch:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nox
- name: Test with pytest
run: nox

deploy:

needs: test
runs-on: ubuntu-latest

steps:
Expand Down
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

## Development environment and steps

1. Install `tox` either globally or in a virtualenv: `pip install tox`.
2. Click on the "Fork" button at the top-right of the GitHub page.
3. Clone your fork. Example: `git clone git@github.com:dukebody/sklearn-pandas.git`.
4. Create a new branch to work on the issue/feature you want.
5. Hack out your code. To run the tests and `flake8`, just run `tox`. Tests live in the `tests` subfolder.
6. Submit a new PR with your code, indicating in the PR which issue/feature it relates to.
1. Click on the "Fork" button at the top-right of the GitHub page.
2. Clone your fork. Example: `git clone git@github.com:dukebody/sklearn-pandas.git`.
3. Create a new branch to work on the issue/feature you want.
4. Hack out your code. To run the tests and `flake8`, just run `nox`. Tests live in the `tests` subfolder.
5. Submit a new PR with your code, indicating in the PR which issue/feature it relates to.

Note: You don't need to install `sklearn-pandas` in your virtualenv to run the tests. `tox` will automatically create multiple virtual environments to run them with multiple package versions.

Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ Below example shows how to change logging level.
>>> import logging
>>> logging.getLogger('sklearn_pandas').setLevel(logging.INFO)

Changes Not Yet Published
---------

* Using nox for testing

Changelog
---------
Expand Down
13 changes: 13 additions & 0 deletions nox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
exclude =
.git
.github
__pycache__
build
dist
*site-packages/
*bin/
*.egg/*
.eggs
.tox
docs
24 changes: 24 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import nox

@nox.session
def lint(session):
session.install('pytest==5.3.5', 'setuptools==45.2',
'wheel==0.34.2', 'flake8==3.7.9',
'numpy==1.18.1', 'pandas==1.0.5')
session.install('.')
session.run('flake8', 'sklearn_pandas/', 'tests')

@nox.session
@nox.parametrize('numpy', ['1.18.1', '1.19.4'])
@nox.parametrize('scipy', ['1.4.1', '1.5.4'])
@nox.parametrize('pandas', ['1.0.5', '1.1.4'])
def tests(session, numpy, scipy, pandas):
session.install('pytest==5.3.5',
'setuptools==45.2',
'wheel==0.34.2',
f'numpy=={numpy}',
f'scipy=={scipy}',
f'pandas=={pandas}'
)
session.install('.')
session.run('py.test', 'README.rst', 'tests')
9 changes: 1 addition & 8 deletions tests/test_dataframe_mapper.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# -*- coding: utf8 -*-

import pytest

# In py3, mock is included with the unittest standard library
# In py2, it's a separate package
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock

from unittest.mock import Mock
from pandas import DataFrame
import pandas as pd
from scipy import sparse
Expand Down
30 changes: 0 additions & 30 deletions tox.ini

This file was deleted.