diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 627dbc24b..a4a569828 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -1,12 +1,13 @@ name: Build docs on: - push: - branches: [main] - pull_request: - branches: [main] + workflow_call: + inputs: + python-version: + required: true + type: string jobs: - build: + build-docs: runs-on: ubuntu-latest timeout-minutes: 15 steps: @@ -16,6 +17,7 @@ jobs: environment-file: ./environment-dev.yml init-shell: bash create-args: --verbose + python=${{ inputs.python-version }} cache-environment: true cache-downloads: false diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index 6df88c53d..a4f534bc3 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -1,12 +1,14 @@ name: Build and Test on: - push: - branches: [main] - pull_request: - branches: [main] + workflow_call: + inputs: + python-version: + required: true + type: string jobs: - build: + build-ultraplot: + name: Test Python ${{ inputs.python-version }} runs-on: ubuntu-latest timeout-minutes: 15 steps: @@ -15,13 +17,44 @@ jobs: with: environment-file: ./environment-dev.yml init-shell: bash - create-args: --verbose + create-args: >- + --verbose + python=${{ inputs.python-version }} cache-environment: true cache-downloads: false - - name: Test Ultraplot + - name: Build Ultraplot shell: bash -el {0} run: | micromamba activate ultraplot-dev pip install . - python -m pytest + + - name: Generate baseline from main + shell: bash -el {0} + run: | + mkdir -p baseline + micromamba activate ultraplot-dev + git fetch origin ${{ github.event.pull_request.base.sha }} + git checkout ${{ github.event.pull_request.base.sha }} + pytest --mpl-generate-path=baseline_images + git checkout ${{ github.sha }} # Return to PR branch + + - name: Test Ultraplot + shell: bash -el {0} + run: | + micromamba activate ultraplot-dev + pytest + + # - name: Image Comparison Ultraplot + # shell: bash -el {0} + # run: | + # micromamba activate ultraplot-dev + # pytest --mpl --mpl-baseline-path=baseline_images + + # # return the images that failed + # - name: Upload comparison failures + # if: failure() + # uses: actions/upload-artifact@v4 + # with: + # name: failed-comparisons + # path: result_images diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 45fce116e..0ba6769e0 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,7 +6,7 @@ on: branches: [main] jobs: - build: + linter: runs-on: ubuntu-latest timeout-minutes: 15 steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..56a76894f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,71 @@ +name: Matrix Test +on: + push: + branches: [main, devel] + pull_request: + branches: [main, devel] + +jobs: + get-python-versions: + runs-on: ubuntu-latest + outputs: + python-versions: ${{ steps.set-versions.outputs.python-versions }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + run: pip install tomli + + - id: set-versions + run: | + # Create a Python script to read and parse versions + cat > get_versions.py << 'EOF' + import tomli + import re + import json + + # Read pyproject.toml + with open("pyproject.toml", "rb") as f: + data = tomli.load(f) + + # Get Python version requirement + python_req = data["project"]["requires-python"] + + # Parse min and max versions + min_version = re.search(r">=(\d+\.\d+)", python_req) + max_version = re.search(r"<(\d+\.\d+)", python_req) + + versions = [] + if min_version and max_version: + # Convert version strings to tuples + min_v = tuple(map(int, min_version.group(1).split("."))) + max_v = tuple(map(int, max_version.group(1).split("."))) + + # Generate version list + current = min_v + while current < max_v: + versions.append(".".join(map(str, current))) + current = (current[0], current[1] + 1) + + # Print as JSON array + print(json.dumps(versions)) + EOF + + # Run the script and capture output + VERSIONS=$(python3 get_versions.py) + echo "Detected versions: ${VERSIONS}" # Debug output + echo "python-versions=${VERSIONS}" >> $GITHUB_OUTPUT + + build: + needs: get-python-versions + strategy: + matrix: + python-version: ${{ fromJson(needs.get-python-versions.outputs.python-versions) }} + locale: ["en_US.UTF-8", "C.UTF-8"] + fail-fast: false + uses: ./.github/workflows/build-ultraplot.yml + with: + python-version: ${{ matrix.python-version }} diff --git a/environment-dev.yml b/environment-dev.yml index e14a81385..16ed0bf81 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -2,9 +2,9 @@ name: ultraplot-dev channels: - conda-forge dependencies: - - python==3.12 - - numpy>=2.2 - - matplotlib>=3.9.3 + - python>=3.9, <3.13 + - numpy>=1.20.0 + - matplotlib>=3.9 - cartopy - xarray - seaborn @@ -21,5 +21,5 @@ dependencies: - nbsphinx - sphinx-copybutton - sphinx-autoapi - - git+https://github.com/cvanelteren/sphinx-rtd-light-dark.git@mplv3.9.1 + - git+https://github.com/ultraplot/UltraTheme.git@mplv3.9.1 - sphinx-automodapi diff --git a/environment.yml b/environment.yml index 591604a6c..ba639e182 100644 --- a/environment.yml +++ b/environment.yml @@ -3,9 +3,9 @@ channels: - conda-forge - nodefaults dependencies: - - python >=3.9 + - python >=3.9, <3.13 - pytest - pytest-mpl - - numpy - - matplotlib>=3.9.2 + - numpy>=1.20.0 + - matplotlib>=3.9 - pip diff --git a/pyproject.toml b/pyproject.toml index b135a9d27..9f1831f9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=64", "setuptools_scm[toml]>=8", "wheel", "numpy>=1.26.0", - "matplotlib>=3.9.1", + "matplotlib>=3.9", ] build-backend = "setuptools.build_meta" @@ -19,22 +19,21 @@ maintainers = [ ] description = "A succinct matplotlib wrapper for making beautiful, publication-quality graphics." readme = "README.rst" -requires-python = ">=3.6.0" +requires-python = ">=3.9,<3.13" license = {text = "MIT"} classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Intended Audience :: Science/Research", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] dependencies= [ - 'importlib-metadata; python_version>"3.8"', - + "numpy>=1.26.0", + "matplotlib>=3.9" ] dynamic = ["version"] diff --git a/ultraplot/tests/baseline/test_align_labels.png b/ultraplot/tests/baseline/test_align_labels.png index db69f10b7..6e38625fe 100644 Binary files a/ultraplot/tests/baseline/test_align_labels.png and b/ultraplot/tests/baseline/test_align_labels.png differ diff --git a/ultraplot/tests/baseline/test_colormap_mode.png b/ultraplot/tests/baseline/test_colormap_mode.png deleted file mode 100644 index ee45d3a69..000000000 Binary files a/ultraplot/tests/baseline/test_colormap_mode.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_column_iteration.png b/ultraplot/tests/baseline/test_column_iteration.png index 142d1986f..bc0f38b1a 100644 Binary files a/ultraplot/tests/baseline/test_column_iteration.png and b/ultraplot/tests/baseline/test_column_iteration.png differ diff --git a/ultraplot/tests/baseline/test_contour_labels.png b/ultraplot/tests/baseline/test_contour_labels.png index c5de493f5..14773fe09 100644 Binary files a/ultraplot/tests/baseline/test_contour_labels.png and b/ultraplot/tests/baseline/test_contour_labels.png differ diff --git a/ultraplot/tests/baseline/test_contour_legend_with_label.png b/ultraplot/tests/baseline/test_contour_legend_with_label.png index 3fc406ca7..f38d2f464 100644 Binary files a/ultraplot/tests/baseline/test_contour_legend_with_label.png and b/ultraplot/tests/baseline/test_contour_legend_with_label.png differ diff --git a/ultraplot/tests/baseline/test_contour_legend_without_label.png b/ultraplot/tests/baseline/test_contour_legend_without_label.png index 189be39b4..addebcf39 100644 Binary files a/ultraplot/tests/baseline/test_contour_legend_without_label.png and b/ultraplot/tests/baseline/test_contour_legend_without_label.png differ diff --git a/ultraplot/tests/baseline/test_contour_single.png b/ultraplot/tests/baseline/test_contour_single.png index 00c5c49b5..6b19cf164 100644 Binary files a/ultraplot/tests/baseline/test_contour_single.png and b/ultraplot/tests/baseline/test_contour_single.png differ diff --git a/ultraplot/tests/baseline/test_data_keyword.png b/ultraplot/tests/baseline/test_data_keyword.png index 561eb0a4d..9bb4dc0b8 100644 Binary files a/ultraplot/tests/baseline/test_data_keyword.png and b/ultraplot/tests/baseline/test_data_keyword.png differ diff --git a/ultraplot/tests/baseline/test_discrete_ticks.png b/ultraplot/tests/baseline/test_discrete_ticks.png deleted file mode 100644 index 9be5e5848..000000000 Binary files a/ultraplot/tests/baseline/test_discrete_ticks.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_discrete_vs_fixed.png b/ultraplot/tests/baseline/test_discrete_vs_fixed.png deleted file mode 100644 index 94eece11a..000000000 Binary files a/ultraplot/tests/baseline/test_discrete_vs_fixed.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_drawing_in_projection_with_globe.png b/ultraplot/tests/baseline/test_drawing_in_projection_with_globe.png deleted file mode 100644 index 6be3c8a6b..000000000 Binary files a/ultraplot/tests/baseline/test_drawing_in_projection_with_globe.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_drawing_in_projection_without_globe.png b/ultraplot/tests/baseline/test_drawing_in_projection_without_globe.png deleted file mode 100644 index 90aa802a0..000000000 Binary files a/ultraplot/tests/baseline/test_drawing_in_projection_without_globe.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_flow_functions.png b/ultraplot/tests/baseline/test_flow_functions.png index 4681deffa..a421ce5e7 100644 Binary files a/ultraplot/tests/baseline/test_flow_functions.png and b/ultraplot/tests/baseline/test_flow_functions.png differ diff --git a/ultraplot/tests/baseline/test_histogram_legend.png b/ultraplot/tests/baseline/test_histogram_legend.png index 665a601e3..3789f82b6 100644 Binary files a/ultraplot/tests/baseline/test_histogram_legend.png and b/ultraplot/tests/baseline/test_histogram_legend.png differ diff --git a/ultraplot/tests/baseline/test_ignore_message.png b/ultraplot/tests/baseline/test_ignore_message.png deleted file mode 100644 index f2f8b06e5..000000000 Binary files a/ultraplot/tests/baseline/test_ignore_message.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_inset_colorbars.png b/ultraplot/tests/baseline/test_inset_colorbars.png deleted file mode 100644 index dbd530114..000000000 Binary files a/ultraplot/tests/baseline/test_inset_colorbars.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_invalid_dist.png b/ultraplot/tests/baseline/test_invalid_dist.png index 3f86f61a6..5e481b6bf 100644 Binary files a/ultraplot/tests/baseline/test_invalid_dist.png and b/ultraplot/tests/baseline/test_invalid_dist.png differ diff --git a/ultraplot/tests/baseline/test_keep_guide_labels.png b/ultraplot/tests/baseline/test_keep_guide_labels.png index 97f5937cc..6ad9df3f5 100644 Binary files a/ultraplot/tests/baseline/test_keep_guide_labels.png and b/ultraplot/tests/baseline/test_keep_guide_labels.png differ diff --git a/ultraplot/tests/baseline/test_label_settings.png b/ultraplot/tests/baseline/test_label_settings.png index cbdc5bf96..0725fbe5d 100644 Binary files a/ultraplot/tests/baseline/test_label_settings.png and b/ultraplot/tests/baseline/test_label_settings.png differ diff --git a/ultraplot/tests/baseline/test_locale_formatting.png b/ultraplot/tests/baseline/test_locale_formatting.png deleted file mode 100644 index 5e1562c53..000000000 Binary files a/ultraplot/tests/baseline/test_locale_formatting.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_panel_dist.png b/ultraplot/tests/baseline/test_panel_dist.png index 34dda7b59..a9b26d33c 100644 Binary files a/ultraplot/tests/baseline/test_panel_dist.png and b/ultraplot/tests/baseline/test_panel_dist.png differ diff --git a/ultraplot/tests/baseline/test_panels_without_sharing_1.png b/ultraplot/tests/baseline/test_panels_without_sharing_1.png index 18d953265..aabbad743 100644 Binary files a/ultraplot/tests/baseline/test_panels_without_sharing_1.png and b/ultraplot/tests/baseline/test_panels_without_sharing_1.png differ diff --git a/ultraplot/tests/baseline/test_panels_without_sharing_2.png b/ultraplot/tests/baseline/test_panels_without_sharing_2.png index c8acf5d66..3014454d6 100644 Binary files a/ultraplot/tests/baseline/test_panels_without_sharing_2.png and b/ultraplot/tests/baseline/test_panels_without_sharing_2.png differ diff --git a/ultraplot/tests/baseline/test_parametric_colors.png b/ultraplot/tests/baseline/test_parametric_colors.png index 38fb4d555..0d709dc9c 100644 Binary files a/ultraplot/tests/baseline/test_parametric_colors.png and b/ultraplot/tests/baseline/test_parametric_colors.png differ diff --git a/ultraplot/tests/baseline/test_pint_quantities.png b/ultraplot/tests/baseline/test_pint_quantities.png index 828711cce..0b1942af4 100644 Binary files a/ultraplot/tests/baseline/test_pint_quantities.png and b/ultraplot/tests/baseline/test_pint_quantities.png differ diff --git a/ultraplot/tests/baseline/test_scatter_alpha.png b/ultraplot/tests/baseline/test_scatter_alpha.png index 74b09e100..28b745257 100644 Binary files a/ultraplot/tests/baseline/test_scatter_alpha.png and b/ultraplot/tests/baseline/test_scatter_alpha.png differ diff --git a/ultraplot/tests/baseline/test_scatter_args.png b/ultraplot/tests/baseline/test_scatter_args.png index 9cc127b0a..e0dc3edbc 100644 Binary files a/ultraplot/tests/baseline/test_scatter_args.png and b/ultraplot/tests/baseline/test_scatter_args.png differ diff --git a/ultraplot/tests/baseline/test_scatter_cycle.png b/ultraplot/tests/baseline/test_scatter_cycle.png index 288525e86..d4c948f59 100644 Binary files a/ultraplot/tests/baseline/test_scatter_cycle.png and b/ultraplot/tests/baseline/test_scatter_cycle.png differ diff --git a/ultraplot/tests/baseline/test_scatter_sizes.png b/ultraplot/tests/baseline/test_scatter_sizes.png index 9be18facb..b97209edc 100644 Binary files a/ultraplot/tests/baseline/test_scatter_sizes.png and b/ultraplot/tests/baseline/test_scatter_sizes.png differ diff --git a/ultraplot/tests/baseline/test_seaborn_hist.png b/ultraplot/tests/baseline/test_seaborn_hist.png index 47e0dcb4c..6a760a3d3 100644 Binary files a/ultraplot/tests/baseline/test_seaborn_hist.png and b/ultraplot/tests/baseline/test_seaborn_hist.png differ diff --git a/ultraplot/tests/baseline/test_seaborn_relational.png b/ultraplot/tests/baseline/test_seaborn_relational.png index bc9b210ca..853673d46 100644 Binary files a/ultraplot/tests/baseline/test_seaborn_relational.png and b/ultraplot/tests/baseline/test_seaborn_relational.png differ diff --git a/ultraplot/tests/baseline/test_segmented_norm_ticks.png b/ultraplot/tests/baseline/test_segmented_norm_ticks.png deleted file mode 100644 index b8e116768..000000000 Binary files a/ultraplot/tests/baseline/test_segmented_norm_ticks.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_share_all_basic.png b/ultraplot/tests/baseline/test_share_all_basic.png index fc1db6a4f..bef61a4c9 100644 Binary files a/ultraplot/tests/baseline/test_share_all_basic.png and b/ultraplot/tests/baseline/test_share_all_basic.png differ diff --git a/ultraplot/tests/baseline/test_span_labels.png b/ultraplot/tests/baseline/test_span_labels.png index 711569271..0efbbfbc4 100644 Binary files a/ultraplot/tests/baseline/test_span_labels.png and b/ultraplot/tests/baseline/test_span_labels.png differ diff --git a/ultraplot/tests/baseline/test_standardized_input.png b/ultraplot/tests/baseline/test_standardized_input.png deleted file mode 100644 index 2f6be9b85..000000000 Binary files a/ultraplot/tests/baseline/test_standardized_input.png and /dev/null differ diff --git a/ultraplot/tests/baseline/test_title_deflection.png b/ultraplot/tests/baseline/test_title_deflection.png index ef93e4f10..94b25c010 100644 Binary files a/ultraplot/tests/baseline/test_title_deflection.png and b/ultraplot/tests/baseline/test_title_deflection.png differ diff --git a/ultraplot/tests/baseline/test_twin_axes_1.png b/ultraplot/tests/baseline/test_twin_axes_1.png index 4bf783043..9820d6213 100644 Binary files a/ultraplot/tests/baseline/test_twin_axes_1.png and b/ultraplot/tests/baseline/test_twin_axes_1.png differ diff --git a/ultraplot/tests/baseline/test_twin_axes_3.png b/ultraplot/tests/baseline/test_twin_axes_3.png index de17748b4..0c85e55ca 100644 Binary files a/ultraplot/tests/baseline/test_twin_axes_3.png and b/ultraplot/tests/baseline/test_twin_axes_3.png differ