Skip to content

Commit

Permalink
Merge branch 'main' into profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray authored Nov 30, 2023
2 parents b18e66d + 868e174 commit f41c592
Show file tree
Hide file tree
Showing 61 changed files with 2,097 additions and 1,397 deletions.
5 changes: 0 additions & 5 deletions .eggs/README.txt

This file was deleted.

13 changes: 10 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ ignore =
W503
F403
F401
D401 # Imperative mood -- doesn't work for cached-property.
N802 # TODO: remove this (function name should be lower-case)
B019 # no using lru_cache on methods
# Imperative mood -- doesn't work for cached-property.
D401
# TODO: remove this (function name should be lower-case)
N802
# no using lru_cache on methods
B019
# logging uses f-string
G004
# no docstring in __init__
D107
max-line-length = 88
max-complexity = 18
rst-roles =
Expand Down
64 changes: 21 additions & 43 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,37 @@
name: Deploy
name: Publish Python distributions to PyPI

on:
push:
branches:
- main
tags:
- '*'

jobs:
bump-version:
name: SemVer Bump
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.bump.outputs.new_version }}
new_tag: ${{ steps.bump.outputs.new_tag }}
previous_tag: ${{ steps.bump.outputs.previous_tag }}
previous_version: ${{ steps.bump.outputs.previous_version }}
release_type: ${{ steps.bump.outputs.release_type }}
changelog: ${{ steps.bump.outputs.changelog }}

env:
ENV_NAME: publish
PYTHON: 3.8
steps:
- uses: actions/checkout@v2
# Ensure full history is gotten.
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Get New Version
id: bump
uses: mathieudutour/[email protected]
with:
default_bump: false
github_token: ${{ secrets.GITHUB_TOKEN }}


deploy:
name: Deploy
runs-on: ubuntu-latest
needs: bump-version
if: needs.bump-version.outputs.new_version != null
steps:
- uses: actions/checkout@master
# https://github.com/ansible/pylibssh/blob/1e7b17f/.github/workflows/build-test-n-publish.yml#L146-L151
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Create setuptools_scm env variable
shell: bash
run: |
version=${{ needs.bump-version.outputs.new_version }}
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV
python-version: ${{ env.PYTHON }}

- name: Install build
run: |
python -m pip install build
python -m pip install setuptools_scm
python setup.py --version
run: pip install build

- name: Build a binary wheel and a source tarball
run: python -m build
- name: Publish distribution 📦 to PyPI
run: |
python -m build
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
56 changes: 56 additions & 0 deletions .github/workflows/run-docs-code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Run Demo
on: [push, pull_request]


jobs:
tests:
name: Run Demo
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
ENV_NAME: testing
strategy:
fail-fast: false
matrix:
demo: ["getting_started", "understanding_21cmsense", "reproducing_pober_2015"]
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
python-version: "3.10"
environment-file: ci/${{ env.ENV_NAME }}.yaml
activate-environment: ${{ env.ENV_NAME }}

- name: Conda Info
run: |
conda info
python --version
- name: Install Deps
run: |
pip install .
pip install papermill ipykernel
conda list
- name: Install ipykernel
run: python -m ipykernel install --user --name sense --display-name "sense"

- name: Run Notebook
run: |
papermill -k sense docs/tutorials/${{ matrix.demo }}.ipynb output-${{ matrix.demo }}.ipynb
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.demo }}
path: output-${{ matrix.demo }}.ipynb
47 changes: 47 additions & 0 deletions .github/workflows/test-with-warnings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Warnings Test
on: [pull_request]


jobs:
tests:
name: Test With Warnings
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
env:
ENV_NAME: testing
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
python-version: ${{ matrix.python-version }}
environment-file: ci/${{ env.ENV_NAME }}.yaml
activate-environment: ${{ env.ENV_NAME }}

- name: Conda Info
run: |
conda info
python --version
- name: Install Test Deps
run: |
pip install .[test]
conda list
- name: Run Tests
run: |
python -m pytest -W error
2 changes: 1 addition & 1 deletion .github/workflows/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
# mamba-version: "*"
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
python-version: ${{ matrix.python-version }}
Expand Down
105 changes: 93 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,105 @@
__pycache__/
*.py[cod]
*$py.class

\.idea/
# C extensions
*.so

__pycache__/
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

py21cmsense\.egg-info/
# Installer logs
pip-log.txt
pip-delete-this-directory.txt

*.pyc
docs/_build/
.ipynb_checkpoints/
pip-wheel-metadata/
# Unit test / coverage reports
htmlcov/
.tox/
*.pkl
*.npz
*.png
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.pytest_cache
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Sphinx documentation
docs/_build/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/



pip-wheel-metadata/
.tox/
*.pkl
*.png
.vscode/
*MHz.h5
docs/reference/_autosummary
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '^docs/conf.py'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -17,7 +17,7 @@ repos:
args: ['--fix=no']

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -39,22 +39,22 @@ repos:


- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.11.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
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

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Loading

0 comments on commit f41c592

Please sign in to comment.