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

⬆️ upgrade dependencies #863

Merged
merged 18 commits into from
Jul 2, 2024
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
32 changes: 17 additions & 15 deletions .github/workflows/onpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,44 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [ '3.9' ]
python-version: [ '3.8' ]
os: [ ubuntu-latest, windows-latest ]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
cache-dependency-path: setup.py
cache: 'pip'

- name: Install pip
run: python -m pip install --upgrade pip

- name: Install package and dependencies
run: pip install -U -e ".[dev]"
run: |
python -m pip install --upgrade pip
pip install hatch
hatch run sync

- name: Lint
run: |
prospector --profile prospector.yaml
black --check .
hatch run prospector --profile prospector.yaml
hatch run black --check .

- name: Run unit tests
run: |
git config --global init.defaultBranch main # to avoid verbose deprecation messages in CI pipeline
pytest tests/unit --cov dbx -n auto
hatch run pytest tests/unit --cov dbx -n auto

- name: Run integrity tests
run: |
python -m dbx --help
python -c "import dbx; print(dbx.__version__)"
hatch run python -m dbx --help
hatch run python -c "from dbx._version import __version__; print(__version__)"

- name: Publish test coverage
if: startsWith(matrix.os,'ubuntu')
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
20 changes: 10 additions & 10 deletions .github/workflows/onrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ jobs:
os: [ ubuntu-latest ]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
cache-dependency-path: setup.py
cache: 'pip'

- name: Install pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -U -e ".[dev]"
- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
hatch run sync

- name: Build dist
run: pip wheel -w dist . --no-deps
run: hatch build -c -t wheel

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ out/

site/
.dbx/
src/dbx/_version.py
100 changes: 63 additions & 37 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,43 +1,69 @@
DataBricks eXtensions aka dbx
Databricks License
Copyright (2021) Databricks, Inc.

Copyright (2021) Databricks, Inc.
Definitions.

Agreement: The agreement between Databricks, Inc., and you governing
the use of the Databricks Services, as that term is defined in
the Master Cloud Services Agreement (MCSA) located at
www.databricks.com/legal/mcsa.

Licensed Materials: The source code, object code, data, and/or other
works to which this license applies.

This library (the "Software") may not be used except in connection with the Licensee's use of the Databricks Platform Services pursuant
to an Agreement (defined below) between Licensee (defined below) and Databricks, Inc. ("Databricks"). The Object Code version of the
Software shall be deemed part of the Downloadable Services under the Agreement, or if the Agreement does not define Downloadable Services,
Subscription Services, or if neither are defined then the term in such Agreement that refers to the applicable Databricks Platform
Services (as defined below) shall be substituted herein for “Downloadable Services.” Licensee's use of the Software must comply at
all times with any restrictions applicable to the Downloadable Services and Subscription Services, generally, and must be used in
accordance with any applicable documentation. For the avoidance of doubt, the Software constitutes Databricks Confidential Information
under the Agreement.
Scope of Use. You may not use the Licensed Materials except in
connection with your use of the Databricks Services pursuant to
the Agreement. Your use of the Licensed Materials must comply at all
times with any restrictions applicable to the Databricks Services,
generally, and must be used in accordance with any applicable
documentation. You may view, use, copy, modify, publish, and/or
distribute the Licensed Materials solely for the purposes of using
the Licensed Materials within or connecting to the Databricks Services.
If you do not agree to these terms, you may not view, use, copy,
modify, publish, and/or distribute the Licensed Materials.

Redistribution. You may redistribute and sublicense the Licensed
Materials so long as all use is in compliance with these terms.
In addition:

- You must give any other recipients a copy of this License;
- You must cause any modified files to carry prominent notices
stating that you changed the files;
- You must retain, in any derivative works that you distribute,
all copyright, patent, trademark, and attribution notices,
excluding those notices that do not pertain to any part of
the derivative works; and
- If a "NOTICE" text file is provided as part of its
distribution, then any derivative works that you distribute
must include a readable copy of the attribution notices
contained within such NOTICE file, excluding those notices
that do not pertain to any part of the derivative works.

Additionally, and notwithstanding anything in the Agreement to the contrary:
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* you may view, make limited copies of, and may compile the Source Code version of the Software into an Object Code version of the
Software. For the avoidance of doubt, you may not make derivative works of Software (or make any any changes to the Source Code
version of the unless you have agreed to separate terms with Databricks permitting such modifications (e.g., a contribution license
agreement)).
You may add your own copyright statement to your modifications and may
provide additional license terms and conditions for use, reproduction,
or distribution of your modifications, or for any such derivative works
as a whole, provided your use, reproduction, and distribution of
the Licensed Materials otherwise complies with the conditions stated
in this License.

