Skip to content

Commit

Permalink
update pyproject and workflow to use pyproject2conda
Browse files Browse the repository at this point in the history
  • Loading branch information
glemieux committed Mar 13, 2024
1 parent 372673f commit 8112917
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8","3.9","3.10","3.11","3.12"]
python-version: ["3.8"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# show python version being tested
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
- name: Add conda to system path
run: |
python -m pip install --upgrade pip
pip install ".[test]"
- name: Run pytest
run: pytest
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install pyproject2conda
run: |
conda install pyproject2conda -y
- name: Convert pyproject to environment.yml
run: |
pyproject2conda yaml -e test --python-include python=${{ matrix.python-version }} > environment.yml
- name: Install dependencies from environment.yml
run: |
conda env update --file environment.yml --name base
rm environment.yml
- name: Test with pytest
run: |
pytest
18 changes: 13 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[project]
name = "landusedata"
version = "0.0.0"
requires-python = ">= 3.8"
authors = [
{ name = "Gregory Lemieux", email = "[email protected]" },
]
Expand All @@ -13,7 +14,18 @@ classifiers = [
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering"
]
dynamics = ["dependencies","optional-dependencies"]
dependencies = [
"xesmf", # p2c: -c conda-forge
"netcdf4", # p2c: -c conda-forge
]

[project.optional-dependencies]
test = [
"pytest", # p2c: -c conda-forge
]
lint = [
"flake8", # p2c: -c conda-forge
]

[project.readme]
file = "README.md"
Expand All @@ -29,10 +41,6 @@ package-dir = {"" = "src"}
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["requirements-test.txt"] }}

[tool.pytest.ini_options]
pythonpath = "src"
testpaths = "tests"
Expand Down
2 changes: 0 additions & 2 deletions requirements-test.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit 8112917

Please sign in to comment.