Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae committed Oct 18, 2024
1 parent d09623c commit 7486a0d
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 133 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

3 changes: 3 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
57 changes: 26 additions & 31 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
name: pytest

# Only build PRs, the master branch, and releases.
# Only build PRs, the main branch, and releases.
on:
pull_request:
push:
branches:
- master
- main
release:
types:
- published

# Cancel any previous run of the test job.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:

Expand All @@ -19,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, ] # macos, windows] # Only Linux currently.
python-version: [3.6, 3.7, 3.8]
python-version: [3.10, 3.11, 3.12, 3.13]

env:
# Used for coveralls flag
Expand All @@ -28,15 +33,9 @@ jobs:

steps:

# Cancel any previous run of the test job; [pin v0.6.0]
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@ce177499ccf9fd2aded3b0426c97e5434c2e8a73
with:
access_token: ${{ github.token }}

# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# Need to fetch more than the last commit so that setuptools_scm can
# create the correct version string. If the number of commits since
Expand All @@ -52,21 +51,21 @@ jobs:
run: git fetch origin 'refs/tags/*:refs/tags/*'

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
python -m pip install .[all]
- name: Test with pytest
run: pytest --cov=pyfftlog --flake8

- name: Coveralls
# [pin v20201129]
uses: AndreMiras/coveralls-python-action@f5fd5c309b39d01599fb92c72d4f7409ea78aec9
# [pin @develop@20230609]
uses: AndreMiras/coveralls-python-action@65c1672f0b8a201702d86c81b79187df74072505
with:
parallel: true
flag-name: ${{ matrix.python-version }} (${{ matrix.os }})
Expand All @@ -77,22 +76,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
# [pin v20201129]
uses: AndreMiras/coveralls-python-action@f5fd5c309b39d01599fb92c72d4f7409ea78aec9
# [pin @develop@20230609]
uses: AndreMiras/coveralls-python-action@65c1672f0b8a201702d86c81b79187df74072505
with:
parallel-finished: true

deploy:
needs: test
name: Deploy to PyPI
runs-on: ubuntu-latest
# Only from the origin repository, not forks; only master and tags.
if: github.repository_owner == 'prisae' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
# Only from the origin repository, not forks; only main and tags.
if: github.repository_owner == 'emsig' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# Need to fetch more than the last commit so that setuptools_scm can
# create the correct version string. If the number of commits since
Expand All @@ -108,37 +107,34 @@ jobs:
run: git fetch origin 'refs/tags/*:refs/tags/*'

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements-dev.txt
python -m pip install build setuptools-scm
- name: Build source and wheel distributions
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/main'
run: |
# Change setuptools-scm local_scheme to "no-local-version" so the
# local part of the version isn't included, making the version string
# compatible with Test PyPI.
sed --in-place "s/'root'/'local_scheme':'no-local-version','root'/g" setup.py
sed --in-place 's/version_file/local_scheme = "no-local-version"\nversion_file/g' pyproject.toml
- name: Build source and wheel distributions
run: |
# Build source and wheel packages
python setup.py sdist
python setup.py bdist_wheel
python -m build
echo ""
echo "Generated files:"
ls -lh dist/
- name: Publish to Test PyPI
if: success()
# Hash corresponds to v1.4.1
uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
Expand All @@ -150,8 +146,7 @@ jobs:
- name: Publish to PyPI
# Only for releases
if: success() && github.event_name == 'release'
# Hash corresponds to v1.4.1
uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __pycache__/
# Sphinx
docs/_build/
docs/examples/
docs/sg_execution_times.rst

# Pytest and coverage related
htmlcov
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ Changelog
#########


v0.2.1 : pyproject.toml
-----------------------

**2024-10-18**

Maintenance; changed from ``setup.py`` to ``pyproject.toml``.


v0.2.0 : First packaged release
-------------------------------

