Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Jan 25, 2024
1 parent 9f16407 commit 415b794
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
19 changes: 7 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,22 @@ Once you're able to manually test that your code change is working as expected,

- Nothing needed to set up your environments. hatch will create your environment as defined in the `pyproject.toml` when you run.

- set up pre-commit to use hatch: `hatch run setup-pre-commit`

### Hatch Commands

See the pyproject.toml for a complete list of custom commands. See the h[atch docs](https://hatch.pypa.io/latest/cli/reference/) for a description of built in commands and flags. These are the most useful custom commands to use while developing.
See the pyproject.toml for a complete list of custom commands. See the h[atch docs](https://hatch.pypa.io/latest/cli/reference/) for a description of built in commands and flags.

Run `hatch env show` to view a list of all envoronments and all commands available within them.

Example uses:

|Type|Command|Description|
|---|---|---|
|Utility|`hatch run proto`|regenerate protobuf definitions|
|Testing|`hatch run test:unit`|run all tests|
|Testing|`hatch shell test`|Drops you into a shell env set up for manual testing|
|Code Quality|`hatch run lint:all`|run black, flake8 and mypy checks|
|Code Quality|`hatch run lint:black`|run black|
|Code Quality|`hatch run lint:flake8`|run flake8|
|Code Quality|`hatch run lint:mypy`|run mypy|
|Testing|`hatch shell`|Drops you into a shell env with all dependencies + dev dependencies installed. Use `exit` to leave the shell, _not_ `deactivate`.|

## Debugging

1. Try using a debugger, like `ipdb`. For pytest: `--pdb --pdbcls=IPython.terminal.debugger:pdb`
2.
|Shell|`hatch shell`|Drops you into the default shell with project + dev requirements installed. Use `exit` to leave the shell, _not_ `deactivate`.|
|Shell|`hatch -e <environment-name> shell`|Drops you into a shell of the specified environment. Use `exit` to leave the shell, _not_ `deactivate`.|

### Assorted development tips
* Append `# type: ignore` to the end of a line if you need to disable `mypy` on that line.
Expand Down
26 changes: 26 additions & 0 deletions dbt_common/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from dbt_common.utils.encoding import md5, JSONEncoder, ForgivingJSONEncoder

from dbt_common.utils.casting import (
cast_to_str,
cast_to_int,
cast_dict_to_dict_of_strings,
)

from dbt_common.utils.dict import (
AttrDict,
filter_null_values,
merge,
deep_merge,
deep_merge_item,
deep_map_render,
)

from dbt_common.utils.executor import executor

from dbt_common.utils.jinja import (
get_dbt_macro_name,
get_docs_macro_name,
get_materialization_macro_name,
get_test_macro_name,
MACRO_PREFIX,
)
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ test = [
"pytest-xdist~=3.2",
"hypothesis~=6.87"
]
build = [
"wheel",
"twine",
"check-wheel-contents",
]

[project.urls]
Homepage = "https://github.com/dbt-labs/dbt-common"
Expand Down Expand Up @@ -159,11 +164,7 @@ packages = ["dbt_common"]

[tool.hatch.envs.build]
description = "Env for running development commands for linting"
extra-dependencies = [
"wheel",
"twine",
"check-wheel-contents",
]
features = ["build"]

[tool.hatch.envs.build.scripts]
check-all = [
Expand Down

0 comments on commit 415b794

Please sign in to comment.