If you have not agreed to an Agreement or otherwise do not agree to these terms, you may not use the Software or view, copy or compile
the Source Code of the Software.

This license terminates automatically upon the termination of the Agreement or Licensee's breach of these terms. Additionally,
Databricks may terminate this license at any time on notice. Upon termination, you must permanently delete the Software and all
copies thereof (including the Source Code).
Termination. This license terminates automatically upon your breach of
these terms or upon the termination of your Agreement. Additionally,
Databricks may terminate this license at any time on notice. Upon
termination, you must permanently delete the Licensed Materials and
all copies thereof.

Agreement: the agreement between Databricks and Licensee governing the use of the Databricks Platform Services, which shall be, with
respect to Databricks, the Databricks Terms of Service located at www.databricks.com/termsofservice, and with respect to Databricks
Community Edition, the Community Edition Terms of Service located at www.databricks.com/ce-termsofuse, in each case unless Licensee
has entered into a separate written agreement with Databricks governing the use of the applicable Databricks Platform Services.

Databricks Platform Services: the Databricks services or the Databricks Community Edition services, according to where the Software is used.
DISCLAIMER; LIMITATION OF LIABILITY.

Licensee: the user of the Software, or, if the Software is being used on behalf of a company, the company.

Object Code: is version of the Software produced when an interpreter or a compiler translates the Source Code into recognizable and
executable machine code.

Source Code: the human readable portion of the Software.
THE LICENSED MATERIALS ARE PROVIDED “AS-IS” AND WITH ALL FAULTS.
DATABRICKS, ON BEHALF OF ITSELF AND ITS LICENSORS, SPECIFICALLY
DISCLAIMS ALL WARRANTIES RELATING TO THE LICENSED MATERIALS, EXPRESS
AND IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES,
CONDITIONS AND OTHER TERMS OF MERCHANTABILITY, SATISFACTORY QUALITY OR
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. DATABRICKS AND
ITS LICENSORS TOTAL AGGREGATE LIABILITY RELATING TO OR ARISING OUT OF
YOUR USE OF OR DATABRICKS’ PROVISIONING OF THE LICENSED MATERIALS SHALL
BE LIMITED TO ONE THOUSAND ($1,000) DOLLARS. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE LICENSED MATERIALS OR
THE USE OR OTHER DEALINGS IN THE LICENSED MATERIALS.
67 changes: 14 additions & 53 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
SHELL=/bin/bash


##############################################################################
PYTHON_VERSION=3.8.13
VENV_NAME := $(shell [ -d venv ] && echo venv || echo .venv)
VENV_DIR=${VENV_NAME}
PYTHON=${VENV_DIR}/bin/python
RSTCHECK=${VENV_DIR}/bin/rstcheck
SPHINX_AUTOBUILD=${VENV_DIR}/bin/sphinx-autobuild
SPHINX_BUILD=${VENV_DIR}/bin/sphinx-build
##############################################################################

##############################################################################
Expand Down Expand Up @@ -84,12 +76,11 @@ clean: ## Clean .venv, dist, build
@echo ""
@echo "${YELLOW}Removing virtual environment ${NORMAL}"
@make helper-line
-rm .python-version
hatch env remove

