Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply new cookiecutter #79

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 113 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ jobs:
executor:
name: python-docker
version: <<parameters.version>>

steps:
- checkout
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
pip-dependency-file: requirements_dev.txt
# - run:
# name: Install System Dependencies
# command: sudo apt-get update && sudo apt-get install -y libsndfile1
- run:
name: install dependencies
command: pip install ".[tests]"
- run:
name: Run tests
command: pytest

flake:
ruff:
parameters:
version:
description: "version tag"
Expand All @@ -54,16 +55,14 @@ jobs:
executor:
name: python-docker
version: <<parameters.version>>

steps:
- checkout
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
pip-dependency-file: requirements_dev.txt
- run:
name: Flake8
command: flake8 spharpy
name: install dependencies
command: pip install ".[tests]"
- run:
name: ruff
command: ruff check

test_documentation_build:
parameters:
Expand All @@ -74,23 +73,41 @@ jobs:
executor:
name: python-docker
version: <<parameters.version>>

steps:
- checkout
- run:
name: Install System Dependencies
command: sudo apt-get update && sudo apt-get install -y dvipng
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
pip-dependency-file: requirements_dev.txt
# - run:
# name: Install System Dependencies
# command: sudo apt-get update && sudo apt-get install -y dvipng
- run:
name: Sphinx
command: |
pip install -e .
pip install ".[docs]"
cd docs/
make html SPHINXOPTS="-W"

test_deprecation_warnings:
parameters:
version:
description: "version tag"
default: "latest"
type: string
executor:
name: python-docker
version: <<parameters.version>>
steps:
- checkout
# - run:
# name: Install System Dependencies
# command: sudo apt-get update && sudo apt-get install -y libsndfile1 texlive-latex-extra dvipng
- run:
name: install dependencies
command: pip install ".[tests]"
- run: |
python --version
- run:
name: Run tests
command: pytest tests -W error::DeprecationWarning

test_pypi_publish:
parameters:
version:
Expand All @@ -100,18 +117,43 @@ jobs:
executor:
name: python-docker
version: <<parameters.version>>
steps:
- checkout
# - run:
# name: Install System Dependencies
# command: sudo apt-get update && sudo apt-get install -y libsndfile1
- run:
name: install dependencies
command: pip install ".[deploy]"
- run:
name: deploy
command: | # create whl, install twine and publish to Test PyPI
python -m build
twine check dist/*

run_pypi_publish:
parameters:
version:
description: "version tag"
default: "latest"
type: string
executor:
name: python-docker
version: <<parameters.version>>
steps:
- checkout
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
pip-dependency-file: requirements_dev.txt
- run:
name: Install System Dependencies
command: sudo apt-get update && sudo apt-get install -y libsndfile1
- run:
name: install dependencies
command: pip install ".[deploy]"
- run:
name: deploy
command: | # create whl, install twine and publish to Test PyPI
python setup.py sdist bdist_wheel
twine upload --verbose dist/*
python -m build
twine check dist/*
twine upload dist/*

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
Expand All @@ -128,22 +170,39 @@ workflows:
- "3.10"
- "3.11"
- "3.12"
- flake:
- "3.13"

- ruff:
matrix:
parameters:
version:
- "3.9"
- "3.12"
requires:
- build_and_test

- test_documentation_build:
matrix:
parameters:
version:
- "3.9"
- "3.12"
requires:
- build_and_test

- test_deprecation_warnings:
matrix:
parameters:
version:
- "3.13"
requires:
- build_and_test

- test_pypi_publish:
matrix:
parameters:
version:
- "3.12"
requires:
- build_and_test

test_and_publish:
# Test and publish on new git version tags
Expand All @@ -158,18 +217,20 @@ workflows:
- "3.10"
- "3.11"
- "3.12"
- "3.13"

filters:
branches:
ignore: /.*/
# only act on version tags
tags:
only: /^v[0-9]+(\.[0-9]+)*$/

- flake:
- ruff:
matrix:
parameters:
version:
- "3.9"
- "3.12"
requires:
- build_and_test
filters:
Expand All @@ -183,7 +244,7 @@ workflows:
matrix:
parameters:
version:
- "3.9"
- "3.12"
requires:
- build_and_test
filters:
Expand All @@ -193,15 +254,30 @@ workflows:
tags:
only: /^v[0-9]+(\.[0-9]+)*$/

- test_pypi_publish:
- test_deprecation_warnings:
matrix:
parameters:
version:
- "3.9"
- "3.13"
requires:
- build_and_test
filters:
branches:
ignore: /.*/
# only act on version tags
tags:
only: /^v[0-9]+(\.[0-9]+)*$/

- run_pypi_publish:
matrix:
parameters:
version:
- "3.12"
requires:
- build_and_test
- flake
- ruff
- test_documentation_build
- test_deprecation_warnings
filters:
branches:
ignore: /.*/
Expand Down
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.yml]
indent_size = 2

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## General

* spharpy version:
* Python version:
* Operating System:
* Did you install spharpy via pip:

## Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

## What I Did

```
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Which issue(s) are closed by this pull request?

Closes #

### Changes proposed in this pull request:

-
-
-
25 changes: 25 additions & 0 deletions .github/workflows/create_issue_if_cookiecutter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
pull_request:
types: [ labeled ]
name: Create issue if pr gets a cookiecutter label
jobs:
stuff:
permissions:
contents: read
issues: write
name: create issue
environment: test
if: github.event.label.name == 'cookiecutter'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: 'pyfar/cookiecutter-pypackage'
- uses: dacbd/create-issue-action@v2
with:
title: ${{ github.event.pull_request.title }}
token: ${{ secrets.cookiecutter_PAT }}
owner: pyfar
repo: cookiecutter-pypackage
body: |
apply changes from https://github.com/${{ github.repository }}/pull/${{ github.event.number }}
29 changes: 29 additions & 0 deletions .github/workflows/has_version_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR Check Label for version Label

on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize

jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: Check for version label
run: |
echo "Checking for version label on pull request..."
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
LABEL_NAMES=$(echo "$PR_DATA" | jq -r '.labels[].name')
echo "Labels: $LABEL_NAMES"

REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
MATCHES=$(echo "$LABEL_NAMES" | grep -E "$REGEX")
if [ -z "$MATCHES" ]; then
echo "Error: No version label found on this pull request. Please add a label in the format vX.Y.Z."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading