Skip to content

Commit

Permalink
Add hatch-vcs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson committed Nov 8, 2023
1 parent c76e1d9 commit 3bde418
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

_version.py
4 changes: 0 additions & 4 deletions dask_databricks/__about__.py

This file was deleted.

18 changes: 18 additions & 0 deletions dask_databricks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,21 @@
# SPDX-License-Identifier: BSD-3

from .databrickscluster import DatabricksCluster, get_client # noqa

# Define the variable '__version__':
try:
# If setuptools_scm is installed (e.g. in a development environment with
# an editable install), then use it to determine the version dynamically.
from setuptools_scm import get_version

# This will fail with LookupError if the package is not installed in
# editable mode or if Git is not installed.
__version__ = get_version(root="..", relative_to=__file__)
except (ImportError, LookupError):
# As a fallback, use the version that is hard-coded in the file.
try:
from dask_databricks._version import __version__ # noqa: F401
except ModuleNotFoundError:
# The user is probably trying to run this without having installed
# the package, so complain.
raise RuntimeError("dask-databricks is not correctly installed. " "Please install it with pip.")
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -47,7 +47,10 @@ rye = { dev-dependencies = [
allow-direct-references = true

[tool.hatch.version]
path = "dask_databricks/__about__.py"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "dask_databricks/_version.py"

[tool.hatch.envs.default]
dependencies = [
Expand Down

0 comments on commit 3bde418

Please sign in to comment.