Skip to content

Commit

Permalink
Merge branch 'master' into update_Rmax2
Browse files Browse the repository at this point in the history
  • Loading branch information
qyx268 committed Nov 14, 2023
2 parents 9a36386 + 369e5b2 commit c1d1d66
Show file tree
Hide file tree
Showing 102 changed files with 522,562 additions and 1,219 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.1.2
current_version = 3.3.1
commit = False
tag = False

Expand Down
12 changes: 8 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ ignore =
W503
F403
F401
N803 # Naming upper/lowercase -- too hard right now.
N806 # Naming upper/lowercase -- too hard right now.
N802 # Naming upper/lowercase -- too hard right now.
D401 # Docstring in imperative mood. This should *not* be the case for @property's, but can't ignore them atm.
# Naming upper/lowercase -- too hard right now.
N803
# Naming upper/lowercase -- too hard right now.
N806
# Naming upper/lowercase -- too hard right now.
N802
# Docstring in imperative mood. This should *not* be the case for @property's, but can't ignore them atm.
D401
max-line-length = 88
max-complexity = 40
docstring-convention=numpy
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/pre_commit.yaml

This file was deleted.

17 changes: 9 additions & 8 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: push
jobs:
build-n-publish:
name: Deploy
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'auto-pr')"
steps:
- uses: actions/checkout@master
Expand All @@ -16,13 +16,13 @@ jobs:
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
git describe --tags $(git rev-list --tags --max-count=1)
- name: Set up Python 3.7
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pep517
python-version: "3.10"
- name: Install build
run: |
python -m pip install pep517 --user
python -m pip install build
python -m pip install setuptools_scm
python setup.py --version
- name: Create setuptools_scm env variable
Expand All @@ -33,19 +33,20 @@ jobs:
version=$(bash ../make_dev_version.sh)
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV
- name: Build a source tarball
run: python -m pep517.build --source --out-dir dist .
run: python -m build --sdist .

# deploy to Test PyPI on any push except when merging to production, since that will
# already exist, and thus fail.
- name: Publish distribution 📦 to Test PyPI
if: ${{ !contains(github.ref, 'production') }}
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
# deploy to actual PyPI only when a tag is pushed (which should happen only
# automatically on production)
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
98 changes: 52 additions & 46 deletions .github/workflows/test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,86 +20,92 @@ jobs:
ENV_NAME: tests
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
CC: gcc
name: Testing
# needs: [linter]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8, 3.9, "3.10"]
defaults:
run:
# Adding -l {0} ensures conda can be found properly in each step
shell: bash -l {0}
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get Miniconda MacOSX
if: matrix.os == 'macos-latest'
run: |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O $HOME/miniconda.sh;
bash $HOME/miniconda.sh -b -p $HOME/miniconda
- name: Get Miniconda Linux
if: matrix.os == 'ubuntu-latest'
run: |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $HOME/miniconda.sh;
bash $HOME/miniconda.sh -b -p $HOME/miniconda
- name: Logging

- name: Print head git commit message
id: get_head_commit_message
run: echo "commit_message=$(git show -s --format=%s)" >> "$GITHUB_ENV"

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
# auto-update-conda: true
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: ci/${{ matrix.os }}-env.yml
activate-environment: tests
channel-priority: strict
use-only-tar-bz2: true

- name: Conda Info
run: |
echo ${{ github.event.commits }}
echo ${{ github.event.commits[0] }}
conda info -a
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Make it a Debug Run
if: "contains(github.event.payload.commits[0].message, 'ci debug')"
if: "contains(env.commit_message, 'ci debug')"
run: |
echo "log_level=ULTRA_DEBUG" >> $GITHUB_ENV
echo "extra_pytest_args='-s -k test_perturb_field_data --log-level-21=DEBUG'" >> $GITHUB_ENV
- name: 'Log Commit Message'
run: echo ${{ github.event.commits[0].message }}
echo "extra_pytest_args=-s -k "test_power_spectra_lightcone[mdz_tsfluct_nthreads]" --log-level-21=DEBUG" >> $GITHUB_ENV
- name: Make it a Normal Run
if: "!contains(github.event.commits[0].message, 'ci debug')"
if: "!contains(env.commit_message, 'ci debug')"
run: |
echo "log_level=INFO" >> $GITHUB_ENV
echo "extra_pytest_args=" >> $GITHUB_ENV
- name: Setup Environment
run: |
export PATH="$HOME/miniconda/bin:$PATH"
./ci/install_conda.sh
- name: Install Dependencies
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate ${ENV_NAME}
conda env update -f ci/test-env.yml
- name: Get C Libraries Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libfftw3-dev
sudo apt-get install libgsl0-dev
- name: Get C Libraries MacOSX
if: matrix.os == 'macos-latest'
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate $ENV_NAME
conda install gsl
conda install -c conda-forge fftw
conda install -c conda-forge/label/cf201901 gcc
- name: Install 21cmFAST Linux
if: matrix.os == 'ubuntu-latest'
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate $ENV_NAME
LOG_LEVEL=${{ env.log_level }} pip install .
- name: Install 21cmFAST MacOS
if: matrix.os == 'macos-latest'
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate $ENV_NAME
LOG_LEVEL=${{ env.log_level }} CFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" pip install .
- name: Run Tests
run: |
export PATH="$HOME/miniconda/bin:$PATH"
source activate $ENV_NAME
python -m pytest -l --cov=py21cmfast --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25 ${{ env.extra_pytest_args }}
- uses: codecov/[email protected]
python -m pytest -n 2 -l ${{ env.extra_pytest_args }} --cov=py21cmfast --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25 --plots=testplots
- name: Archive Integration Test Plots
if: always() && contains(env.commit_message, 'ci debug')
uses: actions/upload-artifact@v3
with:
name: integration-test-plots-${{ matrix.os }}-${{ matrix.python-version }}
path: |
testplots/*.pdf
- uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && success() && !contains(github.event.pull_request.labels.*.name, 'auto-pr')
with:
file: ./coverage.xml # optional
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

# CC=$HOME/miniconda/envs/$ENV_NAME/bin/gcc
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ c2r*
r2c*
plots/
.vscode/
src/21cmfast/_version.py
src/py21cmfast/_version.py
25 changes: 12 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exclude: '(^docs/conf.py|^src/py21cmfast/_data/|changethelog.py)'

repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -16,43 +16,42 @@ repos:
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ['--fix=no']
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2 # pick a git hash / tag to point to
- repo: https://github.com/pycqa/flake8
rev: 6.1.0 # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies:
- flake8-quotes
- flake8-comprehensions
# - flake8-comprehensions # no support for flake8 v6
- flake8-builtins
- flake8-eradicate
# - flake8-eradicate # no support for flake8 v6
- pep8-naming
- flake8-pytest
- flake8-docstrings
- flake8-rst-docstrings
- flake8-rst
- flake8-copyright
- flake8-ownership
# - flake8-copyright # no support flor flake8 v6
- flake8-print

- repo: https://github.com/psf/black
rev: 21.6b0
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.9.2
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/asottile/pyupgrade
rev: v2.21.0
rev: v3.11.0
hooks:
- id: pyupgrade
args: [--py36-plus]
7 changes: 0 additions & 7 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,3 @@ formats: all

conda:
environment: docs/environment.yaml

# Optionally set the version of Python and requirements required to build the docs
# We don't install 21cmFAST -- we just load it into the path in conf.py, and mock
# out the C stuff.
python:
version: 3.7
system_packages: true
Loading

0 comments on commit c1d1d66

Please sign in to comment.