Skip to content

Commit

Permalink
Merge branch 'main' into add-yamllint
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Sep 19, 2024
2 parents 273ed1f + 09bef8a commit e1e7138
Show file tree
Hide file tree
Showing 41 changed files with 860 additions and 551 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
b42067f6776dcd763827000d585a88e071b78af3
# applied prettier - https://github.com/glass-dev/glass/pull/227
f9bac62f497a7288aa71fd4dbd948945c37f854e
# applied ruff-linting - https://github.com/glass-dev/glass/pull/232
e58d8616c03b8447aba90996905a98b42f18ba0a
2 changes: 1 addition & 1 deletion .github/test-constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--prefer-binary
--only-binary numpy,scipy,healpy,healpix
--prefer-binary
31 changes: 31 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test examples

on:
push:
paths:
- "glass/**"
branches:
- main
pull_request:
paths:
- "glass/**"

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test-examples:
name: Test examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: pip
- run: pipx run --spec '.[examples]' jupyter execute examples/**/*.ipynb
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
check-pr-title:
if: ${{ github.actor != 'pre-commit-ci[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: thehanimo/[email protected]
Expand Down
46 changes: 42 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,58 @@
name: Release

on:
workflow_dispatch:
inputs:
target:
description: 'Deployment target. Can be "pypi" or "testpypi"'
default: "testpypi"
release:
types:
- published

jobs:
dist:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Build SDist and wheel
run: pipx run build

- name: Check metadata
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v4
with:
path: dist/*

publish:
name: Publish on PyPI
needs: [dist]
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/p/glass
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- run: pipx run build
- uses: pypa/[email protected]
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: List distributions to be deployed
run: ls -l dist/

- if:
github.event.inputs.target == 'pypi' || (github.event_name ==
'release' && github.event.action == 'published')
uses: pypa/gh-action-pypi-publish@release/v1

- if: github.event.inputs.target == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
15 changes: 0 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
branches:
- main
pull_request:
branches:
- main

concurrency:
# Skip intermediate builds: always.
Expand Down Expand Up @@ -68,16 +66,3 @@ jobs:
sudo apt-get update
sudo apt-get install pandoc
- run: pipx run --spec '.[docs]' sphinx-build -W -b html docs _build/html

examples:
name: Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
- run: pipx run --spec '.[examples]' jupyter execute examples/**/*.ipynb
32 changes: 29 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
ci:
autoupdate_commit_msg: "MNT: update pre-commit hooks"
autofix_commit_msg: "STY: pre-commit fixes"

repos:
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
Expand Down Expand Up @@ -46,9 +49,32 @@ repos:
}
}
- --strict
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args:
- --fix=lf
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-type-ignore
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
Expand All @@ -59,8 +85,8 @@ repos:
- --in-place
- --spaces-indent-inline-array=4
- --trailing-comma-inline-array
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
args:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

project = "GLASS"
author = "GLASS developers"
copyright = f"2022-{datetime.date.today().year} {author}"
copyright = f"2022-{datetime.date.today().year} {author}" # noqa: A001, DTZ011
version = metadata.version("glass")
release = version

Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ and for the cosmological background. Make sure you have CAMB installed:
$ python -c 'import camb' # should not give an error
If you want to compute the angular matter power spectra in the examples, you
need the `glass.ext.camb` package:
need the ``glass.ext.camb`` package:

.. code-block:: console
Expand Down
70 changes: 35 additions & 35 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
4 changes: 2 additions & 2 deletions docs/manual/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ These notes document the changes between individual *GLASS* releases.
power spectra by index from a list using GLASS ordering.

* The :func:`~glass.galaxies.gaussian_phz()` function now accepts bounds using
`lower=` and `upper=` keyword parameters.
``lower=`` and ``upper=`` keyword parameters.


2023.6 (30 Jun 2023)
Expand Down Expand Up @@ -157,7 +157,7 @@ These notes document the changes between individual *GLASS* releases.
by window functions using :func:`glass.shells.restrict` and
:func:`glass.shells.partition`.

- The ``zmin`` and ``zmax`` parameters of `glass.galaxies.redshifts_from_nz`
- The ``zmin`` and ``zmax`` parameters of ``glass.galaxies.redshifts_from_nz``
have been removed for the same reason.

- The ``glass.lensing.multi_plane_weights`` function, which computed all
Expand Down
6 changes: 3 additions & 3 deletions docs/user/how-glass-works.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Radial discretisation
The discretisation in the radial (line of sight) direction is done in *GLASS*
using the concept of a :term:`radial window`, which consists of a window
function :math:`W` that assigns a weight :math:`W(z)` to each redshift
:math:`z`. In the *GLASS* code, the :class:`~glass.shells.RadialWindow` named
:math:`z`. In the *GLASS* code, the :class:`~glass.RadialWindow` named
tuple is used to define radial windows.

A sequence :math:`W_1, W_2, \ldots` of such window functions defines the shells
of the simulation. For example, the :func:`~glass.shells.tophat_windows`
of the simulation. For example, the :func:`~glass.tophat_windows`
function takes redshift boundaries and returns a sequence of top hat windows,
which are flat and non-overlapping.

Expand Down Expand Up @@ -169,7 +169,7 @@ shells:
In short, the requirements say that each shell has an effective redshift which
partitions the window functions of all other shells. In *GLASS*, it is stored
as the ``zeff`` attribute of :class:`~glass.shells.RadialWindow`. Functions
as the ``zeff`` attribute of :class:`~glass.RadialWindow`. Functions
that construct a list of windows for shells should ensure these requirements
are met.

Expand Down
Loading

0 comments on commit e1e7138

Please sign in to comment.