Skip to content

Commit 579bfa1

Browse files
authored
Merge pull request #16 from robcalon/feature/pre-commit
Feature/pre commit
2 parents 9c226f5 + 3ace879 commit 579bfa1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3002
-5173
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ dnu/
55
dist/
66
*.egg-info
77
*.log
8-
.env
8+
*.env
9+
*.ruff_cache

.pre-commit-config.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# The repos are ordered in the way they are executed.
2+
# This is important because `autoflake` should run before `flake8`, for example
3+
4+
default_stages: [commit, push]
5+
fail_fast: true
6+
minimum_pre_commit_version: 2.15.0
7+
repos:
8+
9+
- repo: local
10+
hooks:
11+
12+
# checks for files that would conflict in case-insensitive filesystems.
13+
- id: check-case-conflict
14+
name: check-case-conflict
15+
entry: check-case-conflict
16+
language: python
17+
types: [ python ]
18+
19+
# checks for files that contain merge conflict strings.
20+
- id: check-merge-conflict
21+
name: check-merge-conflict
22+
entry: check-merge-conflict
23+
language: python
24+
types: [ python ]
25+
26+
# ensures that a file is either empty, or ends with one newline.
27+
- id: end-of-file-fixer
28+
name: end-of-file-fixer
29+
entry: end-of-file-fixer
30+
language: python
31+
types: [ python ]
32+
33+
# removes utf-8 byte order marker.
34+
- id: fix-byte-order-marker
35+
name: fix-byte-order-marker
36+
entry: fix-byte-order-marker
37+
language: python
38+
types: [ python ]
39+
40+
# replaces or checks mixed line ending.
41+
- id: mixed-line-ending
42+
name: mixed-line-ending
43+
entry: mixed-line-ending
44+
language: python
45+
types: [ python ]
46+
47+
# trims trailing whitespace.
48+
- id: trailing-whitespace-fixer
49+
name: trailing-whitespace-fixer
50+
entry: trailing-whitespace-fixer
51+
language: python
52+
types: [ python ]
53+
54+
#
55+
- id: black
56+
name: black
57+
entry: black
58+
files: "^(src|tests)"
59+
language: python
60+
types: [ python ]
61+
62+
- id: ruff
63+
name: ruff
64+
entry: ruff
65+
files: "^(src|tests)"
66+
language: python
67+
types: [ python ]
68+
args: [--fix, --exit-non-zero-on-fix]
69+
70+
#
71+
# - id: pylint
72+
# name: pylint
73+
# entry: pylint
74+
# files: "^(src|tests)"
75+
# language: python
76+
# types: [ python ]
77+
78+
#
79+
- id: mypy
80+
name: mypy
81+
entry: mypy
82+
files: "^(src/pyetm/sessions|src/pyetm/client|src/pyetm/profiles)"
83+
language: python
84+
types: [ python ]

examples/introduction.ipynb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"from pyetm import Client\n",
1818
"\n",
1919
"# create a new scenario from scratch\n",
20-
"client = Client.from_scenario_parameters(end_year=2050, area_code=\"nl\")\n",
20+
"client = Client.from_scenario_parameters(end_year=2050, area_code=\"nl2019\")\n",
2121
"\n",
2222
"# print scenario_id\n",
2323
"scenario_id = client.scenario_id\n",
@@ -69,7 +69,7 @@
6969
"outputs": [],
7070
"source": [
7171
"# frst check which parameters can be set in the scenario\n",
72-
"parameters = client.user_parameters\n",
72+
"parameters = client.input_parameters\n",
7373
"parameters.iloc[41:46]"
7474
]
7575
},
@@ -80,7 +80,7 @@
8080
"outputs": [],
8181
"source": [
8282
"# show parameters that are set by the user\n",
83-
"client.user_values"
83+
"client.get_input_parameters(user_only=True)"
8484
]
8585
},
8686
{
@@ -98,8 +98,8 @@
9898
"}\n",
9999
"\n",
100100
"# apply the changes to the scenario\n",
101-
"client.user_values = user_values\n",
102-
"client.user_values"
101+
"client.input_parameters = user_values\n",
102+
"client.get_input_parameters(user_only=True)"
103103
]
104104
},
105105
{
@@ -138,15 +138,6 @@
138138
"outputs": [],
139139
"source": [
140140
"# show if there are custom curves attached in the scenario\n",
141-
"client.get_custom_curve_keys()"
142-
]
143-
},
144-
{
145-
"cell_type": "code",
146-
"execution_count": null,
147-
"metadata": {},
148-
"outputs": [],
149-
"source": [
150141
"client.get_custom_curve_settings()"
151142
]
152143
},
@@ -189,7 +180,7 @@
189180
"outputs": [],
190181
"source": [
191182
"# set data as ccurves profiles\n",
192-
"client.custom_curves = ccurves\n",
183+
"# client.set_custom_curves(ccurves\n",
193184
"client.custom_curves.head()"
194185
]
195186
},

pyproject.toml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pyetm"
7-
version = "1.2.2"
7+
version = "1.3.0"
8+
89
description = "Python-ETM Connector"
910
authors = [{name = "Rob Calon", email = "[email protected]"}]
1011
readme = "README.md"
1112
requires-python = ">=3.9"
1213
license = {file = "LICENSE"}
13-
dependencies = ['requests>=2.26', 'pandas>=2.0']
14+
dependencies = [
15+
'requests>=2.26',
16+
'pandas>=2.0',
17+
]
1418
keywords = ["ETM", "Energy Transition Model"]
1519
classifiers = [
1620
'Development Status :: 4 - Beta',
@@ -28,14 +32,33 @@ classifiers = [
2832
'Programming Language :: Python :: 3.11',
2933
]
3034

31-
[project.optional-dependencies]
32-
async = ["aiohttp>=3.8"]
33-
io = ["xlsxwriter>=3.0", "openpyxl>=3.0"]
34-
test = ["pytest", "responses", "aioresponses", "build", "twine"]
35-
all = ["pyetm[async]", "pyetm[io]", "pyetm[test]"]
36-
3735
[project.urls]
3836
repository = "https://github.com/robcalon/pyetm"
3937

4038
# [tool.distutils.bdist_wheel]
4139
# universal = true
40+
41+
[project.optional-dependencies]
42+
async = ["aiohttp>=3.8"]
43+
excel = ["xlsxwriter>=3.0", "openpyxl>=3.0"]
44+
dev = [
45+
"black",
46+
"mypy>=1.4.1",
47+
"pre-commit",
48+
"pre-commit-hooks",
49+
"pyetm[async, excel]",
50+
# "pylint",
51+
"ruff",
52+
"pandas-stubs",
53+
]
54+
55+
[tool.setuptools.package-data]
56+
"pyetm.data" = ["*.csv"]
57+
58+
[tool.pylint]
59+
max-args = 15
60+
max-local = 20
61+
62+
[tool.mypy]
63+
disallow_untypes_defs = true
64+
# disallow_incomplete_defs = true

src/pyetm/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
"""init main module"""
22
from .client import Client
3+
4+
__all__ = ["Client"]

src/pyetm/client/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
"""init client module"""
22
from .client import Client
3+
4+
__all__ = ["Client"]

0 commit comments

Comments
 (0)