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

Feature modulegraph and cleanup #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Documentation: https://EditorConfig.org
# Inspired by Django .editorconfig file

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
charset = utf-8

[*.{yaml,yml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = true
indent_size = 4

[*.{diff,patch}]
trim_trailing_whitespace = false
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
### OS-specific
.DS_Store

### Editors
*~
\#*\#
**/.vscode
.$*

### Byte-compiled files
__pycache__
*.pyc

### Build output
build
*.egg-info

### Reports
.coverage
.coverage.*
.hypothesis/
coverage.xml
*.cover

### Caches
.*[cC]ache*

### Notebooks
.ipynb_checkpoints

### Project-specific
tmp/
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# Machine-friendliness
- id: trailing-whitespace
- id: end-of-file-fixer
# Repo quality
- id: check-added-large-files
args: [--enforce-all]
- id: forbid-submodules
- id: check-case-conflict
# - id: check-illegal-windows-names TODO: reactivate once https://github.com/pre-commit/pre-commit-hooks/issues/1048 is fixed
- id: check-merge-conflict
- id: debug-statements
# Config file issues
- id: check-json
- id: check-toml
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli

ci: # https://pre-commit.ci/
autoupdate_schedule: monthly
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ dependencies:
- pip:
- "git+https://github.com/calliope-project/ec_utils.git@v0.1.0"
```

## Development

We recommend using `mamba` for development.

```bash
mamba create -n ec_utils --file requirements/base.txt --file requirements/geo.txt --file requirements/dev.txt
mamba activate ec_utils
pip install --no-deps -e .
```
3 changes: 0 additions & 3 deletions eurocalliopelib/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions eurocalliopelib/docs/addfile.py

This file was deleted.

40 changes: 0 additions & 40 deletions eurocalliopelib/docs/dag.py

This file was deleted.

58 changes: 0 additions & 58 deletions eurocalliopelib/docs/schema.py

This file was deleted.

77 changes: 77 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=70.0"]

[project]
name = "ec_utils"
authors = [
{name = "Tim Tröndle", email = "tim.troendle@usys.ethz.ch"},
{name = "Ivan Ruiz Manuel", email = "i.ruizmanuel@tudelft.nl"}
]
description = "Utility library to glue the ec_modules workflows"
readme = "README.md"
license = {file = "LICENSE"}
# complete classifier list:
# http://pypi.org/classifiers/
classifiers = [
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
keywords = ['utilities', 'workflows']

requires-python = ">=3.8"
dynamic = ["dependencies", "version"]

[project.urls]
Homepage = "https://github.com/calliope-project/ec_utils"
Repository = "https://github.com/calliope-project/ec_utils"
Issues = "https://github.com/calliope-project/ec_utils/issues"

[tool.setuptools]
package-dir = {"" = "src"}

[tool.setuptools.dynamic]
version = {attr = "ec_utils.__version__"}
dependencies = { file = ["requirements/base.txt"] }
optional-dependencies.geo = { file = ["requirements/geo.txt"] }
optional-dependencies.dev = { file = ["requirements/dev.txt"] }

[tool.codespell]
skip = 'tests/*.py,AUTHORS,*.shp,*.geojson'
count = ''
quiet-level = 3
ignore-words-list = "socio-economic,manuel"

[tool.ruff]

[tool.ruff.lint]
select = ["E", "F", "I", "W", "D", "PT", "C90", "UP"]
exclude = [".eggs"]

[tool.ruff.lint.isort]
split-on-trailing-comma = false

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "D104"]
"tests/**" = ["D100", "D103", "PT004"]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true

[tool.ruff.format]
exclude = [".*.egg-info", "requirements/**"]
skip-magic-trailing-comma = true

[tool.mypy]
ignore_missing_imports = true

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
pythonpath = ["src"]
testpaths = ["tests"]
7 changes: 7 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
numpy
scipy
pydot
pandera
xarray
networkx
pycountry == 18.12.8
4 changes: 4 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ruff
codespell
pytest
ipykernel
3 changes: 3 additions & 0 deletions requirements/geo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
geopandas
rasterio
rasterstats
42 changes: 0 additions & 42 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/ec_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.1"
3 changes: 3 additions & 0 deletions eurocalliopelib/filters.py → src/ec_utils/filters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""Data standardisation functions."""


def unit(value, unit, parenthesis=True):
"""Formats the numeric value of a unit into a string in a consistent way."""
formatted = f"{value:,g} {unit}"
Expand Down
File renamed without changes.
Loading