Skip to content

Commit 477b99c

Browse files
authored
refactor: change dependency settup (#73)
* change dependency of geos-posp * Linting and typing fix * update timehistory dependency
1 parent fa4c4a2 commit 477b99c

File tree

8 files changed

+98
-135
lines changed

8 files changed

+98
-135
lines changed

README.md

Lines changed: 64 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -49,53 +49,53 @@ The following package defines [Paraview](https://docs.paraview.org/) plugins tha
4949
GEOS Python packages dependency tree (inter-dependency and main external dependencies) is the following:
5050

5151
```
52-
|-- geos-ats
53-
|-- pygeos-tools
54-
|-- geos-utils
55-
|-- geos-geomechanics
56-
| |-- geos-utils
57-
|
58-
|-- hdf5-wrapper
59-
| |-- h5py
60-
|
61-
|-- geos-xml-tools
62-
| |-- lxml
63-
|
64-
|-- geos-mesh
65-
| |-- geos-utils
66-
| |-- vtk
67-
|
68-
|-- geos-prep
69-
| |-- geos-mesh
70-
| |-- geos-xml-tools
71-
|
72-
|-- geos-posp
73-
| |-- geos-mesh
74-
| |-- geos-geomechanics
75-
|
76-
|-- time-history
77-
| |-- hdf5-wrapper
78-
|
79-
|-- mesh-doctor
80-
| |-- geos-prep
81-
| |-- pyvista
82-
|
83-
|-- geos-trame
84-
| |-- geos-xml-tools
85-
| |-- geos-mesh
86-
| |-- pyvista
87-
| |-- trame
88-
|
89-
|-- geos-xml-viewer
90-
| |-- geos-xml-tools
91-
| |-- geos-mesh
92-
| |-- pyvista
93-
|
94-
|-- geos-pv
95-
|-- geos-prep
96-
|-- geos-posp
97-
|-- geos-xml-tools
98-
|-- paraview
52+
├── geos-ats
53+
├── pygeos-tools
54+
├── geos-utils
55+
├── geos-geomechanics
56+
├── geos-utils
57+
58+
├── hdf5-wrapper
59+
├── h5py
60+
61+
├── geos-xml-tools
62+
├── lxml
63+
64+
├── geos-mesh
65+
├── geos-utils
66+
├── vtk
67+
68+
├── geos-prep
69+
├── geos-mesh
70+
├── geos-xml-tools
71+
72+
├── geos-posp
73+
├── geos-mesh
74+
├── geos-geomechanics
75+
76+
├── time-history
77+
├── hdf5-wrapper
78+
79+
├── mesh-doctor
80+
├── geos-prep
81+
├── pyvista
82+
83+
├── geos-trame
84+
├── geos-xml-tools
85+
├── geos-mesh
86+
├── pyvista
87+
├── trame
88+
89+
├── geos-xml-viewer
90+
├── geos-xml-tools
91+
├── geos-mesh
92+
├── pyvista
93+
94+
├── geos-pv
95+
├── geos-prep
96+
├── geos-posp
97+
├── geos-xml-tools
98+
├── paraview
9999
```
100100

101101
See the [documentation](https://geosx-geosx.readthedocs-hosted.com/projects/geosx-geospythonpackages/en/latest/) for additional details about the packages and how to use them.
@@ -149,43 +149,26 @@ If you do not have the rights to push the code and open new PRs, consider openin
149149
Any new package must have the following architecture:
150150
151151
```
152-
package-name
153-
|-- pyproject.toml
154-
|-- setup.py
155-
|-- src
156-
| |-- geos
157-
| |-- package_name
158-
| |-- file1.py
159-
| |-- file1.py
160-
|-- tests
161-
|-- test1.py
162-
|-- test2.py
152+
package-name/
153+
├── pyproject.toml
154+
├── src
155+
│ ├── geos
156+
│ ├── package_name
157+
│ ├── file1.py
158+
│ ├── file1.py
159+
├── tests
160+
├── test1.py
161+
├── test2.py
163162
```
164163
165-
The *setup.py* file is optional. It is required if the package depends on another GEOS Python package located in the root directory. If you want a package1 to depend on package2, follow this [procedure](https://stackoverflow.com/questions/75159453/specifying-local-relative-dependency-in-pyproject-toml):
166-
167-
* in the *package1/pyproject.py*, replace the tag `dependencies = ["external_packageX", "external_packageY",]` with `dynamic = ["dependencies"]`
168-
* create the *package1/setup.py* file
169-
* copy the following lines in the *setup.py* and update the dependencies
170-
```
171-
from pathlib import Path
172-
from setuptools import setup
173-
174-
# This is where you add any fancy path resolution to the local lib:
175-
package_name = "geos-utils"
176-
geos_utils_path: str = (Path(__file__).parent.parent / package_name).as_uri()
177-
178-
setup(
179-
install_requires=[
180-
"vtk >= 9.3",
181-
"numpy >= 1.26",
182-
"pandas >= 2.2",
183-
"typing_extensions >= 4.12",
184-
f"{package_name} @ {geos_utils_path}",
185-
]
186-
)
187-
```
164+
If you want a package to depend on another GEOS Python package (let's say `geos-utils`), in the pyproject.toml the dependency takes the form:
188165
166+
```
167+
dependencies = [
168+
...
169+
"geos-utils @ file:./geos-utils",
170+
]
171+
```
189172
190173
Release
191174
-------

geos-geomechanics/pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ classifiers = [
2121
"Development Status :: 4 - Beta",
2222
"Programming Language :: Python"
2323
]
24-
dynamic = ["dependencies"]
24+
dependencies=[
25+
"vtk >= 9.3",
26+
"numpy >= 1.26",
27+
"pandas >= 2.2",
28+
"typing_extensions >= 4.12",
29+
"geos-utils @ file:./geos-utils",
30+
]
2531
requires-python = ">= 3.10"
2632

2733
[project.optional-dependencies]

geos-geomechanics/setup.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

geos-geomechanics/src/geos/geomechanics/processing/geomechanicsCalculatorFunctions.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def specificGravity( density: npt.NDArray[ np.float64 ], specificDensity: float
3131

3232
if abs( specificDensity ) < EPSILON:
3333
return np.full_like( density, np.nan )
34-
return ( density / specificDensity ).astype( np.float64 )
34+
35+
return ( density / specificDensity ).astype( float )
3536

3637

3738
# https://en.wikipedia.org/wiki/Elastic_modulus
@@ -626,7 +627,7 @@ def criticalPorePressure(
626627
stressVector: npt.NDArray[ np.float64 ],
627628
rockCohesion: float,
628629
frictionAngle: float = 0.0,
629-
) -> npt.NDArray[ np.float64 ]:
630+
) -> npt.NDArray[ np.floating[ Any ] ]:
630631
r"""Compute the critical pore pressure.
631632
632633
Fracturing can occur in areas where Critical pore pressure is greater than
@@ -665,9 +666,10 @@ def criticalPorePressure(
665666
maximumPrincipalStress[ i ] = p1
666667

667668
# assertion frictionAngle < np.pi/2., so sin(frictionAngle) != 1
668-
cohesiveTerm: npt.NDArray[ np.float64 ] = ( rockCohesion * np.cos( frictionAngle ) /
669-
( 1 - np.sin( frictionAngle ) ) )
670-
residualTerm: npt.NDArray[ np.floating[ Any ] ] = ( 3 * minimumPrincipalStress - maximumPrincipalStress ) / 2.0
669+
cohesiveTerm: npt.NDArray[ np.floating[ Any ] ] = ( rockCohesion * np.cos( frictionAngle ) /
670+
( 1.0 - np.sin( frictionAngle ) ) )
671+
residualTerm: npt.NDArray[ np.floating[ Any ] ] = ( 3.0 * minimumPrincipalStress - maximumPrincipalStress ) / 2.0
672+
671673
return cohesiveTerm + residualTerm
672674

673675

@@ -852,14 +854,14 @@ def shearCapacityUtilization( traction: npt.NDArray[ np.float64 ], rockCohesion:
852854
for i in range( traction.shape[ 0 ] ):
853855
tractionVec: npt.NDArray[ np.float64 ] = traction[ i ]
854856
# use -1 to agree with Geos convention (i.e., compression with negative stress)
855-
stressNormal: npt.NDArray[ np.float64 ] = -1.0 * tractionVec[ 0 ]
857+
stressNormal: float = -1.0 * tractionVec[ 0 ]
856858

857859
# compute failure envelope
858860
mohrCoulomb: MohrCoulomb = MohrCoulomb( rockCohesion, frictionAngle )
859861
tauFailure: float = float( mohrCoulomb.computeShearStress( stressNormal ) )
860862
scu_i: float = np.nan
861863
if tauFailure > 0:
862-
scu_i = np.abs( tractionVec[ 1 ] ) / tauFailure
864+
scu_i = abs( tractionVec[ 1 ] ) / tauFailure
863865
# compute SCU
864866
scu[ i ] = scu_i
865867
return scu

geos-posp/pyproject.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,18 @@ keywords = [
2929
"GEOS",
3030
"Simulation",
3131
]
32-
dynamic = ["dependencies"]
33-
requires-python = ">= 3.9"
32+
33+
requires-python = ">= 3.10"
34+
35+
dependencies = [
36+
"vtk >= 9.3",
37+
"numpy >= 1.26",
38+
"pandas >= 2.2",
39+
"typing_extensions >= 4.12",
40+
"geos-utils @ file:./geos-utils",
41+
"geos-geomechanics @ file:./geos-geomechanics",
42+
]
43+
3444

3545
[project.urls]
3646
Homepage = "https://github.com/GEOS-DEV/geosPythonPackages"

geos-posp/setup.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

geos-timehistory/pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ classifiers = [
1717
]
1818

1919
requires-python = ">=3.9"
20-
dynamic = ["dependencies"]
20+
dependencies = [
21+
"matplotlib",
22+
"h5py",
23+
"numpy",
24+
"hdf5-wrapper @ file:./hdf5-wrapper",
25+
]
2126

2227
[project.scripts]
2328
plot-timehistory = "geos.timehistory.plot:main"

geos-timehistory/setup.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)