Skip to content
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

Feature/dev container #83

Merged
merged 9 commits into from
May 24, 2023
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:0-3.8",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install --user -r requirements-dev.txt; pre-commit install",

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["ms-python.vscode-pylance", "eamodio.gitlens"]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Install dependencies
run: |
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Subsections for each version can be one of the following;

Each individual change should have a link to the pull request after the description of the change.

0.3.6 (unreleased)
------------------

Added
^^^^^
- added support for vscode dev container with python 3.8, requirments-dev.txt, pylance/gitlens extensions and precommit all preinstalled `#83 <https://github.com/lvgig/tubular/pull/83>`_

0.3.5 (2023-04-26)
------------------

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ To configure ``pre-commit`` for your local repository run the following;

pre-commit install

If working in a codespace the dev requirements and precommit will be installed automatically in the dev container.

If you are building the documentation locally you will need the `docs/requirements.txt <https://github.com/lvgig/tubular/blob/main/docs/requirements.txt>`_.

General
Expand Down
24 changes: 0 additions & 24 deletions tests/mapping/test_MappingTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
class TestInit(object):
"""Tests for MappingTransformer.init()."""

def test_arguments(self):
"""Test that init has expected arguments."""

ta.functions.test_function_arguments(
func=MappingTransformer.__init__,
expected_arguments=["self", "mappings"],
expected_default_values=None,
)

def test_class_methods(self):
"""Test that MappingTransformer has transform method."""

Expand Down Expand Up @@ -108,7 +99,6 @@ def test_mapping_non_dict_item_error(self):
TypeError,
match=f"MappingTransformer: each item in mappings should be a dict but got type {type(1)} for key c",
):

MappingTransformer(mappings=mappings)


Expand All @@ -133,15 +123,6 @@ def expected_df_2():

return df

def test_arguments(self):
"""Test that transform has expected arguments."""

ta.functions.test_function_arguments(
func=MappingTransformer.transform,
expected_arguments=["self", "X", "suppress_dtype_warning"],
expected_default_values=(False,),
)

def test_super_transform_call(self, mocker):
"""Test the call to BaseMappingTransformMixin.transform."""

Expand Down Expand Up @@ -275,7 +256,6 @@ def test_mappings_unchanged(self):
def test_expected_dtype_conversions(
self, mapping, input_col_name, output_col_type_check
):

df = d.create_df_1()
x = MappingTransformer(mappings=mapping)
df = x.transform(df)
Expand All @@ -291,7 +271,6 @@ def test_expected_dtype_conversions(
def test_unexpected_dtype_change_warning_raised(
self, mapping, input_col_name, input_col_type
):

df = d.create_df_1()
print(df["a"])

Expand All @@ -312,7 +291,6 @@ def test_unexpected_dtype_change_warning_raised(
def test_unexpected_dtype_change_warning_suppressed(
self, mapping, input_col_name, input_col_type
):

df = d.create_df_1()

x = MappingTransformer(mappings=mapping)
Expand Down Expand Up @@ -343,7 +321,6 @@ def test_category_dtype_is_conserved(self):
[({"a": {99: "99", 98: "98"}}, "a"), ({"b": {"z": 99, "y": 98}}, "b")],
)
def test_no_applicable_mapping(self, mapping, mapped_col):

df = d.create_df_1()

x = MappingTransformer(mappings=mapping)
Expand All @@ -359,7 +336,6 @@ def test_no_applicable_mapping(self, mapping, mapped_col):
[({"a": {1: "1", 99: "99"}}, "a"), ({"b": {"a": 1, "z": 99}}, "b")],
)
def test_excess_mapping_values(self, mapping, mapped_col):

df = d.create_df_1()

x = MappingTransformer(mappings=mapping)
Expand Down