Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #111

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@

---
name: Release

on: [push]
on:
pull_request:
push:
branches:
- main
release:
types:
- published

jobs:
release:
Expand All @@ -18,11 +23,23 @@ jobs:
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install -U pip wheel setuptools setuptools-scm twine
# python -m pip install -U pip wheel "setuptools<66.0.0" setuptools-scm twine
python -m pip install -U build check-manifest pip pytest setuptools setuptools-scm twine wheel
- name: Build distributions
QuLogic marked this conversation as resolved.
Show resolved Hide resolved
run: python setup.py sdist bdist_wheel
run: python -m build --sdist --wheel . --outdir dist

- name: CheckFiles
run: |
ls dist
check-manifest --verbose

- name: Test wheels
run: >
cd dist
&& python -m twine check *
&& python -m pip install *.whl
&& cp --recursive ../tests .
&& python -m pytest -rxs tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the && if you don't fold everything into one line:

Suggested change
run: >
cd dist
&& python -m twine check *
&& python -m pip install *.whl
&& cp --recursive ../tests .
&& python -m pytest -rxs tests
run: |
cd dist
python -m twine check *
python -m pip install *.whl
cp --recursive ../tests .
pytest -rxs tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that, if something errors out, it continues with the next command in your form.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default shell is bash -e, which will fail the whole thing on the first command that fails.

And as a test:

$ bash -e <<EOF
false
echo yes
EOF

prints nothing as the first command failed.

- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
if: success() && github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
39 changes: 18 additions & 21 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,33 @@ jobs:
fail-fast: false
matrix:
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
python-version: [ "3.8", "3.9", "3.10" ,"3.11", "3.12" ]
QuLogic marked this conversation as resolved.
Show resolved Hide resolved
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
- uses: conda-incubator/setup-miniconda@v3

- name: Setup Micromamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
# mamba-version: "*" # activate this to build with mamba.
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
channels: conda-forge, defaults # These need to be specified to use mamba
channel-priority: true
environment-file: ci/environment-py${{ matrix.python-version }}.yml
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} pip
--file requirements.txt
pytest codecov pytest-cov
--channel conda-forge

activate-environment: test_env_cmocean
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall

- name: Run Tests
shell: bash -l {0}
run: |
pytest --cov=./ --cov-report=xml
python -m pytest -rxs --cov=./ --cov-report=xml
QuLogic marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmocean/_version.py
cmocean/rgb/drafts/
dist
*.pyc
Expand Down
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ include README.md
include *.txt
recursive-include cmocean *.txt
recursive-include cmocean *.py

recursive-exclude cmocean/rgb *.jscm
prune docs
prune figures
exclude cmocean/_version.py
14 changes: 0 additions & 14 deletions ci/environment-py3.10.yml

This file was deleted.

14 changes: 0 additions & 14 deletions ci/environment-py3.8.yml

This file was deleted.

14 changes: 0 additions & 14 deletions ci/environment-py3.9.yml

This file was deleted.

61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools_scm",
"wheel",
QuLogic marked this conversation as resolved.
Show resolved Hide resolved
]

[project]
name = "cmocean"
description = "Colormaps for Oceanography"
readme = "README.md"
license = {file = "LICENSE.txt"}
maintainers = [
{name = "Kristen Thyng", email = "[email protected]"},
]
requires-python = ">=3.8"
classifiers = [
"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",
QuLogic marked this conversation as resolved.
Show resolved Hide resolved
]
dynamic = [
"dependencies",
"version",
]
[project.optional-dependencies]
tests = [
"pytest",
]
plots = [
"colorspacious",
"viscm",
]

[project.urls]
documentation = "https://matplotlib.org/cmocean/"
homepage = "https://github.com/matplotlib/cmocean"
repository = "https://github.com/matplotlib/cmocean"

[tool.setuptools]
packages = ["cmocean"]
include-package-data = true

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.setuptools_scm]
write_to = "cmocean/_version.py"
write_to_template = "__version__ = '{version}'"
tag_regex = "^(?P<prefix>v)?(?P<version>[^\\+]+)(?P<suffix>.*)?$"

[tool.pytest.ini_options]
filterwarnings = [
"error:::cmocean.*",
"ignore::UserWarning",
"ignore::RuntimeWarning",
]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
matplotlib
numpy
packaging
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

52 changes: 0 additions & 52 deletions setup.py

This file was deleted.

Loading