Expand Down
6 changes: 2 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
prune docs
prune tests
prune examples
exclude requirements.txt
exclude requirements-dev.txt
exclude .readthedocs.yml
exclude .gitignore
exclude .coveragerc
exclude .git_archival.txt
exclude .gitattributes
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
help:
@echo "Commands:"
@echo ""
@echo " install install in editable mode"
@echo " dev-install install in editable mode with dev requirements"
@echo " pytest run the test suite and report coverage"
@echo " flake8 style check with flake8"
@echo " html build docs (update existing)"
@echo " html-clean build docs (new, removing any existing)"
@echo " preview renders docs in Browser"
@echo " linkcheck check all links in docs"
@echo " clean clean up all generated files"
@echo ""

install:
python -m pip install -e .

dev-install:
python -m pip install -e .[all]

.ONESHELL:
pytest:
rm -rf .coverage htmlcov/ .pytest_cache/
pytest --cov=pyfftlog --mpl
coverage html

flake8:
flake8 docs/conf.py pyfftlog/ tests/ examples/

html:
cd docs && make html

html-clean:
cd docs && rm -rf examples/* _build/ && make html

preview:
xdg-open docs/_build/html/index.html

linkcheck:
cd docs && make linkcheck

clean:
python -m pip uninstall pyfftlog -y
rm -rf build/ dist/ .eggs/ pyfftlog.egg-info/ pyfftlog/version.py # build
rm -rf */__pycache__/ */*/__pycache__/ # python cache
rm -rf .coverage htmlcov/ .pytest_cache/ # tests and coverage
rm -rf docs/_build/ docs/examples/* # docs
rm docs/sg_execution_times.rst
27 changes: 5 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
.. image:: https://readthedocs.org/projects/pyfftlog/badge/?version=latest
:target: https://pyfftlog.readthedocs.io/en/latest
:alt: Documentation Status
.. image:: https://github.com/prisae/pyfftlog/workflows/pytest/badge.svg?branch=master
:target: https://github.com/prisae/pyfftlog/actions
:alt: GitHub Actions
.. image:: https://coveralls.io/repos/github/prisae/pyfftlog/badge.svg?branch=master
:target: https://coveralls.io/github/prisae/pyfftlog?branch=master
:alt: Coveralls
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3830364.svg
:target: https://doi.org/10.5281/zenodo.3830364
:alt: Zenodo DOI


.. sphinx-inclusion-marker
`pyfftlog` - A python version of FFTLog
=======================================

This is a python version of the logarithmic FFT code *FFTLog* as presented in
Appendix B of `Hamilton (2000)
<http://dx.doi.org/10.1046/j.1365-8711.2000.03071.x>`_ and published at
`casa.colorado.edu/~ajsh/FFTLog <http://casa.colorado.edu/~ajsh/FFTLog>`_.
<https://dx.doi.org/10.1046/j.1365-8711.2000.03071.x>`_ and published at
`jila.colorado.edu/~ajsh/FFTLog <https://jila.colorado.edu/~ajsh/FFTLog>`_.

A simple `f2py`-wrapper (`fftlog`) can be found on `github.com/prisae/fftlog
<https://github.com/prisae/fftlog>`_. Tests have shown that `fftlog` is a bit
Expand Down Expand Up @@ -62,8 +45,8 @@ Hankel transform.
The FFTLog algorithm was originally proposed by `Talman (1978)
<http://dx.doi.org/10.1016/0021-9991(78)90107-9>`_.

*For the full documentation, see* `casa.colorado.edu/~ajsh/FFTLog
<http://casa.colorado.edu/~ajsh/FFTLog>`_.
*For the full documentation, see* `jila.colorado.edu/~ajsh/FFTLog
<https://jila.colorado.edu/~ajsh/FFTLog>`_.


Installation
Expand Down Expand Up @@ -92,7 +75,7 @@ All releases have a Zenodo-DOI, which can be found on `10.5281/zenodo.3830364
<https://doi.org/10.5281/zenodo.3830364>`_.

Be kind and give credits by citing `Hamilton (2000)
<http://dx.doi.org/10.1046/j.1365-8711.2000.03071.x>`_. See the
<https://dx.doi.org/10.1046/j.1365-8711.2000.03071.x>`_. See the
`references-section
<https://pyfftlog.readthedocs.io/en/stable/references.html>`_ in the manual for
full references.
24 changes: 10 additions & 14 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import time
import warnings
from pyfftlog import __version__
from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey

# ==== 1. Extensions ====

Expand All @@ -26,16 +25,17 @@

# Sphinx gallery configuration
sphinx_gallery_conf = {
'examples_dirs': '../examples',
'gallery_dirs': 'examples',
'subsection_order': ExplicitOrder([
'../examples/contrib',
]),
'examples_dirs': [
'../examples',
],
'gallery_dirs': [
'examples',
],
'capture_repr': ('_repr_html_', '__repr__'),
# Patter to search for example files
"filename_pattern": r"\.py",
# Sort gallery example by file name instead of number of lines (default)
"within_subsection_order": FileNameSortKey,
"within_subsection_order": "FileNameSortKey",
# Remove the settings (e.g., sphinx_gallery_thumbnail_number)
'remove_config_comments': True,
# Show memory
Expand Down Expand Up @@ -88,7 +88,6 @@
html_theme = 'sphinx_rtd_theme'
html_theme_options = {
'logo_only': True,
'display_version': True,
'prev_next_buttons_location': 'both',
}
html_static_path = ['_static']
Expand All @@ -109,12 +108,9 @@
}

htmlhelp_basename = 'pyfftlogdoc'


# -- CSS fixes --
def setup(app):
app.add_stylesheet("style.css")

html_css_files = [
"style.css",
]

# ==== 4. Other Document Type Settings ====
# Options for LaTeX output
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pyfftlog
Version: |version| ~ Date: |today|

.. include:: ../README.rst
:start-after: sphinx-inclusion-marker

.. toctree::
:maxdepth: 2
Expand Down
2 changes: 1 addition & 1 deletion docs/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ References
power spectrum: Monthly Notices of the Royal Astronomical Society, 312,
pages 257--284; DOI: `10.1046/j.1365-8711.2000.03071.x
<https://doi.org/10.1046/j.1365-8711.2000.03071.x>`_; Website of FFTLog:
`casa.colorado.edu/~ajsh/FFTLog <http://casa.colorado.edu/~ajsh/FFTLog>`_.
`jila.colorado.edu/~ajsh/FFTLog <https://jila.colorado.edu/~ajsh/FFTLog>`_.
.. [Talm78] Talman, J. D., 1978, Numerical Fourier and Bessel transforms in
logarithmic variables: Journal of Computational Physics, 29, pages 35--48;
DOI: `10.1016/0021-9991(78)90107-9
Expand Down
4 changes: 2 additions & 2 deletions examples/contrib/sinetransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""
import pyfftlog
import numpy as np
import scipy.integrate
import scipy as sp
import matplotlib.pyplot as plt

###############################################################################
Expand Down Expand Up @@ -108,7 +108,7 @@
Recon_Fun = np.zeros((len(t)))
for i in range(len(t)):
Recon_Fun[i] = (np.sqrt(2/np.pi)**-1) * \
scipy.integrate.trapz(f, a_f*np.sin(t[i]*f))
sp.integrate.trapezoid(f, a_f*np.sin(t[i]*f))

# Plotting the input function and the reconstructed input function and also
# the distribution of the a(f) vs f.
Expand Down
2 changes: 1 addition & 1 deletion examples/fftlogtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This example is a translation of `fftlogtest.f` from the Fortran package
`FFTLog`, which was presented in Appendix B of [Hami00]_ and published at
http://casa.colorado.edu/~ajsh/FFTLog. It serves as an example for the python
https://jila.colorado.edu/~ajsh/FFTLog. It serves as an example for the python
package `pyfftlog` (which is a Python version of `FFTLog`), in the same manner
as the original file `fftlogtest.f` serves as an example for Fortran package
`FFTLog`.
Expand Down
Loading

0 comments on commit 7486a0d

Please sign in to comment.