Skip to content

Commit

Permalink
Init (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted authored Apr 4, 2024
1 parent a51ccd7 commit d7ef373
Show file tree
Hide file tree
Showing 11 changed files with 813 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/ruff-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "ruff",
"pattern": [
{
"regexp": "^(.*):(\\d+):(\\d+):\\s([\\da-zA-Z]+)\\s(.*)$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
]
}
]
}
56 changes: 56 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]

jobs:
test:
name: test
runs-on: ubuntu-22.04
env:
working-directory: ./
poetry-version: "1.8.2"
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
defaults:
run:
working-directory: ${{ env.working-directory }}

steps:
- uses: actions/checkout@v3

- name: Set up Poetry
uses: bakdata/ci-templates/actions/python-setup-poetry@1.45.1
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.poetry-version }}
working-directory: ${{ env.working-directory }}

- name: Install dependencies
run: poetry install --no-interaction

- name: Lint (ruff)
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" && "${{ matrix.python-version }}" == "3.10" ]]
then
echo "::add-matcher::.github/ruff-matcher.json"
poetry run ruff check . --config pyproject.toml --output-format text --no-fix
else
poetry run pre-commit run ruff-lint --all-files --show-diff-on-failure
fi;
- name: Formatting (ruff)
run: poetry run pre-commit run ruff-format --all-files --show-diff-on-failure

- name: Typing (pyright)
run: poetry run pre-commit run pyright --all-files

- name: Test
run: poetry run pytest tests
38 changes: 38 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish
# Template adapted from https://github.com/bakdata/ci-templates/tree/main/.github/workflows#python-poetry-release

on:
workflow_dispatch:
inputs:
release-type:
description: "Scope of the release; see https://python-poetry.org/docs/cli/#version"
type: choice
required: true
default: patch
options:
- patch
- minor
- major

jobs:
release:
name: release
uses: bakdata/ci-templates/.github/workflows/python-poetry-release.yaml@1.45.1
with:
release-type: ${{ github.event.inputs.release-type }}
publish-to-test: true
python-version: "3.12"
poetry-version: "1.8.2"
# working-directory: "./"
secrets:
github-email: ${{ secrets.GH_EMAIL }}
github-username: ${{ secrets.GH_USERNAME }}
github-token: ${{ secrets.GH_TOKEN }}
pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}

print-version:
name: print-version
runs-on: ubuntu-22.04
needs: release
steps:
- run: echo "Bumped Version from ${{ needs.release.outputs.old-tag }} to ${{ needs.release.outputs.release-tag }}"
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
repos:
- repo: local
hooks:
- id: ruff-lint
name: ruff-lint
entry: ruff check
args:
[
--force-exclude,
--config,
pyproject.toml,
--fix,
--show-fixes,
--exit-non-zero-on-fix,
]
language: system
types_or: [python]
require_serial: true # run once for all files
- id: ruff-format
name: ruff-format
entry: ruff format
args: [--force-exclude, --config, pyproject.toml]
language: system
types_or: [python]
require_serial: true # run once for all files
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
require_serial: true # run once for all files
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contributing

We are happy if you want to contribute to this project. If you find any bugs or have suggestions for improvements, please open an issue. We are also happy to accept your PRs. Just open an issue beforehand and let us know what you want to do and why.

## Development setup

1. Clone the repository and navigate inside the new directory.

2. Install dependencies using [Poetry](https://python-poetry.org)

```sh
poetry install
```

3. Install the pre-commit hooks for linting and to enforce a consistent code style.

```sh
pre-commit install
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) bakdata

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# template-python-poetry
# project-name

Short description about the project.

## Usage

```sh
pip install <package>
```

```python
# instructions how to use the package
import package

...
```

## Development

See our [contribution guide](CONTRIBUTING.md)
Empty file added package_name/__init__.py
Empty file.
Loading

0 comments on commit d7ef373

Please sign in to comment.