Skip to content

Commit b93a290

Browse files
committed
refactor(plot)!: put plotting behind a feature flag
1 parent 0c7d1a9 commit b93a290

File tree

6 files changed

+357
-328
lines changed

6 files changed

+357
-328
lines changed

README.md

+22-10
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,26 @@
55
[![GitHub stars](https://img.shields.io/github/stars/ritchie46/pygef.svg?logo=github&label=Stars&logoColor=white)](https://github.com/ritchie46/pygef)
66
[![Coverage Status](https://coveralls.io/repos/github/cemsbv/pygef/badge.svg?branch=master)](https://coveralls.io/github/cemsbv/pygef?branch=master)
77

8-
Simple parser for \*.gef files. These are ASCII based files used for soil properties measurements.
9-
Compatible with Python 3.9.
8+
Simple parser for \*.gef files. These are ASCII based files used for soil
9+
properties measurements. Compatible with Python 3.9.
1010

11-
Recently added the parsing of xml boreholes file, the xml parsing is still in a preliminary phase,
12-
not all the files are supported. If you find a file that doesn't work with pygef, please make an issue about it or PR :)
11+
Recently added the parsing of xml boreholes file, the xml parsing is still in a
12+
preliminary phase, not all the files are supported. If you find a file that
13+
doesn't work with pygef, please make an issue about it or PR :)
1314

1415
## Installation
1516

1617
Latest stable version:
1718

18-
`$ pip install pygef`
19+
```sh
20+
pip install pygef
21+
```
1922

2023
Cutting-edge version (might break):
2124

22-
`$ pip install git+https://github.com/cemsbv/pygef.git`
25+
```sh
26+
pip install git+https://github.com/cemsbv/pygef.git
27+
```
2328

2429
## CPT files
2530

@@ -116,11 +121,17 @@ tot630u ┆ 0.0, │
116121
│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ...
117122
│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ 0.0] │
118123
└────────────┴────────────┴────────────┴──────────┴────────────┴────────────┴────────────┴─────────┘
119-
120124
```
121125

122126
## Plotting
123127

128+
To use the plotting functionality pygef needs to be installed with the `[plot]`
129+
feature.
130+
131+
```sh
132+
pip install pygef[plot]
133+
```
134+
124135
```python
125136
from pygef import read_cpt, read_bore
126137
from pygef.plotting import plot_cpt, plot_bore
@@ -157,7 +168,8 @@ isort --settings-path "pyproject.toml" .
157168

158169
To maintain code quality we use the GitHub super-linter.
159170

160-
To run the linters locally, run the following bash script from the root directory:
171+
To run the linters locally, run the following bash script from the root
172+
directory:
161173

162174
```bash
163175
docker run \
@@ -195,11 +207,11 @@ coverage run -m pytest
195207
Requirements are autogenerated by `pip-compile` with python 3.9
196208

197209
```bash
198-
pip-compile --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
210+
pip-compile --extra=plot --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
199211
```
200212

201213
To update the requirements within the defined ranges, run:
202214

203215
```bash
204-
pip-compile --upgrade --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
216+
pip-compile --upgrade --extra=plot --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
205217
```

cemsdev.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[python.env]
2+
MODULES = "src"
3+
EXTRA_REQUIREMENTS = "docs --extra=plot --extra=lint --extra=map --extra=test"

pyproject.toml

+3-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ version = "0.11.0"
88
description = "Parse soil measurument data."
99
dependencies = [
1010
"polars>=1,<2",
11-
"matplotlib>=3.6,<4.0",
1211
"lxml>=5,<6.0",
1312
"gef-file-to-map>=0.2,<0.3",
1413
]
@@ -21,6 +20,9 @@ keywords = ["gef"]
2120
repository = "https://github.com/cemsbv/pygef"
2221

2322
[project.optional-dependencies]
23+
plot = [
24+
"matplotlib>=3.6,<4.0",
25+
]
2426
test = [
2527
"coveralls",
2628
"pytest"
@@ -62,13 +64,6 @@ warn_unused_ignores = true
6264
warn_unused_configs = true
6365
disallow_subclassing_any = true
6466
no_implicit_optional = true
65-
#disallow_untyped_defs = true
66-
#strict_concatenate = true
67-
#disallow_any_generics = true
68-
#disallow_untyped_calls = true
69-
#warn_return_any = true
70-
#no_implicit_reexport = true
71-
#strict_equality = true
7267

7368
[[tool.mypy.overrides]]
7469
module = [

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file was autogenerated by uv via the following command:
2-
# uv pip compile --extra=docs --extra=lint --extra=map --extra=test --output-file=requirements.txt pyproject.toml
2+
# uv pip compile --extra=plot --extra=docs --extra=lint --extra=map --extra=test --output-file=requirements.txt pyproject.toml
33
affine==2.4.0
44
# via rasterio
55
alabaster==1.0.0

src/pygef/gef/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
import re
55
from datetime import date
6-
from typing import Dict, List, Optional, Tuple, Union
6+
from typing import Dict, List, Tuple, Union, Optional
77

88
import numpy as np
99

0 commit comments

Comments
 (0)