Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Jul 18, 2023
0 parents commit e629bca
Show file tree
Hide file tree
Showing 27 changed files with 3,047 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# show coverage in CI status, not as a comment.
comment: off
coverage:
status:
project:
default:
target: auto
patch:
default:
target: auto
13 changes: 13 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[run]
source =
diffpy/pdfitc_api_tools
[report]
omit =
*/python?.?/*
*/site-packages/nose/*
# ignore _version.py and versioneer.py
.*version.*
*_version.py

exclude_lines =
if __name__ == '__main__':
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
exclude =
.git,
__pycache__,
build,
dist,
versioneer.py,
diffpy/pdfitc_api_tools/_version.py,
docs/source/conf.py
max-line-length = 115
# Ignore some style 'errors' produced while formatting by 'black'
ignore = E203, W503
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
diffpy/pdfitc_api_tools/_version.py export-subst
59 changes: 59 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build Documentation

on:
push:
pull_request:
workflow_dispatch:

jobs:
build_docs:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
fail-fast: false

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

steps:
- name: Set env vars
run: |
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 1000 # should be enough to reach the most recent tag

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install documentation-building requirements
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
# These packages are installed in the base environment but may be older
# versions. Explicitly upgrade them because they often create
# installation problems if out of date.
python -m pip install --upgrade pip setuptools numpy
pip install .
pip install -r requirements-dev.txt
pip list
- name: Build Docs
run: make -C docs/ html

- uses: actions/upload-artifact@v3
with:
name: ${{ env.REPOSITORY_NAME }}-docs
path: docs/build/html/
19 changes: 19 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pre-commit

on:
pull_request:
push:
workflow_dispatch:

jobs:
pre-commit:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
with:
extra_args: --all-files
39 changes: 39 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using flit when a release is
# created. For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: PyPI upload

on:
release:
types: [created]

jobs:
publish_pypi:
name: Publish package to PyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine setuptools
- name: Build and publish
env:
TWINE_USERNAME: __token__
# The PYPI_PASSWORD must be a pypi token with the "pypi-" prefix with sufficient permissions to upload this package
# https://pypi.org/help/#apitoken
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
59 changes: 59 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Unit Tests

on:
push:
pull_request:
workflow_dispatch:
# schedule:
# - cron: '00 4 * * *' # daily at 4AM

jobs:
run_tests:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ${{ matrix.host-os }}
strategy:
matrix:
host-os: ["ubuntu-latest"]
# host-os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
fail-fast: false

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

steps:
- name: Set env vars
run: |
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV
- name: Checkout the code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
# These packages are installed in the base environment but may be older
# versions. Explicitly upgrade them because they often create
# installation problems if out of date.
python -m pip install --upgrade pip setuptools numpy
pip install .
pip install -r requirements-dev.txt
pip list
- name: Test with pytest
run: |
set -vxeuo pipefail
coverage run -m pytest -vv -s
coverage report -m
82 changes: 82 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
venv/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/build/
docs/source/generated/

# pytest
.pytest_cache/

# PyBuilder
target/

# Editor files
# mac
.DS_Store
*~

# vim
*.swp
*.swo

# pycharm
.idea/

# VSCode
.vscode/

# Ipython Notebook
.ipynb_checkpoints
4 changes: 4 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[settings]
line_length = 115
multi_line_output = 3
include_trailing_comma = True
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
13 changes: 13 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=======
Credits
=======

Maintainer
----------

* diffpy <[email protected]>

Contributors
------------

None yet. Why not be the first? See: CONTRIBUTING.rst
Loading

0 comments on commit e629bca

Please sign in to comment.