Skip to content

Commit cbaadee

Browse files
author
Stéphane Senart
committed
Merge branch 'develop'
2 parents 7657a89 + ef0745d commit cbaadee

20 files changed

Lines changed: 663 additions & 405 deletions

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ permissions:
2626
contents: read # Read-only access
2727

2828
env:
29-
DEFAULT_PYTHON_VERSION: "3.12"
30-
TARGET_PYTHON_VERSIONS: "[ '3.9', '3.10', '3.11', '3.12', '3.13' ]"
29+
DEFAULT_PYTHON_VERSION: "3.13"
30+
TARGET_PYTHON_VERSIONS: "[ '3.10', '3.11', '3.12', '3.13' ]"
3131

3232
jobs:
3333
#----------------------------------------------

.github/workflows/create-release.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
contents: write # Allow to commit and push.
1414

1515
env:
16-
DEFAULT_PYTHON_VERSION: "3.12"
16+
DEFAULT_PYTHON_VERSION: "3.13"
1717

1818
jobs:
1919
#----------------------------------------------
@@ -76,17 +76,11 @@ jobs:
7676
with:
7777
fetch-tags: true
7878

79-
#----------------------------------------------
80-
# Set the package version
81-
- name: Set package version
82-
run: echo "PACKAGE_VERSION=${{ needs.prepare.outputs.package-version }}" >> $GITHUB_ENV
83-
8479
#----------------------------------------------
8580
# Install & configure poetry -----
8681
- name: Install Poetry
8782
uses: snok/install-poetry@v1
8883
with:
89-
version: 2.0.0
9084
virtualenvs-create: true
9185
virtualenvs-in-project: true
9286
virtualenvs-path: .venv
@@ -95,10 +89,6 @@ jobs:
9589
- name: Bump version to ${{ needs.prepare.outputs.package-version }}
9690
run: poetry version ${{ needs.prepare.outputs.package-version }}
9791

98-
#----------------------------------------------
99-
- name: Build package
100-
run: poetry build
101-
10292
#----------------------------------------------
10393
# Commit the changes
10494
- name: Commit changes
@@ -124,6 +114,10 @@ jobs:
124114
with:
125115
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
126116

117+
#----------------------------------------------
118+
- name: Build package
119+
run: poetry build
120+
127121
#----------------------------------------------
128122
- name: Upload package
129123
uses: actions/upload-artifact@v4

.github/workflows/python-lint/action.yaml

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,15 @@ runs:
2323
with:
2424
virtualenvs-create: true
2525
virtualenvs-in-project: true
26+
virtualenvs-path: .venv
2627

2728
#----------------------------------------------
28-
# Load cached venv if cache exists
29-
- name: Load cached venv
30-
id: cached-poetry-dependencies
31-
uses: actions/cache@v4
32-
with:
33-
path: .venv
34-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
35-
36-
#----------------------------------------------
37-
# Install dependencies if cache does not exist
38-
- name: Install dependencies
39-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
40-
shell: bash
41-
run: poetry install --no-interaction --no-root
42-
43-
#----------------------------------------------
44-
# Install root project, if required
29+
# Install project
4530
#----------------------------------------------
4631
- name: Install project
4732
shell: bash
4833
run: poetry install --no-interaction
4934

50-
#----------------------------------------------
51-
# Load pip cache if cache exists
52-
- uses: actions/cache@v4
53-
with:
54-
path: ~/.cache/pip
55-
key: ${{ runner.os }}-pip
56-
restore-keys: ${{ runner.os }}-pip
57-
5835
#----------------------------------------------
5936
# Run Pylint
6037
- name: Pylint

.github/workflows/python-test/action.yaml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,17 @@ runs:
2323
with:
2424
virtualenvs-create: true
2525
virtualenvs-in-project: true
26+
virtualenvs-path: .venv
2627

2728
#----------------------------------------------
28-
# Load cached venv if cache exists
29-
- name: Load cached venv
30-
id: cached-poetry-dependencies
31-
uses: actions/cache@v4
32-
with:
33-
path: .venv
34-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
35-
36-
#----------------------------------------------
37-
# Install dependencies if cache does not exist
38-
- name: Install dependencies
39-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
40-
shell: bash
41-
run: poetry install --no-interaction --no-root
42-
43-
#----------------------------------------------
44-
# Install your root project, if required
29+
# Install project
4530
#----------------------------------------------
46-
- name: Install library
31+
- name: Install project
4732
shell: bash
4833
run: poetry install --no-interaction
4934