@echo ""
@echo "${YELLOW}Remove temp files${NORMAL}"
@make helper-line
-rm -rf $(VENV_DIR)
-rm -rf dist/*
-rm -rf build/*
-rm -rf dbx.egg-info/*
Expand All @@ -103,52 +94,25 @@ clean: ## Clean .venv, dist, build

@make docs-clean

##############################################################################
# This chaining exists so that the virtual env target will not be invoked multiple times.
# This config works because there is a file at this path "$(VENV_NAME)/bin/activate"
# Once that file is created, it will not be change unless you run "make clean".
# If the file did not change, then the target below with same name will be skipped.
venv: $(VENV_NAME)/bin/activate

$(VENV_NAME)/bin/activate:
@echo ""
@echo "${YELLOW}Init pyenv${NORMAL}"
@make helper-line
pyenv install -s ${PYTHON_VERSION}
pyenv local ${PYTHON_VERSION}

@echo ""
@echo "${YELLOW}Current python:${NORMAL}"
@make helper-line
@python --version

@echo ""
@echo "${YELLOW}Init venv in ${VENV_DIR}${NORMAL}"
@make helper-line
test -d $(VENV_NAME) || python -m venv $(VENV_NAME)

@echo ""
@echo "${YELLOW}Using ${PYTHON}${NORMAL}"
@make helper-line
$(PYTHON) --version
$(PYTHON) -m pip install --upgrade pip


##############################################################################

install: venv install-e install-dev post-install-info ## >>> MAIN TARGET. Run this to start. <<<
create-env:
hatch env create

install: create-env install-e install-dev post-install-info ## >>> MAIN TARGET. Run this to start. <<<

install-e: ## Install project as editable.
@echo ""
@echo "${YELLOW}Install project as editable${NORMAL}"
@make helper-line
$(PYTHON) -m pip install -e .
python -m pip install -e .

install-dev: ## Install dev dependencies.
@echo ""
@echo "${YELLOW}Install Dev dependencies.${NORMAL}"
@make helper-line
$(PYTHON) -m pip install -e ".[dev]"
python -m pip install -e ".[dev]"

post-install-info: ## Just some post installation info.
@echo ""
Expand All @@ -162,7 +126,7 @@ post-install-info: ## Just some post installation info.
@echo ""
@echo "${YELLOW}Optionally${NORMAL}: If you really need to, you can activate the venv in your"
@echo "terminal shell by running: "
@echo " ${YELLOW}'source .venv/bin/activate'${NORMAL}"
@echo " ${YELLOW}'hatch shell'${NORMAL}"
@echo ""
@echo "This will put any executable python tools installed above in the PATH, allowing you"
@echo "to run the tools from the shell if you really need to."
Expand All @@ -175,37 +139,36 @@ lint: ## Run the lint and checks
@echo ""
@echo "${YELLOW}Linting code:${NORMAL}"
@make helper-line
$(PYTHON) -m prospector --profile prospector.yaml
$(RSTCHECK) README.rst
python -m prospector --profile prospector.yaml
@make check

check: ## Run black checks
@echo ""
@echo "${YELLOW}Check code with black:${NORMAL}"
@make helper-line
$(PYTHON) -m black --check .
python -m black --check .

fix: ## fix the code with black formatter.
@echo ""
@echo "${YELLOW}Fixing code with black:${NORMAL}"
@make helper-line
$(PYTHON) -m black .
python -m black .

##############################################################################

test: ## Run the tests. (option): file=tests/path/to/file.py
@echo ""
@echo "${YELLOW}Running tests:${NORMAL}"
@make helper-line
$(PYTHON) -m pytest -vv --cov dbx $(file) -n auto \
python -m pytest -vv --cov dbx $(file) -n auto \
--cov-report=xml \
--cov-report=term-missing:skip-covered

test-with-html-report: ## Run all tests with html reporter.
@echo ""
@echo "${YELLOW}Testing with html report:${NORMAL}"
@make helper-line
$(PYTHON) -m pytest --cov dbx -n auto --cov-report html -s
python -m pytest --cov dbx -n auto --cov-report html -s

##############################################################################

Expand All @@ -227,6 +190,4 @@ build: ## Build the package.
@echo ""
@echo "${YELLOW}Building the project:${NORMAL}"
@make helper-line
rm -rf dist/*
rm -rf build/*
$(PYTHON) setup.py clean bdist_wheel
hatch build -c -t wheel
2 changes: 1 addition & 1 deletion contrib/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To make e2e runs you'll need a Databricks account, and a configured profile.
### Prerequisites
- `make`: This is the gnu make tool.
- for mac: https://formulae.brew.sh/formula/make
- `pyenv`: https://github.com/pyenv/pyenv
- `hatch`: https://github.com/pypa/hatch

Once you have the pre-requisites installed, you can run project functions like this:

Expand Down
1 change: 0 additions & 1 deletion dbx/__init__.py

This file was deleted.

3 changes: 2 additions & 1 deletion prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ doc-warnings: false
ignore-paths:
- build
- tests
- dbx/templates
- src/dbx/templates

max-line-length: 120

Expand All @@ -31,6 +31,7 @@ pylint:
- raise-missing-from # pretty strange requirement with acquaint logic
- broad-except
- arguments-differ
- broad-exception-raised

pycodestyle:
# W293: disabled because we have newlines in docstrings
Expand Down
Loading
Loading