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

Pre commit ci #30

Merged
merged 5 commits into from
Mar 16, 2023
Merged
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
12 changes: 6 additions & 6 deletions copier.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# see https://copier.readthedocs.io/en/stable/configuring/

### Settings ###
_min_copier_version: "6.0.0"
_min_copier_version: "7.0.0"
_subdirectory: project-template
_templates_suffix: "" # empty suffix will process all files
_jinja_extensions:
Expand All @@ -12,15 +12,15 @@ _jinja_extensions:

full_name:
type: str
help: Enter your full name. This will appear in the License generated and `setup.py`'s authors field.
help: Enter your full name. This will appear in the License generated and `pyproject.toml`'s authors field.

github_username:
email:
type: str
help: You Github username or organization name under which the projects lives.
help: Your E-mail address. This will appear in the License generated and `pyproject.toml`'s authors field.

email:
github_username:
type: str
help: Your E-mail address. This will appear in the License generated and `setup.py`'s authors field.
help: You Github username or organization name under which the projects lives.

project_name:
type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,36 @@ on:

jobs:
testing:
# reuse workflow definitions
uses: xonsh/actions/.github/workflows/test-pip-xontrib.yml@main
with:
cache-dependency-path: pyproject.toml
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
steps:
- uses: actions/checkout@v3
{%- if package_manager == 'poetry' %}
- name: Install poetry
run: pipx install poetry
{% endif -%}
{% raw %}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }} {% endraw %}
cache: {% if package_manager == 'poetry' %}poetry{% else %}pip{% endif %}
cache-dependency-path: pyproject.toml

- uses: pre-commit/action@v3.0.0
- name: Install dependencies
run: {% if package_manager == 'poetry' %}poetry install{% else %}pip install ".[dev]"{% endif %}
- name: Run tests
run: |
xonsh -c "xontrib load {{ project_package_name}}"
poetry run pytest
10 changes: 10 additions & 0 deletions project-template/{{ project_repo_name }}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ xontrib load {{project_package_name}}

...

## Development
{% if enable_pre_commit_hooks %}
- activate [pre-commit](https://github.com/pre-commit/pre-commit) hooks
```sh
# install pre-commit plugins and activate the commit hook
pre-commit install
pre-commit autoupdate
```
{% endif %}

## Releasing your package

- Bump the version of your package.
Expand Down
7 changes: 4 additions & 3 deletions project-template/{{ project_repo_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ xontrib = ["*.xsh"]
{% endif %}
{% endif %}

[tool.isort]
profile = "black"

[tool.black]
include = '\.pyi?$'
force-exclude = '''
Expand All @@ -121,3 +118,7 @@ force-exclude = '''
| disk-cache.sqlite3
)/
'''

[tool.ruff]
# Enable flake8-bugbear (`B`) rules.
select = ["E", "F", "B"]
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: ""
hooks:
- id: isort
args: [
"--filter-files", # skip files that are excluded in config file
"--profile=black",
"--skip=migrations"
]
- id: ruff

- repo: https://github.com/ambv/black
rev: 22.3.0
rev: ""
hooks:
- id: black
language_version: python3.8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.941" # Use the sha / tag you want to point at
rev: "" # Use the sha / tag you want to point at
hooks:
- id: mypy
args: [ "--allow-untyped-globals", "--ignore-missing-imports" ]
additional_dependencies: [ types-all ]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: ""
hooks:
- id: trailing-whitespace
- id: check-yaml
Expand All @@ -32,23 +27,8 @@ repos:
- id: debug-statements
- id: check-added-large-files

- repo: https://github.com/pycqa/flake8
rev: "4.0.1" # pick a git hash / tag to point to
hooks:
- id: flake8
args: [ "--ignore=E501,W503,W504,E203,E251,E266,E401,E126,E124,C901" ]
additional_dependencies: [
'flake8-bugbear',
]

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: pyupgrade
args:
- "--py37-plus"
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v1.2.0
rev: ""
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
Expand Down