Skip to content

Commit

Permalink
Update copier template to v1.4.4 (#10)
Browse files Browse the repository at this point in the history
* Temp remove readme.

* Update copier to 1.4.4

* Address odd merges in pre-commit
  • Loading branch information
delucchi-cmu authored Nov 6, 2023
1 parent 7bf94f0 commit 6758426
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 52 deletions.
4 changes: 3 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Changes here will be overwritten by Copier
_commit: v1.4.1
_commit: v1.4.4
_src_path: gh:lincc-frameworks/python-project-template
author_email: [email protected]
author_name: LINCC Frameworks Team
create_example_module: false
custom_install: true
include_benchmarks: false
include_docs: false
mypy_type_checking: none
package_name: lf_asv_formatter
preferred_linter: pylint
project_license: MIT
project_name: lf-asv-formatter
project_organization: lincc-frameworks
use_gitlfs: none
use_isort: true
14 changes: 7 additions & 7 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ on:
pull_request:
branches: [ main ]

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

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
Expand All @@ -30,6 +30,6 @@ jobs:
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analyze code with linter

run: |
pylint -rn -sn --recursive=y ./src --rcfile=./src/.pylintrc
pylint -rn -sn --recursive=y ./tests --rcfile=./tests/.pylintrc
34 changes: 34 additions & 0 deletions .github/workflows/pre-commit-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow runs pre-commit hooks on pull requests to enforce coding style.
# To ensure correct configuration, please refer to:
# https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html

name: Run pre-commit hooks

on:
pull_request:

jobs:
pre-commit-ci:
runs-on: ubuntu-latest
env:
SKIP: "check-lincc-frameworks-template-version,pytest-check,no-commit-to-branch,validate-pyproject,check-added-large-files,sphinx-build"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- uses: pre-commit/[email protected]
with:
extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
- uses: pre-commit-ci/[email protected]
if: always()
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# For more information see: https://github.com/pypa/gh-action-pypi-publish#trusted-publishing

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ name: Unit test smoke test
on:
schedule:
- cron: 45 6 * * *

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
Expand Down
55 changes: 25 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fail_fast: true
repos:

# Compare the local template version to the latest remote template version
Expand All @@ -22,22 +23,7 @@ repos:
language: system
entry: jupyter nbconvert --clear-output

# Run unit tests, verify that they pass. Note that coverage is run against
# the ./src directory here because that is what will be committed. In the
# github workflow script, the coverage is run against the installed package
# and uploaded to Codecov by calling pytest like so:
# `python -m pytest --cov=<package_name> --cov-report=xml`
- repo: local
hooks:
- id: pytest-check
name: Run unit tests
description: Run unit tests with pytest.
entry: bash -c "if python -m pytest --co -qq; then python -m pytest --cov=./src --cov-report=html; fi"
language: system
pass_filenames: false
always_run: true

# prevents committing directly branches named 'main' and 'master'.
# Prevents committing directly branches named 'main' and 'master'.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand All @@ -49,23 +35,24 @@ repos:
description: Prevent the user from committing very large files.
args: ['--maxkb=500']

# verify that pyproject.toml is well formed
# Verify that pyproject.toml is well formed
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
description: Verify that pyproject.toml adheres to the established schema.


# Automatically sort the imports used in .py files
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python files in src/ and tests/)
description: Sort and organize imports in .py files.
types: [python]
files: ^(src|tests)/
name: Run isort
description: Sort and organize imports in .py and .pyi files.
types_or: [python, pyi]



# Analyze the src code style and report code that doesn't adhere.
Expand All @@ -76,33 +63,41 @@ repos:
entry: pylint
language: system
types: [python]
files: ^(src|tests)/
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10
files: ^src/
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=src/.pylintrc",
]

# Analyze the tests code style and report code that doesn't adhere.
- repo: local
hooks:
- id: pylint
name: pylint (python files in tests/)
name: pylint (python files in tests/ and benchmarks/)
entry: pylint
language: system
types: [python]
files: ^tests/
files: ^(tests|benchmarks)/
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=tests/.pylintrc",
]


