Skip to content

Commit

Permalink
137 setuptools is not installing requirements properly (#138)
Browse files Browse the repository at this point in the history
* shift from setuptools to poetry
* add poetry.lock
* remove python from env and manage by poetry instead
* windows pip test. ubuntu poetry test. auto version from init
* update README
  • Loading branch information
emlynjdavies committed Sep 25, 2023
1 parent ed228f4 commit 5a4fc50
Show file tree
Hide file tree
Showing 10 changed files with 4,317 additions and 190 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and test

on: [push, pull_request]

jobs:
Windows_pip:
runs-on: windows-latest
timeout-minutes: 60

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install pyopia
run: pip install ./

- name: Test
run: python -m pytest -v
Ubuntu_poetry:
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- name: Run the automated tests
run: poetry run pytest -v
27 changes: 0 additions & 27 deletions .github/workflows/windows-build-and-test.yml

This file was deleted.

23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,29 @@ cd pyopia-main

For the next steps, you need to be located in the directory that contains the file 'environment.yml'.

2. Create a virtual environment using the environment.yml (will create an environment called pyopia):
1. (optional, but recommended) Create a virtual environment using the environment.yml. This will create an environment called pyopia, but with no dependencies installed. Dependencies are managed by poetry (in step 2):

```bash
conda env create -f environment.yml
```

3. To update, we recommend a forced re-install:

```bash
conda env create -f environment.yml --force
```

(but you could also try this, which might be quicker but a less reliable form of updating):
and activate the environment:

```bash
conda env update --file environment.yml --prune
conda activate pyopia
```

4. To activate:
2. Install dependencies using poetry:

```bash
conda activate pyopia
poetry install
```

5. Test that it works with:
3. (optional) Run local tests:

```bash
python setup.py develop
poetry run pytest
```

Note that `pip install` or `python setup.py install` will probably cause you problems if you want to develop the code, and should only be used for deployment purposes.

----
# License

Expand Down
24 changes: 12 additions & 12 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
flake8
docopt
setuptools
pytest-error-for-skips
sphinx_rtd_theme>=0.5.0
sphinxcontrib-napoleon>=0.7
sphinx-togglebutton
sphinx-copybutton
readthedocs-sphinx-search
myst-nb
jupyter_book
ipykernel>=6.19.4
flake8
docopt
setuptools
pytest-error-for-skips
sphinx_rtd_theme>=0.5.0
sphinxcontrib-napoleon>=0.7
sphinx-togglebutton
sphinx-copybutton
readthedocs-sphinx-search
myst-nb
jupyter_book
ipykernel>=6.19.4
3 changes: 1 addition & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ name: pyopia
channels:
- conda-forge
dependencies:
- python=3.10
- pip
- poetry
4,209 changes: 4,209 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

51 changes: 49 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
[tool.poetry]
name = "pyopia"
version = "0"
description = "A Python Ocean Particle Image Analysis toolbox."
authors = ["Emlyn Davies <emlyn.davies@sintef.no>"]
readme = "README.md"
packages = [{include = "pyopia"}]

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
flake8 = "^6.1.0"
numpy = "^1.24.0"
pandas = {version = ">=2.1", extras = ["computation", "hdf5"]}
h5py = "^3.9.0"
scipy = "^1.11.2"
scikit-image = "^0.21.0"
pytest = ">=7.2.0"
imageio = "^2.31.3"
matplotlib = ">=3.7"
tqdm = "^4.66.1"
pytest-error-for-skips = "^2.0.2"
nbclient = "0.7"
sphinx = "5.0"
sphinx-rtd-theme = ">=0.5.0"
sphinxcontrib-napoleon = ">=0.7"
sphinx-togglebutton = "^0.3.2"
sphinx-copybutton = "^0.5.2"
readthedocs-sphinx-search = "^0.3.1"
myst-nb = "^0.17.2"
jupyter-book = "^0.15.1"
ipykernel = ">=6.19.4"
urllib3 = "<2.0"
gdown = "^4.7.1"
cmocean = "^3.0.3"
toml = "^0.10.2"
xarray = "^2023.8.0"
typer = {extras = ["all"], version = "^0.9.0"}
tensorflow-io-gcs-filesystem = "0.31.0"
tensorflow-cpu = "^2.13.0"

[tool.poetry-version-plugin]
source = "init"

[tool.poetry.scripts]
pyopia = "pyopia.cli:app"

[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.setuptools_scm]
29 changes: 0 additions & 29 deletions requirements.txt

This file was deleted.

17 changes: 0 additions & 17 deletions setup.cfg

This file was deleted.

85 changes: 0 additions & 85 deletions setup.py

This file was deleted.

0 comments on commit 5a4fc50

Please sign in to comment.