Skip to content

Commit

Permalink
github action and require python 3.8, numpy>1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Aug 20, 2024
1 parent 07cd9fb commit b708982
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 81 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: tests

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "Latest Python 3.12"
os: ubuntu-latest
python-version: 3.12
- name: "OS X Python 3.8"
os: macos-latest
python-version: 3.8
- name: "Windows Python 3.8"
os: windows-latest
python-version: 3.8

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: flake8 Lint
if: matrix.os == 'ubuntu-latest'
uses: py-actions/flake8@v2
with:
args: --select=E713,E704,E703,E714,E10,E11,E20,E22,E23,E25,E27,E301,E302,E304,E9,F405,F406,F5,F6,F7,F8,W1,W2,W3,W6 --show-source --statistics
path: getdist
max-line-length: "120"

- name: Install dependencies
run: |
python --version
pip install .
git clone --depth=1 https://github.com/cmbant/getdist_testchains
- name: Run tests
run: |
getdist --help
python -m unittest getdist.tests.getdist_test
deploy:
needs: build
runs-on: ubuntu-latest
if: github.repository_owner == 'cmbant' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U build twine
- name: Build package
run: python -m build --sdist

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ __pycache__/
*$py.class

# Distribution / packaging
.*
env/
build/
develop-eggs/
Expand Down
57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ GetDist
:Source: https://github.com/cmbant/getdist
:Reference: https://arxiv.org/abs/1910.13970

.. image:: https://img.shields.io/travis/com/cmbant/getdist
:target: https://app.travis-ci.com/cmbant/getdist
.. image:: https://github.com/cmbant/getdist/actions/workflows/tests.yml/badge.svg
:target: https://github.com/cmbant/getdist/actions/workflows/tests.yml
.. image:: https://img.shields.io/pypi/v/GetDist.svg?style=flat
:target: https://pypi.python.org/pypi/GetDist/
.. image:: https://readthedocs.org/projects/getdist/badge/?version=latest
Expand Down Expand Up @@ -63,7 +63,7 @@ the `Plot Gallery and tutorial <http://getdist.readthedocs.io/en/latest/plot_gal

Dependencies
=============
* Python 3.7+
* Python 3.8+
* matplotlib
* scipy
* PySide6 or PySide2 - optional, only needed for GUI
Expand Down
2 changes: 1 addition & 1 deletion getdist/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = 'Antony Lewis'
__version__ = "1.5.1"
__version__ = "1.5.2"
__url__ = "https://getdist.readthedocs.io"

import os
Expand Down
11 changes: 0 additions & 11 deletions getdist/chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,7 @@ def loadNumpyTxt(fname, skiprows=None):
:return: numpy array of the data values
"""

if not hasattr(loadNumpyTxt, 'pandas'):
loadNumpyTxt.pandas = None
try:
if version.parse(np.__version__) < version.parse('1.23'):
import pandas # noqa
loadNumpyTxt.pandas = pandas
except ImportError:
logging.warning('Install pandas or numpy 1.23+ for faster reading from text files')
try:
if loadNumpyTxt.pandas:
return loadNumpyTxt.pandas.read_csv(fname, delim_whitespace=True, header=None, dtype=np.float64,
skiprows=skiprows, comment='#').values
return np.atleast_2d(np.loadtxt(fname, skiprows=skiprows or 0))
except ValueError:
print('Error reading %s' % fname)
Expand Down
4 changes: 2 additions & 2 deletions getdist/tests/getdist_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ def setUp(self):
if not os.path.exists(self.tempdir):
os.mkdir(self.tempdir)
os.chdir(self.tempdir)
self.path = os.getenv('TRAVIS_BUILD_DIR', os.path.join(os.path.dirname(__file__), '..', '..', '..'))
self.path = os.path.normpath(os.path.join(self.path, 'getdist_testchains', 'cobaya'))
path = os.path.join(os.path.dirname(__file__), '..', '..', '..')
self.path = os.path.normpath(os.path.join(path, 'getdist_testchains', 'cobaya'))

def tearDown(self):
os.chdir(tempfile.gettempdir())
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ classifiers = [
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Astronomy",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3.7",
"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"
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
]
requires-python = ">=3.7.0"
requires-python = ">=3.8.0"
dependencies = [
"numpy>=1.17.0", "matplotlib (>=2.2.0,!=3.5.0)", "scipy>=1.5", "PyYAML>=5.1", "packaging"
"numpy>=1.23.0", "matplotlib (>=2.2.0,!=3.5.0)", "scipy>=1.5", "PyYAML>=5.1", "packaging"
]

[project.optional-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.17.0
numpy>=1.23.0
matplotlib>=2.2.0,!=3.5.0
scipy>=1.5.0
PyYAML>=5.1
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,4 @@ def run(self):
platforms="any",
package_data=package_data,
packages=["getdist", "getdist.gui", "getdist.tests", "getdist.styles"],
test_suite="getdist.tests",
cmdclass=cmd_class)

0 comments on commit b708982

Please sign in to comment.