Skip to content

Commit

Permalink
Merge pull request #20 from BCDA-APS/15-APS-U-update
Browse files Browse the repository at this point in the history
update project for APS-U
  • Loading branch information
prjemian committed Apr 13, 2024
2 parents 14b0a37 + 3f219db commit 5e9248c
Show file tree
Hide file tree
Showing 28 changed files with 422 additions and 2,833 deletions.
18 changes: 0 additions & 18 deletions .flake8

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Set update schedule for GitHub Actions
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
100 changes: 100 additions & 0 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Unit Tests & Code Coverage

on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # allow manual triggering

defaults:
run:
shell: bash -l {0}

jobs:
lint:
name: Code style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: ruff
uses: chartboost/ruff-action@v1

matrix:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
# - "3.12" # TODO: dm package not ready
max-parallel: 5

steps:
- uses: actions/checkout@v4

- name: Create Python ${{ matrix.python-version }} environment
uses: mamba-org/setup-micromamba@v1
with:
cache-environment: true
cache-environment-key: env-key-${{ matrix.python-version }}
condarc: |
channel-priority: flexible
environment-file: environment.yml
environment-name: anaconda-test-env-py-${{ matrix.python-version }}
create-args: >-
caproto
coveralls
pytest
pytest-cov
python=${{ matrix.python-version }}
setuptools-scm
- name: Run tests with pytest & coverage
shell: bash -l {0}
run: |
set -vxeuo pipefail
coverage run --concurrency=thread --parallel-mode -m pytest -vvv --exitfirst .
coverage combine
coverage report --precision 3
- name: Upload coverage data to coveralls.io
shell: bash -l {0}
run: |
set -vxeuo pipefail
micromamba list coveralls
which coveralls
coveralls debug
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true

# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
coveralls:
name: Report unit test coverage to coveralls
needs: matrix
runs-on: ubuntu-latest
container: python:3-slim

steps:
- name: Gather coverage and report to Coveralls
run: |
set -vxeuo pipefail
echo "Finally!"
pip3 install --upgrade coveralls
# debug mode: output prepared json and reported files list to stdout
# https://coveralls-python.readthedocs.io/en/latest/troubleshooting.html
coveralls debug
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 changes: 71 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish Sphinx docs to GitHub Pages
# see: https://github.com/marketplace/actions/sphinx-to-github-pages

on:
# Build the docs on pushes to main branch, PRs to main branch, and new tags.
# Publish only on demand.
push:
branches:
- main
tags:
- '*' # all tags
pull_request:
branches:
- main
workflow_dispatch: # allow manual triggering
inputs:
deploy:
description: 'Deploy documentation'
type: boolean
required: true
default: false

defaults:
run:
shell: bash -l {0}

jobs:

pages:
name: Publish documentation
runs-on: ubuntu-latest

steps:

- name: Deploy Information
if: ${{ github.event.inputs.deploy }}
run: |
echo "The docs will be published from this workflow run."
# - name: Install pandoc
# run: |
# sudo apt-get update && \
# sudo apt-get -y install pandoc

- name: Set time zone
run: echo "TZ=America/Chicago" >> "$GITHUB_ENV"

# TODO: review requirements
- name: Sphinx build
id: deployment
uses: sphinx-notes/pages@v3
with:
documentation_path: ./docs/source
publish: false
python_version: "3.11"
requirements_path: ./docs/requirements.txt

- name: Diagnostic
run: ls -lAFgh ${{ steps.deployment.outputs.artifact }}

- name: Upload Docs ZIP file as artifact
uses: actions/upload-artifact@v4
with:
name: apsbss-docs
path: ${{ steps.deployment.outputs.artifact }}

- uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event.inputs.deploy }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ steps.deployment.outputs.artifact }}
54 changes: 54 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI

on:
# Triggers the workflow on push events but only for the main branch
push:
branches:
- main
tags:
- "*" # all tags

jobs:
pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Install twine
run: >-
python -m
pip install
twine
- name: Check package metadata
run: >-
twine check dist/*
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

76 changes: 15 additions & 61 deletions apsbss/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
"""Configuration of apsbss package."""

__project__ = "apsbss"

try:
from setuptools_scm import get_version

__version__ = get_version(root="..", relative_to=__file__)
del get_version
except (LookupError, ModuleNotFoundError):
from importlib.metadata import version

__version__ = version(__project__)
del version

# -----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: jemian@anl.gov
Expand All @@ -7,64 +22,3 @@
#
# The full license is in the file LICENSE.txt, distributed with this software.
# -----------------------------------------------------------------------------

__project__ = u"apsbss"
__description__ = (
u"Read-only interface to information from APS Proposal"
u" and ESAF (experiment safety approval form) databases."
)
__copyright__ = u"2017-2022, UChicago Argonne, LLC"
__authors__ = [
u"Pete Jemian",
]
__author__ = ", ".join(__authors__)
__institution__ = u"Advanced Photon Source, Argonne National Laboratory"
__author_email__ = u"jemian@anl.gov"
__url__ = u"https://BCDA-APS.github.io/apsbss"
__license__ = u"(c) " + __copyright__
__license__ += u" (see LICENSE.txt file for details)"
__platforms__ = "any"
__zip_safe__ = False
__exclude_project_dirs__ = ["docs", ]
__python_version_required__ = ">=3.7"

__package_name__ = __project__
__long_description__ = __description__

from ._requirements import (
learn_requirements,
) # lgtm [py/import-own-module]

__install_requires__ = learn_requirements()
del learn_requirements

__classifiers__ = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: Freely Distributable",
"License :: Public Domain",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
# "Programming Language :: Python :: 3.8",
# "Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Embedded Systems",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: Visualization",
"Topic :: Software Development",
"Topic :: Utilities",
]

from ._version import get_versions # lgtm [py/import-own-module]

__version__ = get_versions()["version"]
del get_versions
40 changes: 0 additions & 40 deletions apsbss/_requirements.py

This file was deleted.

Loading

0 comments on commit 5e9248c

Please sign in to comment.