Skip to content

Commit

Permalink
refactor to hatch vcs
Browse files Browse the repository at this point in the history
  • Loading branch information
floriscalkoen committed Oct 8, 2024
1 parent c55f43d commit 3dc94dd
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 45 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ dist*

# duckdb
*:memory*

src/coastpy/_version.py
*.vscode*
23 changes: 16 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
ci:
autofix_prs: false
autofix_prs: true
autoupdate_schedule: weekly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: debug-statements
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- id: pretty-format-json
exclude: '\.ipynb$'
- id: sort-simple-yaml

- repo: https://github.com/psf/black
rev: 23.7.0

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
hooks:
- id: black
language_version: python3.11
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
22 changes: 0 additions & 22 deletions .vscode/settings.json

This file was deleted.

10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# coclico-workbench

CoCliCo workbench prototype repository with tutorials & exploratory tools for Coastal Climate Core Services
CoCliCo workbench prototype repository with tutorials & exploratory tools for Coastal
Climate Core Services

## Usage

```bash
mamba env create -f environment.yaml
pip install -e /path/to/cloned/workbench/directory
```

## Coding online in Google Colab

Expand Down
94 changes: 79 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,79 @@
[tool.black]
line-length = 88
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "coclico"
dynamic = ["version"]
description = "Python tools for the CoCliCo workbench"
authors = [{ name = "Floris Calkoen", email = "[email protected]"}]
license = "MIT"
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
]

dependencies = []

[project.optional-dependencies]
dev = [
"black",
"coverage",
"flake8",
"isort",
"mypy",
"nbsphinx",
"pre-commit",
"pytest-cov",
"pytest-mock",
"pytest",
"ruff",
"sphinx-gallery",
"sphinx-rtd-theme",
"sphinx",
]

docs = [
"nbsphinx",
"sphinx",
"sphinx-gallery",
"sphinx-rtd-theme",
]

test = [
"black",
"coverage",
"flake8",
"isort",
"pytest",
"pytest-cov",
"pytest-mock",
]

[project.urls]
Homepage = "https://github.com/TUDelft-CITG/coastpy"

[tool.hatch.version]
source = "vcs"

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


[tool.ruff]
line-length = 88
src = ["src"]
target-version = "py312"


[tool.ruff.lint]
select = [
"E", "F", "W", # flake8
"B", # flake8-bugbear
Expand All @@ -10,33 +82,25 @@ select = [
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"TID251", # flake8-tidy-imports.banned-api
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
]
extend-ignore = [
"PLR", # Design related pylint codes
"E501", # Line too long
"E402", # Module level import not at top of file
"PT004", # Incorrect check, usefixtures is the correct way to do this
"RUF012", # Would require a lot of ClassVar's
]
src = ["src"]
unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
]

exclude = []
target-version = "py311"
flake8-unused-arguments.ignore-variadic-names = true
unfixable = []

[tool.ruff.pydocstyle]
convention = "google"
[tool.ruff.lint.pydocstyle]
convention = "google"
4 changes: 4 additions & 0 deletions src/coclico/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ._version import __version__
from .example_module import example_function

__all__ = ["__version__", "example_function"]
16 changes: 16 additions & 0 deletions src/coclico/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.1.dev43+g80da1ae.d20241008'
__version_tuple__ = version_tuple = (0, 1, 'dev43', 'g80da1ae.d20241008')
2 changes: 2 additions & 0 deletions src/coclico/example_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def example_function():
return "Example Output"

0 comments on commit 3dc94dd

Please sign in to comment.