# Run unit tests, verify that they pass. Note that coverage is run against
# the ./src directory here because that is what will be committed. In the
# github workflow script, the coverage is run against the installed package
# and uploaded to Codecov by calling pytest like so:
# `python -m pytest --cov=<package_name> --cov-report=xml`
- repo: local
hooks:
- id: pytest-check
name: Run unit tests
description: Run unit tests with pytest.
entry: bash -c "if python -m pytest --co -qq; then python -m pytest --cov=./src --cov-report=html; fi"
language: system
pass_filenames: false
always_run: true
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@

[![Template](https://img.shields.io/badge/Template-LINCC%20Frameworks%20Python%20Project%20Template-brightgreen)](https://lincc-ppt.readthedocs.io/en/latest/)

[![PyPI](https://img.shields.io/pypi/v/lf-asv-formatter?color=blue&logo=pypi&logoColor=white)](https://pypi.org/project/lf-asv-formatter/)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/lincc-frameworks/lf-asv-formatter/smoke-test.yml)](https://github.com/lincc-frameworks/lf-asv-formatter/actions/workflows/smoke-test.yml)
[![codecov](https://codecov.io/gh/lincc-frameworks/lf-asv-formatter/branch/main/graph/badge.svg)](https://codecov.io/gh/lincc-frameworks/lf-asv-formatter)

Simple script to re-format the output of ASV (air-speed-velocity) benchmarking
outputs for use in github messages.
outputs for use in github messages.

## Acknowledgements

LINCC Frameworks is supported by Schmidt Futures, a philanthropic initiative
founded by Eric and Wendy Schmidt, as part of the Virtual Institute of
Astrophysics (VIA).
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ dev = [
"pylint", # Used for static linting of files
]

[metadata]
long_description = { file = "README.md" }
url = "https://github.com/lincc-frameworks/lf-asv-formatter"

[build-system]
requires = [
"setuptools>=62", # Used to build and package the Python project
Expand Down
13 changes: 7 additions & 6 deletions src/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ good-names=i,
k,
ex,
Run,
ra,
_

# Good variable names regexes, separated by a comma. If names match any regex,
Expand Down Expand Up @@ -277,19 +278,19 @@ exclude-too-few-public-methods=
ignored-parents=

# Maximum number of arguments for function / method.
max-args=5
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=7
max-attributes=20

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=12
max-branches=20

# Maximum number of locals for function / method body.
max-locals=15
max-locals=20

# Maximum number of parents for a class (see R0901).
max-parents=7
Expand Down Expand Up @@ -329,7 +330,7 @@ indent-after-paren=4
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=100
max-line-length=110

# Maximum number of lines in a module.
max-module-lines=1000
Expand Down Expand Up @@ -502,7 +503,7 @@ ignore-imports=yes
ignore-signatures=yes

# Minimum lines number of a similarity.
min-similarity-lines=4
min-similarity-lines=6


[SPELLING]
Expand Down
13 changes: 7 additions & 6 deletions tests/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ good-names=i,
k,
ex,
Run,
ra,
_

# Good variable names regexes, separated by a comma. If names match any regex,
Expand Down Expand Up @@ -277,19 +278,19 @@ exclude-too-few-public-methods=
ignored-parents=

# Maximum number of arguments for function / method.
max-args=5
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=7
max-attributes=20

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=12
max-branches=20

# Maximum number of locals for function / method body.
max-locals=15
max-locals=30

# Maximum number of parents for a class (see R0901).
max-parents=7
Expand Down Expand Up @@ -329,7 +330,7 @@ indent-after-paren=4
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=100
max-line-length=110

# Maximum number of lines in a module.
max-module-lines=1000
Expand Down Expand Up @@ -503,7 +504,7 @@ ignore-imports=yes
ignore-signatures=yes

# Minimum lines number of a similarity.
min-similarity-lines=4
min-similarity-lines=6


[SPELLING]
Expand Down

0 comments on commit 6758426

Please sign in to comment.