From 4274c432e63052db9617fa6afffaafe58a7f770d Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:07:23 +0200 Subject: [PATCH 01/12] Add pyproject.toml and remove setup.py --- pyproject.toml | 44 +++++++++++++++++++++++++++++++++++++++++ setup.py | 53 -------------------------------------------------- 2 files changed, 44 insertions(+), 53 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..dd89d78 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +[tool.poetry] +name = "shadems" +version = "0.5.2" +description = "Rapid Measurement Set plotting with dask-ms and datashader" +authors = ["Ian Heywood & RATT "] +license = "GPL-2.0-only" +homepage = "https://github.com/ratt-ru/shadeMS" +repository = "https://github.com/ratt-ru/shadeMS" +include = ["README.md"] +kerywords = ["Astronomy", "Visualisation", "Packaging"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Astronomy" +] +packages = [ + { include = "shade_ms" }, +] + +[tool.poetry.scripts] +shadems = {reference = "bin/shadems", type = "file"} + +[tool.poetry.dependencies] +python = "^3.8" +datashader = "^0.13.0" +dask-ms = { version = "^0.2.15", extras = ["xarray"] } +holoviews = "^1.14.9" +matplotlib = { version = "^3.6.0" } +cmasher = "^1.6.3" +future-fstrings = "^1.2.0" +requests = "^2.27.1" +numpy = "1.23.5" # Datashader installs the latest numpy which is in conflict with <=1.35.5 required by numba +dask = {extras = ["array"], version = "2022.9.1"} # Datashader installs the latest dask which is in conflict with <2023.0.0 required by dask-ms[array] + + +[tool.poetry.extras] +testing = ["pytest", "pytest-flake8"] + +[build-system] +requires = ["setuptools", "poetry"] +build-backend = "poetry.masonry.api" diff --git a/setup.py b/setup.py deleted file mode 100644 index 801904e..0000000 --- a/setup.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python - -import os -from setuptools import setup, find_packages - -build_root = os.path.dirname(__file__) - -requirements = [ -"dask-ms[xarray]", -"dask[complete]", -"datashader>=0.12.0", -"holoviews", -"matplotlib>2.2.3; python_version >= '3.5'", -"cmasher", -"future-fstrings", -"requests", -"MSUtils" -] - -extras_require = {'testing': ['pytest', 'pytest-flake8']} - -PACKAGE_NAME = 'shadems' -__version__ = '0.5.1.1' - -def readme(): - """Get readme content for package long description""" - with open(os.path.join(build_root, 'README.md')) as f: - return f.read() - -setup(name = PACKAGE_NAME, - long_description=readme(), - long_description_content_type="text/markdown", - version = __version__, - description = "Rapid Measurement Set plotting with dask-ms and datashader", - author = "Ian Heywood & RATT", - author_email = "ian.heywood@physics.ox.ac.uk", - url = "https://github.com/ratt-ru/shadeMS", - packages=find_packages(), - install_requires = requirements, - extras_require=extras_require, - include_package_data = True, - scripts=["bin/" + i for i in os.listdir("bin")], - license="GNU GPL v2", - python_requires=">=3.6", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", - "Operating System :: POSIX :: Linux", - "Programming Language :: Python", - "Topic :: Scientific/Engineering :: Astronomy" - ] -) From 44b36d7a5c548adad4f507e6cf4173b8ec8c785e Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:07:50 +0200 Subject: [PATCH 02/12] Adjust ci workflow --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8872f50..7b4624b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,12 +4,12 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - python-version: ["3.6", "3.7", "3.8"] - + os: [ ubuntu-20.04, ubuntu-22.04 ] + python-version: ["3.8", "3.9", "3.10"] steps: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 @@ -27,6 +27,9 @@ jobs: - name: Install shadems run: pip install -e .[testing] + - name: Test command + run: shadems --help + - name: Run testsuite run: py.test shade_ms/ @@ -72,4 +75,4 @@ jobs: # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') # with: # user: __token__ - # password: ${{ secrets.pypi_token }} \ No newline at end of file + # password: ${{ secrets.pypi_token }} From 4bb61326524de5e2e207328c6396a00cff438ae5 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:09:16 +0200 Subject: [PATCH 03/12] Remove msutils from dep list: Provides additionall requiremnts and conflicts --- shade_ms/ms_info.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/shade_ms/ms_info.py b/shade_ms/ms_info.py index 20e2797..087dc71 100644 --- a/shade_ms/ms_info.py +++ b/shade_ms/ms_info.py @@ -1,4 +1,3 @@ -from MSUtils.msutils import STOKES_TYPES from casacore.tables import table import re import daskms @@ -6,6 +5,42 @@ import numpy as np from collections import OrderedDict +STOKES_TYPES = { + 0 : "Undefined", + 1 : "I", + 2 : "Q", + 3 : "U", + 4 : "V", + 5 : "RR", + 6 : "RL", + 7 : "LR", + 8 : "LL", + 9 : "XX", + 10 : "XY", + 11 : "YX", + 12 : "YY", + 13 : "RX", + 14 : "RY", + 15 : "LX", + 16 : "LY", + 17 : "XR", + 18 : "XL", + 19 : "YR", + 20 : "YL", + 21 : "PP", + 22 : "PQ", + 23 : "QP", + 24 : "QQ", + 25 : "RCircular", + 26 : "LCircular", + 27 : "Linear", + 28 : "Ptotal", + 29 : "Plinear", + 30 : "PFtotal", + 31 : "PFlinear", + 32 : "Pangle", +} + class NamedList(object): """Holds a list of names (e.g. field names), and provides common indexing and subset operations""" From e97914325c5a53521fd9dd5be08ad93cbbb161e1 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:10:23 +0200 Subject: [PATCH 04/12] Fixes values error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() --- shade_ms/data_plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shade_ms/data_plots.py b/shade_ms/data_plots.py index d1ae3c6..07751aa 100644 --- a/shade_ms/data_plots.py +++ b/shade_ms/data_plots.py @@ -165,7 +165,7 @@ def get_plot_data(msinfo, group_cols, mytaql, chan_freqs, freqs=freqs, wavel=wavel, rows=group.row, - baselines=baselines if baselines else np.array([baseline])) + baselines=baselines if [baselines] else np.array([baseline])) nchan = len(group.chan) if flag is not None: From b9347b6d02ab233257c202e8b77aea0c46e7e2f5 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:17:03 +0200 Subject: [PATCH 05/12] Build backend --- .github/workflows/ci.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b4624b..1d20f77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: python -m pip install -U pip setuptools wheel - name: Install shadems - run: pip install -e .[testing] + run: pip install .[testing] - name: Test command run: shadems --help diff --git a/pyproject.toml b/pyproject.toml index dd89d78..31be309 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,4 +41,4 @@ testing = ["pytest", "pytest-flake8"] [build-system] requires = ["setuptools", "poetry"] -build-backend = "poetry.masonry.api" +build-backend = "poetry.core.masonry.api" From 6b3ff53fa37d75488fbac1ee57a79bc773db69e0 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:33:16 +0200 Subject: [PATCH 06/12] UPdate ci --- .github/workflows/ci.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d20f77..5481510 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,26 +12,38 @@ jobs: python-version: ["3.8", "3.9", "3.10"] steps: - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Cache Installations + id: cache-installs + uses: actions/cache@v3 + with: + path: ~/.local + key: install-${{ env.INSTALL_CACHE_HASH }}-2 + + - name: Install Poetry + if: steps.cache-installs.outputs.cache-hit != 'true' + run: | + curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }} + + - name: Test poetry + run: poetry --version + - name: Checkout source uses: actions/checkout@v2 with: fetch-depth: 1 - - name: Install latest versions of pip, setuptools and wheel - run: python -m pip install -U pip setuptools wheel - - name: Install shadems - run: pip install .[testing] + run: poetry install --extras "testing" - name: Test command run: shadems --help - name: Run testsuite - run: py.test shade_ms/ + run: poetry run py.test -vvv shade_ms/ # deploy: # needs: [test] From dfd82eb4666e3b158964e2e9b687024b0cb0d4f8 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:36:36 +0200 Subject: [PATCH 07/12] Poetry version --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5481510..a123fe2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,9 @@ name: Ubuntu CI on: [push, pull_request] +env: + POETRY_VERSION: 1.2.1 + jobs: test: runs-on: ${{ matrix.os }} From 09ca794b037b91f54da37fa2737f94638d07c2a0 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:48:16 +0200 Subject: [PATCH 08/12] Poetru core --- .github/workflows/ci.yml | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a123fe2..c55738c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Ubuntu CI on: [push, pull_request] env: - POETRY_VERSION: 1.2.1 + POETRY_VERSION: 1.4.0 jobs: test: diff --git a/pyproject.toml b/pyproject.toml index 31be309..84e9658 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = ["Ian Heywood & RATT "] license = "GPL-2.0-only" homepage = "https://github.com/ratt-ru/shadeMS" repository = "https://github.com/ratt-ru/shadeMS" -include = ["README.md"] +readme = "README.md" kerywords = ["Astronomy", "Visualisation", "Packaging"] classifiers = [ "Development Status :: 4 - Beta", @@ -40,5 +40,5 @@ dask = {extras = ["array"], version = "2022.9.1"} # Datashader installs the late testing = ["pytest", "pytest-flake8"] [build-system] -requires = ["setuptools", "poetry"] +requires = ["setuptools", "poetry-core"] build-backend = "poetry.core.masonry.api" From a3a3eed596830a28269308ca1a1b58d4a2e60400 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Wed, 15 Mar 2023 14:52:01 +0200 Subject: [PATCH 09/12] Property name --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 84e9658..32791b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ license = "GPL-2.0-only" homepage = "https://github.com/ratt-ru/shadeMS" repository = "https://github.com/ratt-ru/shadeMS" readme = "README.md" -kerywords = ["Astronomy", "Visualisation", "Packaging"] +keywords = ["Astronomy", "Visualisation", "Packaging"] classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", From 936fd588b2e12c99796dd6a545675cd9f21348f5 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Fri, 17 Mar 2023 12:50:48 +0200 Subject: [PATCH 10/12] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c55738c..8cb5adf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: run: poetry install --extras "testing" - name: Test command - run: shadems --help + run: poetry run python bin/shadems --help - name: Run testsuite run: poetry run py.test -vvv shade_ms/ From 7a767df89bade6419b10b75e6b3296ad3fe4fd1c Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Fri, 17 Mar 2023 13:08:40 +0200 Subject: [PATCH 11/12] testing modules --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 32791b3..9202900 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,9 @@ cmasher = "^1.6.3" future-fstrings = "^1.2.0" requests = "^2.27.1" numpy = "1.23.5" # Datashader installs the latest numpy which is in conflict with <=1.35.5 required by numba -dask = {extras = ["array"], version = "2022.9.1"} # Datashader installs the latest dask which is in conflict with <2023.0.0 required by dask-ms[array] - +dask = { extras = ["array"], version = "2022.9.1" } # Datashader installs the latest dask which is in conflict with <2023.0.0 required by dask-ms[array] +pytest = { version = "^7.2.2", optional=true } +pytest-flake8 = { version = "^1.1.1", optional=true } [tool.poetry.extras] testing = ["pytest", "pytest-flake8"] From 736f616b4e84bdd5ea2e8b3538b533d9b4735fb9 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Fri, 17 Mar 2023 13:28:08 +0200 Subject: [PATCH 12/12] Update publish_package.yml --- .github/workflows/publish_package.yml | 39 +++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index 1a17f44..981dde6 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -4,6 +4,9 @@ on: release: types: [published] +env: + POETRY_VERSION: 1.4.0 + jobs: deploy: @@ -12,17 +15,37 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.x' - - name: Install dependencies + + - name: Cache Installations + id: cache-installs + uses: actions/cache@v3 + with: + path: ~/.local + key: install-${{ env.INSTALL_CACHE_HASH }}-2 + + - name: Install Poetry + if: steps.cache-installs.outputs.cache-hit != 'true' run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }} + - name: Test poetry + run: poetry --version + + - name: Checkout source + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Install shadems + run: poetry install + + - name: Build distribution + run: poetry build + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@master with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }}