From 889b6de203ab298e62925817f2b95a9246cf86a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 19:52:32 +0000 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=9B=91=F0=9F=A7=AA=20Fail=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_cli.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 558977c..874074f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,4 @@ +import warnings import pandas as pd from typer.testing import CliRunner from population_trend import ( @@ -14,7 +15,7 @@ island = "Guadalupe" output_path = "tests/data/laal_guadalupe.csv" intervals_path = "tests/data/gumu_guadalupe_boostrap_intervals.json" -output_figure = "tests/data/figure.png" +data_path_for_trend = "tests/data/gumu_guadalupe_data.csv" def test_app_plot_growth_rate(): @@ -52,6 +53,13 @@ def test_app_plot_population_trend(): assert "XX" not in result.stdout assert "[default: Guadalupe]" in result.stdout assert "[default: Maxima_cantidad_nidos]" in result.stdout + assert result.exit_code == 0 + assert ( + "DEPRECATED" in result.stdout + ), f"Expected 'DEPRECATED' in help text. Got: {result.stdout}" + assert ( + "render-population-trend" in result.stdout + ), f"Expected new command name in help text. Got: {result.stdout}" data_path = "tests/data/gumu_guadalupe_data.csv" output_figure = "tests/data/plot_trend.png" @@ -220,3 +228,33 @@ def test_write_burrows_by_species_and_island(): obtained_columns = len(obtained_csv.columns) expected_columns = 12 assert obtained_columns == expected_columns + + +def test_render_population_trend_new_command_works(): + output_figure_render = "tests/data/render_trend.png" + gtt.if_exist_remove(output_figure_render) + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + result = runner.invoke( + app, + [ + "render-population-trend", + "--data-path", + data_path_for_trend, + "--intervals-path", + intervals_path, + "--island", + "Guadalupe", + "--variable-of-interest", + "Maxima_cantidad_nidos", + "--tick-mode", + "sparse", + "--output-path", + output_figure_render, + ], + ) + + assert result.exit_code == 0 + gtt.assert_exist(output_figure_render) + gtt.if_exist_remove(output_figure_render) From 41c509b7bd15d0f2a8ca1cc4cdb69e7323ed95eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 19:53:22 +0000 Subject: [PATCH 2/8] =?UTF-8?q?=E2=9C=85=20Pass=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/cli.py | 60 +++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/population_trend/cli.py b/population_trend/cli.py index 28d80b6..ac0cb77 100644 --- a/population_trend/cli.py +++ b/population_trend/cli.py @@ -23,6 +23,7 @@ import typer import json import matplotlib.pyplot as plt +import warnings app = typer.Typer(help="Write filtered burrows data by species and island") @@ -62,15 +63,15 @@ def write_burrows_by_species_and_island( filtered.to_csv(output_path, index=False) -@app.command(help="Plot population trend") -def plot_population_trend( - data_path: Annotated[str, typer.Option()], - intervals_path: Annotated[str, typer.Option()], - island: Annotated[str, typer.Option()] = "Guadalupe", - variable_of_interest: Annotated[str, typer.Option()] = "Maxima_cantidad_nidos", - tick_mode: Annotated[str, typer.Option()] = "full", - output_path: Annotated[str, typer.Option()] = "", +def _render_population_trend( + data_path: str, + intervals_path: str, + island: str = "Guadalupe", + variable_of_interest: str = "Maxima_cantidad_nidos", + tick_mode: str = "full", + output_path: str = "", ): + """Shared implementation for rendering population trend plots.""" fit_data = pd.read_csv(data_path) intervals_json = read_json(intervals_path) lambda_latex = intervals_json["lambda_latex_interval"] @@ -87,6 +88,49 @@ def plot_population_trend( Graficador.savefig(island, output_path) +@app.command(name="render-population-trend", help="Plot population trend") +def render_population_trend( + data_path: Annotated[str, typer.Option()], + intervals_path: Annotated[str, typer.Option()], + island: Annotated[str, typer.Option()] = "Guadalupe", + variable_of_interest: Annotated[str, typer.Option()] = "Maxima_cantidad_nidos", + tick_mode: Annotated[str, typer.Option()] = "full", + output_path: Annotated[str, typer.Option()] = "", +): + _render_population_trend( + data_path, intervals_path, island, variable_of_interest, tick_mode, output_path + ) + + +@app.command(help="(DEPRECATED) Plot population trend. Use 'render-population-trend' instead.") +def plot_population_trend( + data_path: Annotated[str, typer.Option()], + intervals_path: Annotated[str, typer.Option()], + island: Annotated[str, typer.Option()] = "Guadalupe", + variable_of_interest: Annotated[str, typer.Option()] = "Maxima_cantidad_nidos", + tick_mode: Annotated[str, typer.Option()] = "full", + output_path: Annotated[str, typer.Option()] = "", +): + """(DEPRECATED) Plot population trend. Use 'render-population-trend' instead.""" + typer.secho( + "WARNING: 'plot-population-trend' is deprecated and will be removed in v2.0.0. " + "Use 'render-population-trend' instead.", + fg=typer.colors.YELLOW, + err=True, + ) + + warnings.warn( + "'plot-population-trend' is deprecated, use 'render-population-trend' instead. " + "This command will be removed in v2.0.0.", + DeprecationWarning, + stacklevel=2, + ) + + _render_population_trend( + data_path, intervals_path, island, variable_of_interest, tick_mode, output_path + ) + + @app.command(help="Plot population trend from CPUE") def plot_population_trend_from_cpue( data_path: Annotated[str, typer.Option()], From 1311af0038b316874a901f69f213dbb239c61bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 19:59:26 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=92=AB=F0=9F=94=8A=20update=20CHANGEL?= =?UTF-8?q?OG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ population_trend/cli.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc5441..d5549aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- New CLI command `render-population-trend` with identical behavior to `plot-population-trend`. ### Fixed ### Changed +### Deprecated +- CLI command `plot-population-trend` is deprecated in favor of `render-population-trend`. The old command will remain functional and will be removed in v6.0.0. Users should update their scripts and automation to use `render-population-trend` instead. + ### Removed ## [5.10.2] - 2026-02-05 diff --git a/population_trend/cli.py b/population_trend/cli.py index ac0cb77..240117d 100644 --- a/population_trend/cli.py +++ b/population_trend/cli.py @@ -113,7 +113,7 @@ def plot_population_trend( ): """(DEPRECATED) Plot population trend. Use 'render-population-trend' instead.""" typer.secho( - "WARNING: 'plot-population-trend' is deprecated and will be removed in v2.0.0. " + "WARNING: 'plot-population-trend' is deprecated and will be removed in v6.0.0. " "Use 'render-population-trend' instead.", fg=typer.colors.YELLOW, err=True, @@ -121,7 +121,7 @@ def plot_population_trend( warnings.warn( "'plot-population-trend' is deprecated, use 'render-population-trend' instead. " - "This command will be removed in v2.0.0.", + "This command will be removed in v6.0.0.", DeprecationWarning, stacklevel=2, ) From 9aefe00c5dd879f1be92f1b8eee9d7d0530ad852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 20:00:02 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/cli.py | 5 ++++- tests/test_cli.py | 39 ++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/population_trend/cli.py b/population_trend/cli.py index 240117d..2f6fca4 100644 --- a/population_trend/cli.py +++ b/population_trend/cli.py @@ -102,7 +102,10 @@ def render_population_trend( ) -@app.command(help="(DEPRECATED) Plot population trend. Use 'render-population-trend' instead.") +@app.command( + help="(DEPRECATED) Plot population trend. Use 'render-population-trend' instead.", + deprecated=True, +) def plot_population_trend( data_path: Annotated[str, typer.Option()], intervals_path: Annotated[str, typer.Option()], diff --git a/tests/test_cli.py b/tests/test_cli.py index 874074f..16d6ad0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,3 @@ -import warnings import pandas as pd from typer.testing import CliRunner from population_trend import ( @@ -234,26 +233,24 @@ def test_render_population_trend_new_command_works(): output_figure_render = "tests/data/render_trend.png" gtt.if_exist_remove(output_figure_render) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - result = runner.invoke( - app, - [ - "render-population-trend", - "--data-path", - data_path_for_trend, - "--intervals-path", - intervals_path, - "--island", - "Guadalupe", - "--variable-of-interest", - "Maxima_cantidad_nidos", - "--tick-mode", - "sparse", - "--output-path", - output_figure_render, - ], - ) + result = runner.invoke( + app, + [ + "render-population-trend", + "--data-path", + data_path_for_trend, + "--intervals-path", + intervals_path, + "--island", + "Guadalupe", + "--variable-of-interest", + "Maxima_cantidad_nidos", + "--tick-mode", + "sparse", + "--output-path", + output_figure_render, + ], + ) assert result.exit_code == 0 gtt.assert_exist(output_figure_render) From a9d35514a218ef5e26629f1f444c830274e609ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 20:23:35 +0000 Subject: [PATCH 5/8] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/population_growth_model.py | 5 +++-- tests/test_Population_trend.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/population_trend/population_growth_model.py b/population_trend/population_growth_model.py index 9a617a8..fc6df94 100644 --- a/population_trend/population_growth_model.py +++ b/population_trend/population_growth_model.py @@ -147,8 +147,9 @@ def set_x_lim(self): ) def set_labels(self): - plt.ylabel("Number of breeding pairs", size=20) - plt.xlabel("Seasons", size=20) + labels = {"english": {"ylabel": "Number of breeding pairs", "xlabel": "Seasons"}} + plt.ylabel(labels["english"]["ylabel"], size=20) + plt.xlabel(labels["english"]["xlabel"], size=20) def set_ticks(self): self.get_tick_step() diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index 00e6a79..b8d5f0a 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -52,7 +52,6 @@ def tests_calculate_upper_limit(): {"intervals": [], "bootstrap_intermediate_distribution": []}, "Maxima_cantidad_nidos", ) -Plotter = Plotter_Population_Trend_Model(cormorant_data_for_plotter, pop_model, tick_mode="full") more_cormorant_data = pd.DataFrame( @@ -62,6 +61,10 @@ def tests_calculate_upper_limit(): class Tests_Plotter_Population_Trend_Model: + Plotter = Plotter_Population_Trend_Model( + cormorant_data_for_plotter, pop_model, tick_mode="full" + ) + def tests_init_(self): fig, ax = geci_plot() assert type(fig) == type(Plotter.fig) # noqa From 606f9760fc74b74a9546b20178a1bcced4314ce8 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Thu, 7 May 2026 14:59:18 -0700 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=91=A9=F0=9F=8F=BE=E2=80=8D?= =?UTF-8?q?=F0=9F=8F=AD=20skip=20steps=20if=20push=20from=20feature=20bran?= =?UTF-8?q?ch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/actions.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1d485ee..145bcd8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -3,6 +3,7 @@ on: push: branches: - develop + - feature/* jobs: actions: runs-on: ubuntu-latest @@ -32,20 +33,25 @@ jobs: DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} run: echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin - name: Sube latest a Docker Hub + if: github.ref_name == 'develop' run: docker push islasgeci/population_trend:latest - name: Sube sha a Docker Hub + if: github.ref_name == 'develop' run: docker push islasgeci/population_trend:${GITHUB_SHA:0:4} - name: Set up Python 3.9 + if: github.ref_name == 'develop' uses: actions/setup-python@master with: python-version: 3.9 - name: Install pypa/build + if: github.ref_name == 'develop' run: >- python -m pip install build --user - name: Build a binary wheel and a source tarball + if: github.ref_name == 'develop' run: >- python -m build @@ -54,6 +60,7 @@ jobs: --outdir dist/ . - name: Publish distribution 📦 to PyPI + if: github.ref_name == 'develop' uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_TOKEN }} From b18c7acc9f5206b08ebd1b428e21f5eb136900f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Mon, 11 May 2026 16:17:20 +0000 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=8E=A8=20pass=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_Population_trend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index b8d5f0a..f4f0734 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -60,10 +60,10 @@ def tests_calculate_upper_limit(): Sparse_Plotter = Plotter_Population_Trend_Model(more_cormorant_data, pop_model, tick_mode="sparse") +Plotter = Plotter_Population_Trend_Model(cormorant_data_for_plotter, pop_model, tick_mode="full") + + class Tests_Plotter_Population_Trend_Model: - Plotter = Plotter_Population_Trend_Model( - cormorant_data_for_plotter, pop_model, tick_mode="full" - ) def tests_init_(self): fig, ax = geci_plot() From 4c0444c7d47e8b628d53afa43b1c1d3461f9aa83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Mon, 11 May 2026 20:23:59 +0000 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=86=99=20update=20minor=20number=20ve?= =?UTF-8?q?rsion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 21 ++++++++++++++++++--- population_trend/__init__.py | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5549aa..b19eb53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,17 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- New CLI command `render-population-trend` with identical behavior to `plot-population-trend`. ### Fixed ### Changed ### Deprecated -- CLI command `plot-population-trend` is deprecated in favor of `render-population-trend`. The old command will remain functional and will be removed in v6.0.0. Users should update their scripts and automation to use `render-population-trend` instead. ### Removed +## [5.11.0] - 2026-05-11 +### Added +- New CLI command `render-population-trend` with identical behavior to `plot-population-trend`. +### Deprecated +- CLI command `plot-population-trend` is deprecated in favor of `render-population-trend`. The old command will remain functional and will be removed in v6.0.0. Users should update their scripts and automation to use `render-population-trend` instead. ## [5.10.2] - 2026-02-05 ### Fixed - CLI command `plot-population-trend-from-cpue` can plot data with missing seasons. @@ -135,6 +138,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -[unreleased]: https://github.com/IslasGECI/population_trend/compare/v5.5.0...HEAD +[unreleased]: https://github.com/IslasGECI/population_trend/compare/v5.11.0...HEAD +[5.11.0]: https://github.com/IslasGECI/population_trend/compare/v5.10.2...v5.11.0 +[5.10.2]: https://github.com/IslasGECI/population_trend/compare/v5.10.1...v5.10.2 +[5.10.1]: https://github.com/IslasGECI/population_trend/compare/v5.10.0...v5.10.1 +[5.10.0]: https://github.com/IslasGECI/population_trend/compare/v5.9.1...v5.10.0 +[5.9.1]: https://github.com/IslasGECI/population_trend/compare/v5.9.0...v5.9.1 +[5.9.0]: https://github.com/IslasGECI/population_trend/compare/v5.8.0...v5.9.0 +[5.8.0]: https://github.com/IslasGECI/population_trend/compare/v5.7.2...v5.8.0 +[5.7.2]: https://github.com/IslasGECI/population_trend/compare/v5.7.1...v5.7.2 +[5.7.1]: https://github.com/IslasGECI/population_trend/compare/v5.7.0...v5.7.1 +[5.7.0]: https://github.com/IslasGECI/population_trend/compare/v5.6.1...v5.7.0 +[5.6.1]: https://github.com/IslasGECI/population_trend/compare/v5.6.0...v5.6.1 +[5.6.0]: https://github.com/IslasGECI/population_trend/compare/v5.5.0...v5.6.0 [5.5.0]: https://github.com/IslasGECI/population_trend/compare/v5.4.0...v5.5.0 [0.0.1]: https://github.com/IslasGECI/population_trend/releases/tag/v0.0.1 diff --git a/population_trend/__init__.py b/population_trend/__init__.py index 11d842f..60f5742 100644 --- a/population_trend/__init__.py +++ b/population_trend/__init__.py @@ -1,6 +1,6 @@ """A population growth model package""" -__version__ = "5.10.2" +__version__ = "5.11.0" from .calculate_growth_rates import * # noqa from .cli import * # noqa from .filter_data import * # noqa