Skip to content

Commit

Permalink
Merge pull request #109 from dbt-labs/move-to-uv
Browse files Browse the repository at this point in the history
b-per authored Nov 18, 2024
2 parents b1caade + 56f3e7a commit d6ff468
Showing 6 changed files with 923 additions and 50 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -38,12 +38,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: |
poetry install
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Run pytest (parallel)
if: matrix.python-version != '3.13'
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -32,11 +32,11 @@ jobs:
with:
persist-credentials: false

- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Build artifacts
run: poetry build
run: uv build

- name: Publish artifacts to PyPI Test
if: inputs.deploy-to == 'PypiTest'
20 changes: 11 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -13,14 +13,14 @@ discussions and issues. We encourage you to first read our higher-level document

The rest of this document serves as a more granular guide for contributing code changes to `dbt-jobs-as-code` (this
repository). It is not intended as a guide for using `dbt-jobs-as-code`, and some pieces assume a level of familiarity
with Python development (poetry, pip, etc). Specific code snippets in this guide assume you are using macOS or Linux and
with Python development (uv, pip, etc). Specific code snippets in this guide assume you are using macOS or Linux and
are comfortable with the command line.

## Getting the code

## Installing git

You will need git in order to download and modify this project's source code. On macOS, the best way to download git is
to just install Xcode.
You will need git in order to download and modify this project's source code. On macOS, the best way to download git is to just install Xcode.

### External contributors

@@ -49,7 +49,7 @@ There are some tools that will be helpful to you in developing locally. While th

These are the tools used in `dbt-jobs-as-code` development and testing:

- [`poetry`](https://python-poetry.org/docs/) for packaging and virtual environment setup.
- [`uv`](https://docs.astral.sh/uv/) for packaging and virtual environment setup.
- [`pytest`](https://docs.pytest.org/en/latest/) to define, discover, and run tests.
- [`ruff`](https://github.com/astral-sh/ruff) for code linting and formatting.

@@ -59,19 +59,21 @@ checking out the attached documentation if you're interested in learning more ab
#### Virtual environments

We strongly recommend using virtual environments when developing code in `dbt-jobs-as-code`. We recommend creating this
environment in the root of the `dbt-jobs-as-code` repository using `poetry`. To create a new environment, run:
environment in the root of the `dbt-jobs-as-code` repository using `uv`. To create and activate a new environment, run:
```sh
poetry install
poetry shell
uv sync
source .venv/bin/activate
```

This will create and activate a new Python virtual environment.

Alternatively, you can just call `uv run dbt-jobs-as-code`

## Testing

Once you're able to manually test that your code change is working as expected, it's important to run existing automated
tests, as well as adding some new ones. These tests will ensure that:

- Your code changes do not unexpectedly break other established functionality
- Your code changes can handle all known edge cases
- The functionality you're adding will _keep_ working in the future
@@ -81,10 +83,10 @@ With a virtualenv active and dev dependencies installed you can do things like:

```sh
# Run all unit tests in a file
poetry run pytest tests/exporter/test_export.py
uv run pytest tests/exporter/test_export.py

# Run a specific unit test
poetry run pytest tests/exporter/test_export.py::test_export_jobs_yml
uv run pytest tests/exporter/test_export.py::test_export_jobs_yml
```

## Submitting a Pull Request
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
test-parallel:
poetry run pytest \
uv run pytest \
-m 'not not_in_parallel'

test-full:
poetry run pytest \
uv run pytest \
--junitxml=coverage.xml \
--cov-report=term-missing:skip-covered \
--cov=src/dbt_jobs_as_code/
71 changes: 41 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
[tool.poetry]
[project]
authors = [
{name = "dbt Labs", email = "info@dbtlabs.com"},
]
license = {text = "Apache License 2.0"}
requires-python = "<3.13,>=3.9"
dependencies = [
"click<9.0.0,>=8.1.3",
"requests<3.0.0,>=2.32.0",
"loguru<1.0.0,>=0.6.0",
"deepdiff<7.0.0,>=6.2.2",
"pydantic<3.0.0,>=2.0.0",
"croniter<2.0.0,>=1.3.8",
"ruamel-yaml<1.0.0,>=0.17.21",
"rich<13.0.0,>=12.6.0",
"PyYAML<7.0.0,>=6.0.1",
"python-dateutil<3.0,>=2.9",
"beartype<1.0.0,>=0.18.5",
"jinja2<4.0.0,>=3.1.4",
"importlib-metadata<7,>=6.0",
]
name = "dbt-jobs-as-code"
version = "0.10.0"
description = "A CLI to allow defining dbt Cloud jobs as code"
authors = ["dbt Labs <info@dbtlabs.com>"]
license = "Apache License 2.0"
readme = "README.md"
packages = [{include = "dbt_jobs_as_code", from = "src"}]
keywords = [
"dbt",
"dbt Cloud",
]

[project.urls]
repository = "https://github.com/dbt-labs/dbt-jobs-as-code.git"
keywords = ["dbt", "dbt Cloud"]

[tool.poetry.dependencies]
python = ">=3.9,<3.13"
click = "^8.1.3"
requests = "^2.32.0"
loguru = "^0.6.0"
deepdiff = "^6.2.2"
pydantic = "^2.0.0"
croniter = "^1.3.8"
"ruamel.yaml" = "^0.17.21"
rich = "^12.6.0"
PyYAML = "^6.0.1"
python-dateutil = "^2.9"
beartype = "^0.18.5"
jinja2 = "^3.1.4"
importlib-metadata = ">=6.0,<7"
[project.scripts]
dbt-jobs-as-code = "dbt_jobs_as_code.main:cli"

[tool.poetry.group.dev.dependencies]
coverage = "^7.6.3"
jsonschema = "^4.17.3"
pytest = "^7.2.0"
pytest-beartype = "^0.0.2"
pytest-cov = "^5.0.0"
[dependency-groups]
dev = [
"coverage<8.0.0,>=7.6.3",
"jsonschema<5.0.0,>=4.17.3",
"pytest<8.0.0,>=7.2.0",
"pytest-beartype<1.0.0,>=0.0.2",
"pytest-cov<6.0.0,>=5.0.0",
]

[tool.poetry.scripts]
dbt-jobs-as-code = "dbt_jobs_as_code.main:cli"
[tool.pdm.build]
includes = ["src/dbt_jobs_as_code"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.pytest.ini_options]
pythonpath = [
864 changes: 864 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit d6ff468

Please sign in to comment.