Skip to content

Commit

Permalink
MAINT(cfg): Refactor configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSWang committed Sep 10, 2024
1 parent 86ca5a6 commit fce377c
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 24 deletions.
6 changes: 4 additions & 2 deletions .github/autolabels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ build:
- any-glob-to-any-file:
- setup.py
- setup.cfg
- pyproject.toml
- .pyproject.toml
- .pyproject_cuda.toml
- Makefile
- MANIFEST.in
- deploy/pkg/**/*
Expand All @@ -29,7 +30,8 @@ maintenance:
- any-glob-to-any-file:
- setup.py
- setup.cfg
- pyproject.toml
- .pyproject.toml
- .pyproject_cuda.toml
- Makefile
- MANIFEST.in
- NOTES.md
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
- name: Install packaging requirements
run: python -m pip install --upgrade build twine

- name: Copy Python project configuration file
run: cp .pyproject.toml pyproject.toml

- name: Build source distribution
run: python -m build --sdist --outdir dist/ .

Expand Down Expand Up @@ -139,12 +142,15 @@ jobs:
echo "MACOSX_VERS_MIN=10.15" >> "${GITHUB_ENV}"
fi
- name: Copy Python project configuration file
run: cp .pyproject.toml pyproject.toml

- name: Build built distribution
uses: pypa/cibuildwheel@v2.20.0
with:
package-dir: .
output-dir: dist/
config-file: .pyproject.toml
config-file: pyproject.toml
env:
# # Default to GCC compiler and OpenMP on macOS.
# # HACK: Hardcode g++ compiler choice on recent GitHub macOS
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/cd_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: Jimver/cuda-toolkit@master
id: cuda-toolkit
with:
log-file-suffix: '${{matrix.os}}_cudatoolkit_log.txt'
method: 'network'
sub-packages: '["nvcc", "cufft"]'

- name: Set up Python 3
uses: actions/setup-python@v5
with:
Expand All @@ -74,12 +67,15 @@ jobs:
- name: Install packaging requirements
run: python -m pip install --upgrade twine

- name: Copy Python project configuration file
run: cp .pyproject_cuda.toml pyproject.toml

- name: Build built distribution
uses: pypa/cibuildwheel@v2.20.0
with:
package-dir: .
output-dir: dist/
config-file: .pyproject_cuda.toml
config-file: pyproject.toml
env:
CIBW_ENVIRONMENT: >-
PY_CXX=nvcc
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/cd_xp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,15 @@ jobs:
echo "MACOSX_VERS_MIN=10.15" >> "${GITHUB_ENV}"
fi
- name: Copy Python project configuration file
run: cp .pyproject.toml pyproject.toml

- name: Build built distribution
uses: pypa/cibuildwheel@v2.20.0
with:
package-dir: .
output-dir: dist/
config-file: .pyproject.toml
config-file: pyproject.toml
env:
# Specify target architecture.
CIBW_ARCHS_LINUX: ${{ env.TARGET_ARCH_ALT }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ on:
- tests/**
- setup.py
- setup.cfg
- pyproject.toml
- .pyproject.toml
- .pyproject_cuda.toml
- MANIFEST.in
- Makefile
- .gitignore
Expand All @@ -29,7 +30,8 @@ on:
- tests/**
- setup.py
- setup.cfg
- pyproject.toml
- .pyproject.toml
- .pyproject_cuda.toml
- MANIFEST.in
- Makefile
- .gitignore
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ repos:
# hooks:
# - id: docformatter
# additional_dependencies: ['tomli']
# args: ['--in-place', '--config', './pyproject.toml']
# args: ['--in-place', '--config', './.pyproject.toml']

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand All @@ -99,7 +99,7 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: ['--write-changes']
args: ['--write-changes', '--toml', './.pyproject.toml']
additional_dependencies:
- tomli

Expand Down
7 changes: 1 addition & 6 deletions .pyproject_cuda.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ manylinux-aarch64-image = 'manylinux_2_28'

[tool.cibuildwheel.linux]
before-all = [
"yum install -y gsl-devel fftw3-devel",
]

[tool.cibuildwheel.macos]
before-all = [
"brew install gsl fftw libomp",
"yum install -y gsl-devel cuda-toolkit",
]

[tool.autopep8]
Expand Down
33 changes: 33 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
target-version = 'py310'
line-length = 79
exclude = [
".eggs",
".git",
".git-rewrite",
".ipynb_checkpoints",
".nox",
".pyenv",
".pytest_cache",
".ruff_cache",
".tox",
".venv",
".vscode",
"__pypackages__",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

[lint]
fixable = ['ALL']
unfixable = []

# [format]
# quote-style = 'preserve'
# indent-style = 'space'
# line-ending = 'auto'
# skip-magic-trailing-comma = true
# docstring-code-format = false
# docstring-code-line-length = 'dynamic'
5 changes: 3 additions & 2 deletions deploy/pkg/prerelease_ops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#

THIS_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
CONFIG_FILE="${THIS_DIR}/../../.pyproject.toml"
export PYTHONPATH="${PYTHONPATH}:${THIS_DIR}"

semantic-release -v changelog 2> /dev/null
semantic-release -v --noop version # 2> /dev/null
semantic-release -v --config ${CONFIG_FILE} changelog 2> /dev/null
semantic-release -v --config ${CONFIG_FILE} --noop version # 2> /dev/null
24 changes: 24 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,27 @@ minversion = 7.0
addopts = --full-trace --verbose --capture=no --runslow
testpaths =
tests

[pycodestyle] # AKA: tool.autopep8
in-place = true
recursive = true
aggressive = 3
max_line_length = 79
ignore = E226

[tool:numpydoc_validation]
checks = all,ES01,EX01,GL01,GL02,GL03,GL06,RT02,SA01,SS06,
exclude = test_.*,\.__init__$,\.__repr__$,\.__str__$,\.__hash__$,\.__len__$,\.__getitem__$,\.__eq__$,\.__le__$,\.__lt__$,\.__gt__$,\.__ge__$,

# [docformatter]
# recursive = true
# wrap-summaries = 72
# wrap-descriptions = 72
# blank = true
# close-quotes-on-newline = true

# [codespell]
# skip = publication/joss/paper.bib,
# ignore-words-list = ERRO,
# count = true
# quiet-level = 3

0 comments on commit fce377c

Please sign in to comment.