Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 30 additions & 57 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
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
schedule:
- cron: "14 14 20 * *"

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

jobs:
test:
Expand All @@ -19,19 +26,13 @@ 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"]

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 @@ -42,92 +43,64 @@ jobs:
# to be able to push to GitHub.
persist-credentials: false

# Need the tags so that setuptools_scm can form a valid version number
- name: Fetch git tags
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
pip install -e .
python -m pip install .[tests]

- name: Flake8
run: flake8 src/ tests/

- name: Test with pytest
run: pytest --cov=fftlog --flake8
run: pytest --cov=fftlog

deploy:
needs: test
name: Deploy to PyPI
runs-on: ubuntu-latest
# Only from the origin repository, not forks; only master.
if: github.repository_owner == 'prisae' && github.ref == 'refs/heads/master'
# 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
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
# the last release is greater than this, the version will still be
# wrong. Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false

# Need the tags so that setuptools_scm can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
uses: actions/checkout@v4

- 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 numpy
pip install -r requirements-dev.txt
python -m pip install build

- name: Build source and wheel distributions
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/

# # fftlog currently does not use setuptools_scm, hence the version
# # number has to be adjusted manually; too cumbersome.
# - name: Publish to Test PyPI
# if: success()
# # Hash corresponds to v1.4.1
# uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_PASSWORD }}
# repository_url: https://test.pypi.org/legacy/
# # Allow existing releases on test PyPI without errors.
# # NOT TO BE USED in PyPI!
# skip_existing: true

- 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 }}
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
#########


v0.2.2 : Update home and build backend
--------------------------------------

No code changes. What changed:
- Moved from github.com/prisae to github.com/emsig.
- Ported build from distutils to meson (thanks @jokva).


v0.2.1 : Fix packaging
----------------------

Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. image:: https://github.com/prisae/fftlog/workflows/pytest/badge.svg?branch=master
:target: https://github.com/prisae/fftlog/actions
.. image:: https://github.com/emsig/fftlog/workflows/pytest/badge.svg?branch=master
:target: https://github.com/emsig/fftlog/actions
:alt: GitHub Actions
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3830534.svg
:target: https://doi.org/10.5281/zenodo.3830534
Expand All @@ -13,8 +13,8 @@ This is a simple `f2py`-wrapper for the logarithmic FFT code *FFTLog* as
presented in Appendix B of [Hami00]_ and published at
`casa.colorado.edu/~ajsh/FFTLog <http://casa.colorado.edu/~ajsh/FFTLog>`_.

A pure python version (`pyfftlog`) can be found on `github.com/prisae/pyfftlog
<https://github.com/prisae/pyfftlog>`_. Tests have shown that `fftlog` is a bit
A pure python version (`pyfftlog`) can be found on `github.com/emsig/pyfftlog
<https://github.com/emsig/pyfftlog>`_. Tests have shown that `fftlog` is a bit
faster than `pyfftlog`, but `pyfftlog` is easier to implement, as you only need
`NumPy` and `SciPy`, without the need to compile anything.

Expand All @@ -28,7 +28,7 @@ test from the original code, and my use case, which is `pyfftlog.fftl` with
(forward). Please let me know if you encounter any issues.

- **Documentation**: https://pyfftlog.readthedocs.io
- **Source Code**: https://github.com/prisae/fftlog
- **Source Code**: https://github.com/emsig/fftlog

**Note** that the documentation is for the pure python version `pyfftlog`, but
equally applies to `fftlog`.
Expand Down
8 changes: 0 additions & 8 deletions fftlog/__init__.py

This file was deleted.

56 changes: 56 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
project('fftlog', 'c')
# fortran_std=legacy?
add_languages('fortran')

if meson.get_compiler('fortran').get_id() == 'gcc'
# Allow argument mismatch, otherwise (newer, probably >= 10) gfortran throws
# Error: Type mismatch in argument ‘ifac’ at (1); passed REAL(8) to INTEGER(4)
add_global_arguments('-fallow-argument-mismatch',
language: ['fortran'])
endif

py = import('python')
py3 = py.find_installation()

f2py_name = '_fftlog'
f2py_module_c = f'@[email protected]'
f2py_wrapper_f = f'@[email protected]'
f2py_dep = custom_target(
'f2py wrappers',
input: 'src/fftlog.pyf',
output: [f2py_module_c, f2py_wrapper_f],
command: [py3, '-m', 'numpy.f2py', '@INPUT@',
'--build-dir', '@OUTDIR@', ],
)

incdir_numpy = run_command(py3,
['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'],
check : true
).stdout().strip()
incdir_f2py = run_command(py3,
['-c', 'import os; os.chdir(".."); import numpy.f2py; print(numpy.f2py.get_include())'],
check : true
).stdout().strip()
inc_np = include_directories(incdir_numpy, incdir_f2py)

py3.extension_module('_fftlog',
[f2py_dep,
incdir_f2py / 'fortranobject.c',
'src/cdgamma.f',
'src/drfftb.f',
'src/drfftf.f',
'src/drffti.f',
'src/fftlog.f',
],
link_language: 'fortran',
include_directories: inc_np,
install : true,
subdir: 'fftlog',
)

py3.install_sources([
'src/__init__.py',
],
pure: false,
subdir: 'fftlog',
)
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
build-backend = "mesonpy"
requires = [
"meson-python",
"numpy",
"wheel",
"charset_normalizer",
]

[project]
name = "fftlog"
description = "A python wrapper for FFTLog"
readme = "README.rst"
version = "0.2.2dev1" # also in __init__.py
authors = [
{name = "The emsig community", email = "[email protected]"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
]
dependencies = [
"numpy",
"scipy",
]

[project.license]
file = "LICENSE"

[project.optional-dependencies]
tests = [
"flake8",
"pytest",
"coveralls",
"pytest_cov",
"flake8-pyproject",
]
all = [
"fftlog[tests]",
]

[project.urls]
Repository = "https://github.com/prisae/fftlog"
8 changes: 0 additions & 8 deletions requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

60 changes: 0 additions & 60 deletions setup.py

This file was deleted.

8 changes: 8 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from fftlog._fftlog import fhti, fftl, fht, fhtq

__all__ = ['fhti', 'fftl', 'fht', 'fhtq']

# Version
# Not currently using setuptools_scm, as in pyfftlog, because of numpy-setup.
# Has to be adjusted in pyproject.toml too!
__version__ = '0.2.2dev1'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading