Skip to content

Commit

Permalink
pyproject.toml: add dynamic requirements from file (#71)
Browse files Browse the repository at this point in the history
* pyproject.toml: add dynamic requirements from file

close #70

* fix typo in comment

Co-authored-by: Zhang Yunjun <yunjunz@outlook.com>

* update install note for build-from-source

---------

Co-authored-by: Zhang Yunjun <yunjunz@outlook.com>
  • Loading branch information
scottstanie and yunjunz authored Aug 21, 2023
1 parent b62dae7 commit 8c9dca3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ git clone https://github.com/insarlab/PySolid.git

```bash
# option 1: use conda to install dependencies into an existing, activated environment
conda install -c conda-forge fortran-compiler --file PySolid/requirements.txt
conda install -c conda-forge fortran-compiler --file PySolid/requirements.txt --file PySolid/tests/requirements.txt

# option 2: use conda to install dependencies into a new environment, e.g. named "pysolid"
conda create --name pysolid fortran-compiler --file PySolid/requirements.txt
conda create --name pysolid fortran-compiler --file PySolid/requirements.txt --file PySolid/tests/requirements.txt
conda activate pysolid

# option 3: have a Fortran compiler already installed and use pip to install the rest dependencies
python -m pip install -r PySolid/requirements.txt
python -m pip install -r PySolid/requirements.txt -r PySolid/tests/requirements.txt
```

##### c. Install PySolid
Expand Down
22 changes: 16 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ readme = "README.md"
requires-python = ">=3.8"
keywords = ["solid Earth tides", "deformation", "geodesy", "geophysics"]
license = {text = "GPL-3.0-or-later"}
classifiers=[
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
]
dependencies = [
"numpy",
"scipy",
]
dynamic = ["version"]

# see section: setuptools_scm
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
# dependencies will be read from text files
dynamic = ["version", "dependencies", "optional-dependencies"]

[project.urls]
"Homepage" = "https://github.com/insarlab/PySolid"
Expand All @@ -35,6 +35,16 @@ dynamic = ["version"]
include-package-data = true
zip-safe = false

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }

# extra requirements: `pip install pysolid[docs]` or `pip install .[docs,test]`
# note: the [docs] syntax requires setuptools>=64.0, thus, not working yet.
[tool.setuptools.dynamic.optional-dependencies.docs]
file = ["docs/requirements.txt"]
[tool.setuptools.dynamic.optional-dependencies.test]
file = ["tests/requirements.txt"]

[tool.setuptools.packages.find]
where = ["src"]

Expand Down

0 comments on commit 8c9dca3

Please sign in to comment.