Skip to content

Commit

Permalink
Hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoklosowski committed Oct 23, 2024
0 parents commit 3530b49
Show file tree
Hide file tree
Showing 29 changed files with 1,041 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "pytest-moto-fixtures",

"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bookworm",
"features": {
"ghcr.io/devcontainers-contrib/features/poetry:2": {"version": "1.8.4"}
},

"mounts": [
{
"type": "bind",
"source": "/etc/localtime",
"target": "/etc/localtime"
}
],
"portsAttributes": {
"8010": {
"label": "Documentation",
"onAutoForward": "notify"
}
},

"postCreateCommand": "./.devcontainer/setup.sh",

"customizations": {
"vscode": {
"extensions": [
"editorconfig.editorconfig",
"tamasfe.even-better-toml",
"charliermarsh.ruff",
"matangover.mypy"
],
"settings": {
"python.defaultInterpreterPath": "./.venv/bin/python",
"ruff.importStrategy": "fromEnvironment",
"mypy.runUsingActiveInterpreter": true,
"mypy.targets": ["src", "tests"],
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["-vv", "tests"],
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
}
}
17 changes: 17 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -xe

# Config poetry
poetry config virtualenvs.in-project true
[ -e .venv ] || poetry env use /usr/local/bin/python

# Completion
pipx install argcomplete
mkdir -p ~/.local/share/bash-completion/completions
echo 'eval "$(pip completion --bash)"' > ~/.local/share/bash-completion/completions/pip
echo 'eval "$(register-python-argcomplete pipx)"' > ~/.local/share/bash-completion/completions/pipx
echo 'eval "$(poetry completions bash)"' > ~/.local/share/bash-completion/completions/poetry

# Init project
make init
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab

[*.{json,toml,yaml,yml}]
indent_size = 2
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

- package-ecosystem: pip
directory: /
schedule:
interval: monthly
108 changes: 108 additions & 0 deletions .github/workflows/check-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Check Commit

on:
workflow_dispatch:
push:
pull_request:

permissions:
contents: read

jobs:
lint:
name: Check Lints
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup poetry
run: pipx install poetry==1.8.4

- name: Generate datefile
run: echo "lint-$(date +%U)" > datefile

- name: Setup python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: |
pyproject.toml
datefile
- name: Install dependencies
if: steps.setup-python.outputs.cache-hit != 'true'
run: poetry install --sync --only=main,type,dev

- name: Run lints
run: make lint

test:
name: Check Test
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup poetry
run: pipx install poetry==1.8.4

- name: Generate datefile
run: echo "test-$(date +%U)" > datefile

- name: Setup python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: |
pyproject.toml
datefile
- name: Install dependencies
if: steps.setup-python.outputs.cache-hit != 'true'
run: poetry install --sync --only=main,dev

- name: Run tests
run: make test

docs:
name: Check Docs
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup poetry
run: pipx install poetry==1.8.4

- name: Generate datefile
run: echo "docs-$(date +%U)" > datefile

- name: Setup python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry
cache-dependency-path: |
pyproject.toml
datefile
- name: Install dependencies
if: steps.setup-python.outputs.cache-hit != 'true'
run: poetry install --sync --only=main,type,docs

- name: Check build
run: make docs
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: read

jobs:
build-package:
name: Build Package
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Setup build
run: pip install build

- name: Build packages
run: python -m build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: dist
if-no-files-found: error

github-release:
name: Release on GitHub
needs: build-package
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: dist

- name: Make release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/*.whl
fail_on_unmatched_files: true

pypi-publish:
name: Publish on PyPI
needs: github-release
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/p/pytest-moto-fixtures
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: dist

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Python
*.py[cod]
__pycache__

# Development tools
/.venv
/poetry.lock
/dist
/.ruff_cache
/.mypy_cache
/.pytest_cache
/.coverage
/.coverage.*
/htmlcov

# Docs
/docs/source/src
/docs/build

# Editors
*.swp
/.idea
/.vscode

# Others
.DS_Store
19 changes: 19 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2

build:
os: ubuntu-24.04
tools:
python: "3.10"
jobs:
post_create_environment:
- curl -sSL https://install.python-poetry.org | python3 - --version 1.8.4
- $HOME/.local/bin/poetry config virtualenvs.create false
pre_install:
- $HOME/.local/bin/poetry export --only=docs -o requirements.txt

python:
install:
- requirements: requirements.txt

sphinx:
configuration: docs/source/conf.py
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2024 Eduardo Klosowski

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.
Loading

0 comments on commit 3530b49

Please sign in to comment.