pyflowbatt 0.2.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ tags:
7
+ - v[0-9]+.[0-9]+.[0-9]+*
8
+ pull_request:
9
+ branches: [ "*" ]
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ test:
16
+ name: Test with Pytest
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ matrix:
20
+ python-version: ["3.10","3.11","3.12","3.13","3.14"]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Install uv and set the Python version
26
+ uses: astral-sh/setup-uv@v5
27
+ with:
28
+ enable-cache: true
29
+ python-version: ${{ matrix.python-version }}
30
+
31
+ - name: Install dependencies
32
+ run: |
33
+ uv pip install ruff pytest pytest-cov
34
+ uv pip install -e .
35
+
36
+ - name: Lint with ruff
37
+ run: ruff check --select=F,E9,B
38
+
39
+ - name: Run tests with pytest
40
+ run: pytest --cov=pyflowbatt --cov-report=term
41
+
42
+ publish:
43
+ name: Publish to PyPI
44
+ needs: test
45
+ if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'EmpaEconversion/PyFlowBatt'
46
+ runs-on: ubuntu-latest
47
+ permissions:
48
+ id-token: write
49
+ contents: write
50
+ steps:
51
+ - name: Checkout code
52
+ uses: actions/checkout@v6
53
+ - name: Set up Python
54
+ uses: actions/setup-python@v6
55
+ with:
56
+ python-version: '3.12'
57
+ - name: Install build
58
+ run: pip install build
59
+ - name: Build package
60
+ run: python -m build
61
+ - name: Publish to PyPI
62
+ uses: pypa/gh-action-pypi-publish@release/v1
63
+ - name: Create GitHub release
64
+ uses: softprops/action-gh-release@v2
65
+ with:
66
+ generate_release_notes: true
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
@@ -0,0 +1,12 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.15.20
4
+ hooks:
5
+ - id: ruff-check
6
+ args: ["--fix", "--select=F,E9,B"]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/astral-sh/uv-pre-commit
10
+ rev: 0.11.28
11
+ hooks:
12
+ - id: uv-lock
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyflowbatt
3
+ Version: 0.2.0rc1
4
+ Summary: Tools for analysing data from the flow battery lab at Empa
5
+ Requires-Python: >=3.10
6
+ Requires-Dist: batterydf<0.2.0,>=0.1.0
7
+ Requires-Dist: battinfoconverter-backend>=3.2.0
8
+ Requires-Dist: impedance>=1.7.1
9
+ Requires-Dist: matplotlib>=3.10.6
10
+ Requires-Dist: pandas>=2.3.2
11
+ Requires-Dist: pyarrow>=21.0.0
12
+ Requires-Dist: rocrate>=0.9
13
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
14
+ Requires-Dist: xlsxwriter>=3.2.9
15
+ Requires-Dist: yadg<7.0.0,>=6.2.2
16
+ Provides-Extra: dev
17
+ Requires-Dist: bumpver>=2025.1131; extra == 'dev'
18
+ Requires-Dist: pre-commit>=4.2.0; extra == 'dev'
19
+ Requires-Dist: pytest>=8.4.2; extra == 'dev'
20
+ Requires-Dist: ruff>=0.13.2; extra == 'dev'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # 🌊 PyFlowBatt
24
+
25
+ This Python package contains functions and a CLI for analysing data from the flow battery lab at Empa.
26
+
27
+
28
+ ## Installation
29
+
30
+ Use Python >3.10, and install with pip:
31
+ ```
32
+ pip install git+https://github.com/empaeconversion/pyflowbatt.git
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Use in a terminal (e.g. Command Prompt or PowerShell).
38
+
39
+ To analyse data and get a full summary and ro-crate, use `pyflowbatt --folder="path/to/your/folder"`.
40
+
41
+ To zip everything at the end (e.g. to upload to Zenodo), use `pyflowbatt --folder="path/to/your/folder" --zip`.
42
+
43
+ You can also navigate to a folder e.g.
44
+ ```
45
+ cd path/to/your/folder
46
+ pyflowbatt
47
+ ```
48
+ PyFlowBatt will automatically scan for files like GCPL, EIS, LSV, CV, as well as BattInfo Converter .xlsx files, process the data, convert to battery data format, produce summary graphs and excel reports, create a BattInfo JSON-LD metadata file, and a top level ro-crate metadata file.
49
+
50
+ A full analysis can take a while. You can do a 'dry run' to check what files *would* be analysed:
51
+ ```
52
+ pyflowbatt --dry
53
+ ```
54
+
55
+ ```
56
+ pyflowbatt --dry --folder="path/to/your/folder" --zip
57
+ ```
58
+ This is useful for checking everything is in order before running a long analysis.
59
+
60
+ You can override some settings by adding a `pyflowbatt.toml` file to a sample folder, parent folder, or your home folder. Use `pyflowbatt init` to create a template file and see what can be modified.
61
+
62
+ ## Using in Python
63
+
64
+ You can also use the functions in Python, e.g.
65
+
66
+ ```python
67
+ # Use individual functions
68
+ from pyflowbatt import gcpl, lsv, cv
69
+ from pyflowbatt.read import read_to_bdf
70
+
71
+ df = read_to_bdf("path/to/my/gcpl-file")
72
+ df, cycle_df = gcpl.analyse(df)
73
+
74
+ cv_df = read_to_bdf("path/to/my/cv-file")
75
+ cv_df, cv_cycle_df, capacitance_mF = cv.analyse(cv_df)
76
+
77
+ lsv_df = read_to_bdf("path/to/my/lsv-file")
78
+ lsv_result_dict = lsv.analyse(lsv_df)
79
+
80
+ # Or run the full analysis on folders
81
+ from pyflowbatt.analysis import analyse_sample, analyse_all_samples
82
+ analyse_sample("path/to/sample/folder")
83
+ analyse_all_samples("path/to/parent/folder/of/many/samples")
84
+ ```
85
+
86
+ ## For contributors
87
+
88
+ If you find bugs, or want new features, open an *issue* on the GitHub page.
89
+
90
+ If you want to directly contribute to the project, first clone the repo and install it as editable with developer dependencies:
91
+ ```
92
+ git clone https://github.com/empaeconversion/pyflowbatt.git
93
+
94
+ cd pyflowbatt
95
+
96
+ pip install -e .[dev]
97
+ ```
98
+ Then open this folder in an editor like VSCode.
99
+
100
+ You should always create a new branch before making edits, `main` is only for tested, working code that everyone can use.
101
+
102
+ E.g. make and switch to a new branch with
103
+ ```
104
+ git checkout -b new-feature
105
+ ```
106
+
107
+ You have now branched off the `main` PyFlowBatt into your own branch called e.g. `new-feature`. Now you can do whatever you like and it won't affect the `main` branch.
108
+
109
+ When you have made and committed some changes that add a feature or fix a problem, and you want to put them into `main`, open a *pull request* on GitHub.
@@ -0,0 +1,87 @@
1
+ # 🌊 PyFlowBatt
2
+
3
+ This Python package contains functions and a CLI for analysing data from the flow battery lab at Empa.
4
+
5
+
6
+ ## Installation
7
+
8
+ Use Python >3.10, and install with pip:
9
+ ```
10
+ pip install git+https://github.com/empaeconversion/pyflowbatt.git
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Use in a terminal (e.g. Command Prompt or PowerShell).
16
+
17
+ To analyse data and get a full summary and ro-crate, use `pyflowbatt --folder="path/to/your/folder"`.
18
+
19
+ To zip everything at the end (e.g. to upload to Zenodo), use `pyflowbatt --folder="path/to/your/folder" --zip`.
20
+
21
+ You can also navigate to a folder e.g.
22
+ ```
23
+ cd path/to/your/folder
24
+ pyflowbatt
25
+ ```
26
+ PyFlowBatt will automatically scan for files like GCPL, EIS, LSV, CV, as well as BattInfo Converter .xlsx files, process the data, convert to battery data format, produce summary graphs and excel reports, create a BattInfo JSON-LD metadata file, and a top level ro-crate metadata file.
27
+
28
+ A full analysis can take a while. You can do a 'dry run' to check what files *would* be analysed:
29
+ ```
30
+ pyflowbatt --dry
31
+ ```
32
+
33
+ ```
34
+ pyflowbatt --dry --folder="path/to/your/folder" --zip
35
+ ```
36
+ This is useful for checking everything is in order before running a long analysis.
37
+
38
+ You can override some settings by adding a `pyflowbatt.toml` file to a sample folder, parent folder, or your home folder. Use `pyflowbatt init` to create a template file and see what can be modified.
39
+
40
+ ## Using in Python
41
+
42
+ You can also use the functions in Python, e.g.
43
+
44
+ ```python
45
+ # Use individual functions
46
+ from pyflowbatt import gcpl, lsv, cv
47
+ from pyflowbatt.read import read_to_bdf
48
+
49
+ df = read_to_bdf("path/to/my/gcpl-file")
50
+ df, cycle_df = gcpl.analyse(df)
51
+
52
+ cv_df = read_to_bdf("path/to/my/cv-file")
53
+ cv_df, cv_cycle_df, capacitance_mF = cv.analyse(cv_df)
54
+
55
+ lsv_df = read_to_bdf("path/to/my/lsv-file")
56
+ lsv_result_dict = lsv.analyse(lsv_df)
57
+
58
+ # Or run the full analysis on folders
59
+ from pyflowbatt.analysis import analyse_sample, analyse_all_samples
60
+ analyse_sample("path/to/sample/folder")
61
+ analyse_all_samples("path/to/parent/folder/of/many/samples")
62
+ ```
63
+
64
+ ## For contributors
65
+
66
+ If you find bugs, or want new features, open an *issue* on the GitHub page.
67
+
68
+ If you want to directly contribute to the project, first clone the repo and install it as editable with developer dependencies:
69
+ ```
70
+ git clone https://github.com/empaeconversion/pyflowbatt.git
71
+
72
+ cd pyflowbatt
73
+
74
+ pip install -e .[dev]
75
+ ```
76
+ Then open this folder in an editor like VSCode.
77
+
78
+ You should always create a new branch before making edits, `main` is only for tested, working code that everyone can use.
79
+
80
+ E.g. make and switch to a new branch with
81
+ ```
82
+ git checkout -b new-feature
83
+ ```
84
+
85
+ You have now branched off the `main` PyFlowBatt into your own branch called e.g. `new-feature`. Now you can do whatever you like and it won't affect the `main` branch.
86
+
87
+ When you have made and committed some changes that add a feature or fix a problem, and you want to put them into `main`, open a *pull request* on GitHub.
@@ -0,0 +1 @@
1
+ """PyFlowBatt."""