Skip to content

Commit

Permalink
Migrate to pyproject.toml (gwpy#354)
Browse files Browse the repository at this point in the history
* Migrate to pyproject.toml and newer versions of python, remove versioneer

* Implemented Duncan's suggestions

---------

Co-authored-by: Evan Goetz <[email protected]>
  • Loading branch information
eagoetz and Evan Goetz authored Nov 1, 2023
1 parent 330fa6d commit b5559a4
Show file tree
Hide file tree
Showing 21 changed files with 217 additions and 2,473 deletions.
10 changes: 0 additions & 10 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ engines:
config:
languages:
- python
- javascript
eslint:
enabled: true
fixme:
enabled: true
config:
Expand All @@ -17,19 +14,12 @@ engines:
enabled: true
radon:
enabled: true
scss-lint:
enabled: true

ratings:
paths:
- "**.py"
- "share/js/*.js"
- "share/sass/*.scss"

exclude_paths:
- ez_setup.py
- versioneer.py
- gwsumm/_version.py
- docs/*
- gwsumm/tests/*
- gwsumm/html/markup.py
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
exclude =
__pycache__,
.eggs/,
.git/,
build/,
docs/,
gwsumm/_version.py,
per-file-ignores =
__init__.py:F401,
23 changes: 11 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
- macOS
- Ubuntu
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ${{ matrix.os }}-latest

# this is needed for conda environments to activate automatically
Expand Down Expand Up @@ -79,16 +78,16 @@ jobs:

- name: Install dependencies
run: |
python3 -c "
import configparser;
conf = configparser.ConfigParser();
conf.read('setup.cfg');
for opt in ('setup_requires', 'install_requires', 'tests_require'):
print(conf['options'].get(opt, '').strip().lower())
for opt in ('options.extras_require'):
print(conf['options'].get(opt, '').strip().lower())
" | sort -u > _requirements.txt
mamba install --quiet --yes --name test --file _requirements.txt
# parse requirements to install as much as possible with conda
mamba create --name pip2conda pip2conda
mamba run -n pip2conda pip2conda \
--all \
--output environment.txt \
--python-version ${{ matrix.python-version }}
echo "-----------------"
cat environment.txt
echo "-----------------"
mamba install --quiet --yes --name test --file environment.txt
- name: Install GWSumm
run: python -m pip install . --no-build-isolation -vv
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ on:
branches:
- main
- master
- release/**
pull_request:
branches:
- main
- master
- release/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
flake8:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/gwsumm.egg-info
.DS_store
*.pyc
/gwsumm/version.py
/gwsumm/_version.py
/docs/_build
/docs/_generated
/docs/api/modules.rst
Expand Down
Empty file removed .gitmodules
Empty file.
7 changes: 5 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: "ubuntu-22.04"
tools:
python: "3.11"
python: "mambaforge-22.9"

conda:
environment: docs/environment.yml

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include LICENSE README.rst MANIFEST.in
include versioneer.py setup.py
include gwsumm/_version.py
recursive-include share *.ini
include gwsumm/config/*.ini
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
autosummary_generate = True
autoclass_content = 'class'
autodoc_default_flags = ['show-inheritance', 'members']
primary_domain = 'gwsumm'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -326,7 +327,6 @@ def run_apidoc(_):
'css/custom.css',
]


# -- setup --------------------------------------------------------------------

def setup(app):
Expand Down
33 changes: 33 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: gwsumm
channels:
- conda-forge
dependencies:
# build
- pip
- setuptools
- setuptools-scm
- wheel
# install
- astropy >=3.0.0
- gwdatafind >=1.1.1
- gwdetchar >=2.0.0
- gwpy >=3.0.0
- gwtrigfind
- lalsuite
- ligo-segments
- lscsoft-glue >=1.60.0
- lxml
- markdown
- MarkupPy
- matplotlib >=3.1
- numpy >=1.16
- pygments >=2.7.0
- python-dateutil
- python-ligo-lw
- scipy >=1.2.0
# docs
- numpydoc
- sphinx
- sphinx-automodapi
- sphinx_bootstrap_theme
- sphinxcontrib-programoutput
15 changes: 11 additions & 4 deletions gwsumm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@
globalv, # creates global variables
units, # registers custom units
)
from ._version import get_versions

__author__ = 'Duncan Macleod <[email protected]>'
__version__ = get_versions()['version']
try:
from ._version import version as __version__
except ModuleNotFoundError:
try:
import setuptools_scm
__version__ = setuptools_scm.get_version(fallback_version='?.?.?')
except (ModuleNotFoundError, TypeError, LookupError):
__version__ = '?.?.?'

del get_versions
__author__ = 'Duncan Macleod <[email protected]>'
__credits__ = ('Alex Urban <[email protected]>, ',
'Evan Goetz <[email protected]>')
Loading

0 comments on commit b5559a4

Please sign in to comment.