Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .cz.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

[tool.commitizen]
name = "cz_github_jira_conventional"
tag_format = "v$major.$minor.$patch$prerelease"
version = "0.0.2"
version = "1.0.0b1"
version_files = [
"version.py"
"varsome_api/__init__.py:__version__",
"pyproject.toml:version",
]
jira_base_url = "https://saphetor.atlassian.net"
github_repo = "saphetor/varsome-api-client-python"
Expand Down
173 changes: 173 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

#jetbrains ide

.idea
.envrc

# Test files
tests/

# Documentation files
docs/

# Example files
examples/

# Github Actions
.github/
34 changes: 34 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
root = true

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

[*.cjs]
indent_size = 2
max_line_length = 80
tab_width = 2

[*.less]
indent_size = 2

[*.sass]
indent_size = 2

[*.scss]
indent_size = 2

[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}]
indent_size = 2

[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
max_line_length = 500

[{*.py,*.pyw,audit_trail}]
max_line_length = 88
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 88
72 changes: 72 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build and publish multi-arch image to GHCR on release

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag for manual build (e.g. 1.2.3 or latest)'
required: true
default: 'latest'

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Resolve image tag
id: vars
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
fi

- name: Set up QEMU (for multi-arch)
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# Semver tags (patch, minor, major) — only when tag looks like a version
type=semver,pattern={{version}},value=${{ steps.vars.outputs.tag }},enable=${{ startsWith(steps.vars.outputs.tag, 'v') || contains(steps.vars.outputs.tag, '.') }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.vars.outputs.tag }},enable=${{ startsWith(steps.vars.outputs.tag, 'v') || contains(steps.vars.outputs.tag, '.') }}
type=semver,pattern={{major}},value=${{ steps.vars.outputs.tag }},enable=${{ startsWith(steps.vars.outputs.tag, 'v') || contains(steps.vars.outputs.tag, '.') }}
# Always tag with the exact resolved value (e.g. v1.2.3 or 'latest')
type=raw,value=${{ steps.vars.outputs.tag }}

- name: Build and push (multi-arch)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
73 changes: 73 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Python Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read

strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libcurl4-openssl-dev \
libssl-dev \
libdeflate-dev

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-in-project: true

- name: Load cached venv
uses: actions/cache@v4
id: cache-venv
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: poetry install --with dev

- name: Run tests
run: |
if [ "${{ matrix.python-version }}" = "3.13" ]; then
poetry run pytest -v --junitxml=pytest-report.xml --no-cov
else
poetry run pytest -v --junitxml=pytest-report.xml
fi

- name: Publish Test Results
# Using EnricoMi/publish-unit-test-result-action@v2
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: pytest-report.xml
check_name: "Python Test Results (${{ matrix.python-version }})"
Loading
Loading