Skip to content

Commit

Permalink
Initial generation with Copier
Browse files Browse the repository at this point in the history
  • Loading branch information
shippy committed Mar 31, 2024
0 parents commit f34d9f2
Show file tree
Hide file tree
Showing 21 changed files with 2,276 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.3.0
_src_path: gh:lukin0110/poetry-copier.git
ci: github
description: A Python package for ingesting job descriptions & resumes, and crafting
cover letters that use the latter to satisfy the former
name: Cover Letter Automation
package_type: package
repository_url: https://github.com/shippy/cover_letter_automation/
use_makefile: true
use_private_package_repository: false
use_private_publish_repository: false
use_pydantic: true
66 changes: 66 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "cover_letter_automation",
"dockerComposeFile": "../docker-compose.yml",
"service": "devcontainer",
"runServices": [
"devcontainer"
],
"shutdownAction": "stopCompose",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/cover_letter_automation/,type=bind,consistency=delegated",
"workspaceFolder": "/workspaces/cover_letter_automation/",
"remoteUser": "root",
"overrideCommand": true,
"initializeCommand": "touch ${localWorkspaceFolder}/.env",
"mounts": [
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,consistency=consistent"
],
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"eamodio.gitlens",
"github.copilot",
"ms-azuretools.vscode-docker",
"ms-python.mypy-type-checker",
"ms-python.python",
"ryanluker.vscode-coverage-gutters",
"tamasfe.even-better-toml",
"visualstudioexptteam.vscodeintellicode"
],
"settings": {
"coverage-gutters.coverageFileNames": [
"reports/coverage.xml"
],
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"editor.formatOnSave": true,
"editor.rulers": [
100
],
"editor.tabSize": 4,
"files.autoSave": "onFocusChange",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[toml]": {
"editor.formatOnSave": false
},
"mypy-type-checker.importStrategy": "fromEnvironment",
"python.defaultInterpreterPath": "/opt/cover_letter_automation-env/bin/python",
"python.terminal.activateEnvironment": false,
"python.testing.pytestEnabled": true,
"remote.containers.copyGitConfig": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.logLevel": "warn",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Exclude files and directories from the build context.
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
.mypy_cache/
.pytest_cache/
.ruff_cache/
.git/
tests/
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly
versioning-strategy: lockfile-only
allow:
- dependency-type: "all"
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Configure the following variables in your repository secrets:
# POETRY_PYPI_TOKEN_PYPI
#
# The POETRY_PYPI_TOKEN_PYPI must be created on: https://pypi.org/manage/account/token/
#
name: Publish package

on:
release:
types:
- created

jobs:
publish:
name: Publish
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11.6"

- name: Install Poetry
run: pip install --no-input poetry==1.7.1

- name: Publish package
run: |
poetry config pypi-token.pypi "${{ secrets.POETRY_PYPI_TOKEN_PYPI }}"
poetry publish --build
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# By default, GitHub Actions don't have permission to write to the ghcr.io registry.
# - Go to: Settings (of this repository) -> Actions -> General -> Workflow permissions
# - Enable: Read and write permissions
name: Lint and Test

on:
push:
branches:
- main
- master
pull_request:

jobs:
test:
runs-on: ubuntu-latest
permissions: write-all
strategy:
matrix:
python-version: [ "3.11.6" ]
name: Python ${{ matrix.python-version }}
env:
TAG: devcontainer-${{ matrix.python-version }}-${{ github.head_ref || github.ref_name }}
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v4

# Add an empty .env file.
# The devcontainers/ci build action fails when the docker-compose.yml file references an .env file that does not exist.
- name: Touch .env
run: touch .env

# https://github.com/docker/login-action
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/devcontainers/ci
- name: Build DevContainer
uses: devcontainers/[email protected]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
with:
imageName: ghcr.io/${{ github.repository }}
cacheFrom: ghcr.io/${{ github.repository }}:${{ env.TAG }}
imageTag: ${{ env.TAG }}
push: always

- name: Run lint
uses: devcontainers/[email protected]
with:
cacheFrom: ghcr.io/${{ github.repository }}:${{ env.TAG }}
push: never
runCmd: poe lint

- name: Run test
uses: devcontainers/[email protected]
with:
cacheFrom: ghcr.io/${{ github.repository }}:${{ env.TAG }}
push: never
runCmd: poe test

# https://github.com/codecov/codecov-action
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: reports/coverage.xml
env:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Unit test / coverage reports
htmlcov/
.pytest_cache/
reports/

# Ruff
.ruff_cache/

# Jupyter Notebook
.ipynb_checkpoints

# Environments
.env
.venv/

# mypy
.mypy_cache/


# PyCharm
.idea/
88 changes: 88 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# https://pre-commit.com
default_language_version:
python: python3.11
default_install_hook_types: [commit-msg, pre-commit]
default_stages: [commit, manual]
fail_fast: true
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-mock-methods
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-merge-conflict
args: [--assume-in-merge]
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
types: [python]
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
args: [--pytest-test-first]
- id: trailing-whitespace
types: [python]
- repo: local
hooks:
- id: forbidden-files
name: forbidden files
entry: found Copier update rejection files; review them and remove them
language: fail
files: "\\.rej$"
- id: ruff-check
name: ruff check
entry: poetry run ruff check
require_serial: true
language: system
types_or: [python, pyi]
- id: ruff-format
name: ruff format
entry: poetry run ruff format
require_serial: true
language: system
types_or: [python, pyi]
- id: shellcheck
name: shellcheck
entry: poetry run shellcheck
args: [--check-sourced]
language: system
types: [shell]
- id: poetry-check
name: poetry check
entry: poetry check
language: system
pass_filenames: false
- id: poetry-check-lock
name: poetry check lock
entry: poetry check
args: [--lock]
language: system
pass_filenames: false
- id: mypy
name: mypy
entry: poetry run mypy
language: system
types: [python]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.6
Loading

0 comments on commit f34d9f2

Please sign in to comment.