5035
#----------------------------------------------
51-
# If not using devcontainer, run tests
36+
# Run tests
5237
- name: Test with pytest
5338
shell: bash
5439
run: poetry run pytest tests

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [1.3.0] - 2025-02-08
7+
## [1.3.0] - 2025-02-15
8+
9+
### Added
10+
11+
[#84](https://github.com/ssenart/PyGazpar/issues/84) : Add a function to retrieve list of PCE ids.
812

913
### Changed
1014

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# PyGazpar
22

3-
## $\text{\color{green}{!!! This library is working again. CAPTCHA has been removed !!!}}$
4-
53
PyGazpar is a Python library for getting natural gas consumption from GrDF French provider.
64

75
Their natural gas meter is called Gazpar. It is wireless and transmit the gas consumption once per day.
@@ -76,8 +74,12 @@ client = pygazpar.Client(pygazpar.JsonWebDataSource(
7674
password='your password')
7775
)
7876

79-
data = client.loadSince(pceIdentifier='your PCE identifier',
80-
lastNDays=60,
77+
# Returns the list of your PCE identifiers attached to your account.
78+
pce_identifiers = client.get_pce_identifiers()
79+
80+
# Returns the daily and monthly consumptions for the last 60 days on your PCE identifier.
81+
data = client.load_since(pce_identifier='your PCE identifier',
82+
last_n_days=60,
8183
frequencies=[pygazpar.Frequency.DAILY, pygazpar.Frequency.MONTHLY])
8284
```
8385
See [samples/jsonSample.py](samples/jsonSample.py) file for the full example.
@@ -92,8 +94,12 @@ client = pygazpar.Client(pygazpar.ExcelWebDataSource(
9294
password='your password')
9395
)
9496

95-
data = client.loadSince(pceIdentifier='your PCE identifier',
96-
lastNDays=60,
97+
# Returns the list of your PCE identifiers attached to your account.
98+
pce_identifiers = client.get_pce_identifiers()
99+
100+
# Returns the daily and monthly consumptions for the last 60 days on your PCE identifier.
101+
data = client.load_since(pce_identifier='your PCE identifier',
102+
last_n_days=60,
97103
frequencies=[pygazpar.Frequency.DAILY, pygazpar.Frequency.MONTHLY])
98104
```
99105
See [samples/excelSample.py](samples/jsonSample.py) file for the full example.
@@ -105,8 +111,8 @@ import pygazpar
105111

106112
client = pygazpar.Client(pygazpar.TestDataSource())
107113

108-
data = client.loadSince(pceIdentifier='your PCE identifier',
109-
lastNDays=10,
114+
data = client.load_since(pce_identifier='your PCE identifier',
115+
last_n_days=10,
110116
frequencies=[pygazpar.Frequency.DAILY, Frequency.MONTHLY])
111117
```
112118
See [samples/testSample.py](samples/jsonSample.py) file for the full example.

gitversion.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Python package version (PEP440): https://peps.python.org/pep-0440/
22

3-
assembly-file-versioning-format: '{MajorMinorPatch}{PreReleaseLabel}{env:GITHUB_RUN_NUMBER ?? 0}'
4-
assembly-versioning-format: '{MajorMinorPatch}{PreReleaseLabel}{env:GITHUB_RUN_NUMBER ?? 0}'
5-
assembly-informational-format: '{MajorMinorPatch}{PreReleaseLabel}{env:GITHUB_RUN_NUMBER ?? 0}'
3+
assembly-file-versioning-format: '{MajorMinorPatch}{PreReleaseLabel}{CommitsSinceVersionSource}'
4+
assembly-versioning-format: '{MajorMinorPatch}{PreReleaseLabel}{CommitsSinceVersionSource}'
5+
assembly-informational-format: '{MajorMinorPatch}{PreReleaseLabel}{CommitsSinceVersionSource}'
66

77
branches:
88
develop:
@@ -14,6 +14,7 @@ branches:
1414
release:
1515
regex: ^release/(?<BranchName>.+)
1616
label: 'b'
17+
increment: None
1718
feature:
1819
regex: ^feature/(?<BranchName>.+)
1920
label: '.dev'

poetry.lock

Lines changed: 3 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pygazpar/__main__.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import pygazpar
99

10+
Logger = logging.getLogger(__name__)
11+
1012

1113
def main():
1214
"""Main function"""
@@ -37,6 +39,9 @@ def main():
3739

3840
args = parser.parse_args()
3941

42+
print(f"PyGazpar version: {pygazpar.__version__}")
43+
print(f"Running on Python version: {sys.version}")
44+
4045
# We create the tmp directory if not already exists.
4146
if not os.path.exists(args.tmpdir):
4247
os.mkdir(args.tmpdir)
@@ -51,11 +56,12 @@ def main():
5156
filename=f"{pygazparLogFile}", level=logging.DEBUG, format="%(asctime)s %(levelname)s [%(name)s] %(message)s"
5257
)
5358

54-
logging.info(f"PyGazpar {pygazpar.__version__}")
55-
logging.info(f"--tmpdir {args.tmpdir}")
56-
logging.info(f"--frequency {args.frequency}")
57-
logging.info(f"--lastNDays {args.lastNDays}")
58-
logging.info(f"--datasource {bool(args.datasource)}")
59+
Logger.info(f"PyGazpar version: {pygazpar.__version__}")
60+
Logger.info(f"Running on Python version: {sys.version}")
61+
Logger.info(f"--tmpdir {args.tmpdir}")
62+
Logger.info(f"--frequency {args.frequency}")
63+
Logger.info(f"--lastNDays {args.lastNDays}")
64+
Logger.info(f"--datasource {bool(args.datasource)}")
5965

6066
if args.datasource == "json":
6167
client = pygazpar.Client(pygazpar.JsonWebDataSource(args.username, args.password))
@@ -67,11 +73,13 @@ def main():
6773
raise ValueError("Invalid datasource: (json | excel | test) is expected")
6874

6975
try:
70-
data = client.loadSince(args.pce, int(args.lastNDays), [args.frequency])
76+
data = client.load_since(args.pce, int(args.lastNDays), [args.frequency])
7177
except BaseException: # pylint: disable=broad-except
7278
print("An error occured while querying PyGazpar library : %s", traceback.format_exc())
7379
return 1
7480

81+
Logger.info(f"Data loaded: {len(data)} records")
82+
Logger.debug(f"Data: {data}")
7583
print(json.dumps(data, indent=2))
7684

7785
return 0

0 commit comments

Comments
 (0)