diff --git a/.bumpversion.toml b/.bumpversion.toml index 6fd35de4..47fa2e96 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "1.4.2-dev0" +current_version = "1.4.2" parse = """(?x) (?P0|[1-9]\\d*)\\. @@ -38,4 +38,4 @@ commit_args = "" filename = "pyproject.toml" [[tool.bumpversion.files]] -filename = "deepforest/_version.py" +filename = "src/deepforest/_version.py" diff --git a/.github/workflows/Conda-app.yml b/.github/workflows/Conda-app.yml index 01733d8d..a168b538 100644 --- a/.github/workflows/Conda-app.yml +++ b/.github/workflows/Conda-app.yml @@ -46,11 +46,14 @@ jobs: cache-environment: true cache-downloads: true + - name: Install package + run: pip install . -U + - name: Run pytest run: pytest -v - name: Check style - run: yapf -d --recursive deepforest/ --style=.style.yapf + run: yapf -d --recursive src/deepforest/ --style=.style.yapf - name: Check notebook style run: nbqa yapf --in-place docs/user_guide/examples/*.ipynb --style=.style.yapf @@ -59,7 +62,7 @@ jobs: run: pytest --nbmake docs/**/*_test.ipynb - name: Run docformatter - run: docformatter --check --recursive deepforest/ + run: docformatter --check --recursive src/deepforest/ - name: Test Docs run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 87b411a0..63ed3d0f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: - id: yapf name: yapf entry: yapf - args: ['-i', '--style', '.style.yapf', '--recursive', 'deepforest/'] + args: ['-i', '--style', '.style.yapf', '--recursive', 'src/deepforest/'] language: system types: [python] pass_filenames: false @@ -16,7 +16,7 @@ repos: entry: docformatter language: python types: [python] - args: ['--in-place', '--recursive','deepforest/'] + args: ['--in-place', '--recursive','src/deepforest/'] pass_filenames: false stages: [commit] diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a9051b78..491ac132 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -86,7 +86,7 @@ You can also run yapf from the command line to cleanup the style in your changes .. code-block:: bash - yapf -i --recursive deepforest/ --style=.style.yapf + yapf -i --recursive src/deepforest/ --style=.style.yapf If the style tests fail on a pull request, running the above command is the easiest way to fix this. @@ -128,7 +128,7 @@ We use `Docformatter `_ for formatting a .. code-block:: bash - $ docformatter --in-place --recursive deepforest/ + $ docformatter --in-place --recursive src/deepforest/ Update Documentation ^^^^^^^^^^^^^^^^^^^^ diff --git a/HISTORY.rst b/HISTORY.rst index a1a0fb2b..fd6a3ad2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,9 +2,14 @@ DeepForest Changelog ==================== -Version 1.4.0 (Date: Oct 9, 2024) +Version 1.4.1 (Date: Oct 26, 2024) ---------------------------------- +- **Enhancement:** Use GitHub Actions to publish the package. + +Version 1.4.0 (Date: Oct 9, 2024) +--------------------------------- + The major innovations are 1. New model loading framework using HuggingFace. DeepForest models are now available on https://huggingface.co/weecology. The models can be loaded using load_model() and used for inference. diff --git a/MANIFEST.in b/MANIFEST.in index a7bc07d2..e63805b6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,17 +1,17 @@ -include deepforest/data/deepforest_config.yml -include deepforest/data/testfile_deepforest.csv -include deepforest/data/testfile_multi.csv -include deepforest/data/classes.csv -include deepforest/data/OSBS_029* -include deepforest/data/SOAP_031* -include deepforest/data/SOAP_061* -include deepforest/data/2019_YELL_2_541000_4977000_image_crop.xml -include deepforest/data/2019_YELL_2_541000_4977000_image_crop.png -include deepforest/data/2019_YELL_2_528000_4978000_image_crop2.xml -include deepforest/data/2019_YELL_2_528000_4978000_image_crop2.png -include deepforest/data/AWPE* -include deepforest/data/example.csv -include deepforest/data/test_tiled.tif + +include src/deepforest/data/deepforest_config.yml +include src/deepforest/data/testfile_deepforest.csv +include src/deepforest/data/testfile_multi.csv +include src/deepforest/data/classes.csv +include src/deepforest/data/OSBS_029* +include src/deepforest/data/SOAP_031* +include src/deepforest/data/SOAP_061* +include src/deepforest/data/2019_YELL_2_541000_4977000_image_crop.xml +include src/deepforest/data/2019_YELL_2_541000_4977000_image_crop.png +include src/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.xml +include src/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.png +include src/deepforest/data/AWPE* +include src/deepforest/data/example.csv include LICENSE include dev_requirements.txt diff --git a/README.md b/README.md index f9e659e2..2b8d17b7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Version](https://img.shields.io/pypi/v/DeepForest.svg)](https://pypi.python.org/pypi/DeepForest) [![PyPI - Downloads](https://img.shields.io/pypi/dm/deepforest)](https://pypi.python.org/pypi/DeepForest) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2538143.svg)](https://doi.org/10.5281/zenodo.2538143) -[![Python Version](https://img.shields.io/badge/python-%3E%3D3.5%2C%20%3C3.13-blue.svg)](https://www.python.org/downloads/) +[![Python Version](https://img.shields.io/badge/python-%3E%3D3.8%2C%20%3C3.13-blue.svg)](https://www.python.org/downloads/) ### Conda-forge build status diff --git a/pyproject.toml b/pyproject.toml index 85791ec4..a60736a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ requires = [ [project] name = "deepforest" -version = "1.4.2-dev0" +version = "1.4.2" description = "Tree crown prediction using deep learning retinanets" readme = "README.md" license = { text = "MIT" } @@ -73,6 +73,6 @@ dependencies = [ "tqdm", "xmltodict", ] -[tool.setuptools] -packages = ["deepforest"] -include-package-data = true + +[tool.setuptools.packages.find] +where = ["src"] diff --git a/deepforest/IoU.py b/src/deepforest/IoU.py similarity index 100% rename from deepforest/IoU.py rename to src/deepforest/IoU.py diff --git a/deepforest/__init__.py b/src/deepforest/__init__.py similarity index 100% rename from deepforest/__init__.py rename to src/deepforest/__init__.py diff --git a/deepforest/_version.py b/src/deepforest/_version.py similarity index 57% rename from deepforest/_version.py rename to src/deepforest/_version.py index 6b1b1a24..7a7a5713 100644 --- a/deepforest/_version.py +++ b/src/deepforest/_version.py @@ -1,2 +1,2 @@ -__version__ = '1.4.2-dev0' +__version__ = '1.4.2' # Version updated using bump-my-version diff --git a/deepforest/callbacks.py b/src/deepforest/callbacks.py similarity index 100% rename from deepforest/callbacks.py rename to src/deepforest/callbacks.py diff --git a/deepforest/data/2018_SJER_3_252000_4107000_image_477.csv b/src/deepforest/data/2018_SJER_3_252000_4107000_image_477.csv similarity index 100% rename from deepforest/data/2018_SJER_3_252000_4107000_image_477.csv rename to src/deepforest/data/2018_SJER_3_252000_4107000_image_477.csv diff --git a/deepforest/data/2018_SJER_3_252000_4107000_image_477.tif b/src/deepforest/data/2018_SJER_3_252000_4107000_image_477.tif similarity index 100% rename from deepforest/data/2018_SJER_3_252000_4107000_image_477.tif rename to src/deepforest/data/2018_SJER_3_252000_4107000_image_477.tif diff --git a/deepforest/data/2018_SJER_3_252000_4107000_image_477_truth.csv b/src/deepforest/data/2018_SJER_3_252000_4107000_image_477_truth.csv similarity index 100% rename from deepforest/data/2018_SJER_3_252000_4107000_image_477_truth.csv rename to src/deepforest/data/2018_SJER_3_252000_4107000_image_477_truth.csv diff --git a/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.png b/src/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.png similarity index 100% rename from deepforest/data/2019_YELL_2_528000_4978000_image_crop2.png rename to src/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.png diff --git a/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.xml b/src/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.xml similarity index 100% rename from deepforest/data/2019_YELL_2_528000_4978000_image_crop2.xml rename to src/deepforest/data/2019_YELL_2_528000_4978000_image_crop2.xml diff --git a/deepforest/data/2019_YELL_2_541000_4977000_image_crop.png b/src/deepforest/data/2019_YELL_2_541000_4977000_image_crop.png similarity index 100% rename from deepforest/data/2019_YELL_2_541000_4977000_image_crop.png rename to src/deepforest/data/2019_YELL_2_541000_4977000_image_crop.png diff --git a/deepforest/data/2019_YELL_2_541000_4977000_image_crop.xml b/src/deepforest/data/2019_YELL_2_541000_4977000_image_crop.xml similarity index 100% rename from deepforest/data/2019_YELL_2_541000_4977000_image_crop.xml rename to src/deepforest/data/2019_YELL_2_541000_4977000_image_crop.xml diff --git a/deepforest/data/AWPE Pigeon Lake 2020 DJI_0005.JPG b/src/deepforest/data/AWPE Pigeon Lake 2020 DJI_0005.JPG similarity index 100% rename from deepforest/data/AWPE Pigeon Lake 2020 DJI_0005.JPG rename to src/deepforest/data/AWPE Pigeon Lake 2020 DJI_0005.JPG diff --git a/deepforest/data/OSBS_029.csv b/src/deepforest/data/OSBS_029.csv similarity index 100% rename from deepforest/data/OSBS_029.csv rename to src/deepforest/data/OSBS_029.csv diff --git a/deepforest/data/OSBS_029.png b/src/deepforest/data/OSBS_029.png similarity index 100% rename from deepforest/data/OSBS_029.png rename to src/deepforest/data/OSBS_029.png diff --git a/deepforest/data/OSBS_029.tif b/src/deepforest/data/OSBS_029.tif similarity index 100% rename from deepforest/data/OSBS_029.tif rename to src/deepforest/data/OSBS_029.tif diff --git a/deepforest/data/OSBS_029.xml b/src/deepforest/data/OSBS_029.xml similarity index 100% rename from deepforest/data/OSBS_029.xml rename to src/deepforest/data/OSBS_029.xml diff --git a/deepforest/data/SOAP_031.png b/src/deepforest/data/SOAP_031.png similarity index 100% rename from deepforest/data/SOAP_031.png rename to src/deepforest/data/SOAP_031.png diff --git a/deepforest/data/SOAP_061.png b/src/deepforest/data/SOAP_061.png similarity index 100% rename from deepforest/data/SOAP_061.png rename to src/deepforest/data/SOAP_061.png diff --git a/deepforest/data/SOAP_061.xml b/src/deepforest/data/SOAP_061.xml similarity index 100% rename from deepforest/data/SOAP_061.xml rename to src/deepforest/data/SOAP_061.xml diff --git a/deepforest/data/__init__.py b/src/deepforest/data/__init__.py similarity index 100% rename from deepforest/data/__init__.py rename to src/deepforest/data/__init__.py diff --git a/deepforest/data/australia.cpg b/src/deepforest/data/australia.cpg similarity index 100% rename from deepforest/data/australia.cpg rename to src/deepforest/data/australia.cpg diff --git a/deepforest/data/australia.dbf b/src/deepforest/data/australia.dbf similarity index 100% rename from deepforest/data/australia.dbf rename to src/deepforest/data/australia.dbf diff --git a/deepforest/data/australia.prj b/src/deepforest/data/australia.prj similarity index 100% rename from deepforest/data/australia.prj rename to src/deepforest/data/australia.prj diff --git a/deepforest/data/australia.shp b/src/deepforest/data/australia.shp similarity index 100% rename from deepforest/data/australia.shp rename to src/deepforest/data/australia.shp diff --git a/deepforest/data/australia.shx b/src/deepforest/data/australia.shx similarity index 100% rename from deepforest/data/australia.shx rename to src/deepforest/data/australia.shx diff --git a/deepforest/data/australia.tif b/src/deepforest/data/australia.tif similarity index 100% rename from deepforest/data/australia.tif rename to src/deepforest/data/australia.tif diff --git a/deepforest/data/classes.csv b/src/deepforest/data/classes.csv similarity index 100% rename from deepforest/data/classes.csv rename to src/deepforest/data/classes.csv diff --git a/deepforest/data/deepforest_config.yml b/src/deepforest/data/deepforest_config.yml similarity index 100% rename from deepforest/data/deepforest_config.yml rename to src/deepforest/data/deepforest_config.yml diff --git a/deepforest/data/example.csv b/src/deepforest/data/example.csv similarity index 100% rename from deepforest/data/example.csv rename to src/deepforest/data/example.csv diff --git a/deepforest/data/test_tiled.tif b/src/deepforest/data/test_tiled.tif similarity index 100% rename from deepforest/data/test_tiled.tif rename to src/deepforest/data/test_tiled.tif diff --git a/deepforest/data/testfile_deepforest.csv b/src/deepforest/data/testfile_deepforest.csv similarity index 100% rename from deepforest/data/testfile_deepforest.csv rename to src/deepforest/data/testfile_deepforest.csv diff --git a/deepforest/data/testfile_multi.csv b/src/deepforest/data/testfile_multi.csv similarity index 100% rename from deepforest/data/testfile_multi.csv rename to src/deepforest/data/testfile_multi.csv diff --git a/deepforest/dataset.py b/src/deepforest/dataset.py similarity index 100% rename from deepforest/dataset.py rename to src/deepforest/dataset.py diff --git a/deepforest/download.py b/src/deepforest/download.py similarity index 100% rename from deepforest/download.py rename to src/deepforest/download.py diff --git a/deepforest/evaluate.py b/src/deepforest/evaluate.py similarity index 100% rename from deepforest/evaluate.py rename to src/deepforest/evaluate.py diff --git a/deepforest/main.py b/src/deepforest/main.py similarity index 100% rename from deepforest/main.py rename to src/deepforest/main.py diff --git a/deepforest/model.py b/src/deepforest/model.py similarity index 100% rename from deepforest/model.py rename to src/deepforest/model.py diff --git a/deepforest/models/FasterRCNN.py b/src/deepforest/models/FasterRCNN.py similarity index 100% rename from deepforest/models/FasterRCNN.py rename to src/deepforest/models/FasterRCNN.py diff --git a/deepforest/models/__init__.py b/src/deepforest/models/__init__.py similarity index 100% rename from deepforest/models/__init__.py rename to src/deepforest/models/__init__.py diff --git a/deepforest/models/retinanet.py b/src/deepforest/models/retinanet.py similarity index 100% rename from deepforest/models/retinanet.py rename to src/deepforest/models/retinanet.py diff --git a/deepforest/predict.py b/src/deepforest/predict.py similarity index 99% rename from deepforest/predict.py rename to src/deepforest/predict.py index ef82e2b8..362262a9 100644 --- a/deepforest/predict.py +++ b/src/deepforest/predict.py @@ -1,5 +1,4 @@ # Prediction utilities -import cv2 import pandas as pd import numpy as np import os diff --git a/deepforest/preprocess.py b/src/deepforest/preprocess.py similarity index 99% rename from deepforest/preprocess.py rename to src/deepforest/preprocess.py index 02502e12..6673c71f 100644 --- a/deepforest/preprocess.py +++ b/src/deepforest/preprocess.py @@ -13,8 +13,6 @@ import warnings import rasterio import geopandas as gpd -from shapely import geometry -import geopandas as gpd from deepforest.utilities import read_file, determine_geometry_type from shapely import geometry diff --git a/deepforest/utilities.py b/src/deepforest/utilities.py similarity index 100% rename from deepforest/utilities.py rename to src/deepforest/utilities.py diff --git a/deepforest/visualize.py b/src/deepforest/visualize.py similarity index 100% rename from deepforest/visualize.py rename to src/deepforest/visualize.py diff --git a/tests/conftest.py b/tests/conftest.py index e385cd5d..30681513 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,8 @@ # Fixtures model to only download model once # download latest release import pytest -from deepforest import utilities, main +from deepforest import main +from deepforest import utilities from deepforest import get_data from deepforest import _ROOT import os @@ -12,8 +13,7 @@ @pytest.fixture(scope="session") def config(): - config = utilities.read_config("{}/deepforest_config.yml".format( - os.path.dirname(_ROOT))) + config = utilities.read_config(get_data("deepforest_config.yml")) config["fast_dev_run"] = True config["batch_size"] = True return config diff --git a/tests/test_data.py b/tests/test_data.py index 056bf7d5..e4ae4cbf 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -16,8 +16,3 @@ def test_get_data(): assert os.path.exists(deepforest.get_data("classes.csv")) -# Assert that the included config file matches the front of the repo. -def test_matching_config(ROOT): - config = read_config("{}/deepforest_config.yml".format(os.path.dirname(ROOT))) - config_from_data_dir = read_config("{}/data/deepforest_config.yml".format(ROOT)) - assert config == config_from_data_dir diff --git a/tests/test_utilities.py b/tests/test_utilities.py index de16f599..e1658812 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -10,7 +10,8 @@ import geopandas as gpd from deepforest import get_data -from deepforest import utilities, visualize +from deepforest import visualize +from deepforest import utilities from deepforest import main # import general model fixture