Skip to content

Commit

Permalink
http_toolkit_v1 (#2)
Browse files Browse the repository at this point in the history
* http_toolkit_v1
---------

Co-authored-by: Станислав Михайлов <mikhailov.si.skbkontur.ru>
  • Loading branch information
kretatusha authored Oct 9, 2024
1 parent c305787 commit b1cc59f
Show file tree
Hide file tree
Showing 73 changed files with 5,559 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/actions/python-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
102 changes: 102 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: http-toolkit-build-and-push
on:
workflow_run:
workflows:
- http-toolkit-test
types:
- completed
branches:
- 'main'
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_DEPENDENCIES: "build~=0.10.0"
steps:
- uses: actions/checkout@v4
- name: python-build
uses: ./.github/actions/python-build
- name: install-dependencies
run: python3 -m pip install $BUILD_DEPENDENCIES $PUSH_DEPENDENCIES
- name: build
run: |
ls .
python -m build
- name: store-dist
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/http_toolkit
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
check-release-exists:
needs:
- publish-to-pypi
runs-on: ubuntu-latest
outputs:
release-exists: ${{ steps.check-release.outputs.release-exists }}
steps:
- uses: actions/checkout@v4
- name: Release Existence Action
id: check-release
uses: insightsengineering/[email protected]
with:
release-tag: ${{github.ref_name}}
github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- check-release-exists
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
if: ${{ needs.check-release-exists.outputs.release-exists == 'false' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: http-toolkit-test
on: [push]
env:
TEST_DEPENDENCIES: "tox~=4.15.1"
jobs:
check-project-files:
runs-on: ubuntu-latest
steps:
- name: variables
run: |
PROJECT_FILES=(README.md pyproject.toml tox.ini)
ERROR=0
- name: test
run: |
for file in ${PROJECT_FILES[*]}; do
if ! [ -f $file ]; then
echo "$file not found in project"
ERROR=1
fi
done
exit $ERROR
lint:
runs-on: ubuntu-latest
strategy:
matrix:
linters: [pyproject, flake8, mypy]
steps:
- uses: actions/checkout@v4
- name: python-build
uses: ./.github/actions/python-build
- name: install-dependencies
run: |
python3 -m pip install --upgrade pip
pip install $TEST_DEPENDENCIES
- name: test
run: tox -e "${{ matrix.linters }}"
test:
runs-on: ubuntu-latest
strategy:
matrix:
minor_versions: [9, 10, 11, 12, 13]
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.${{ matrix.minor_versions }}'
- name: install-dependencies
run: |
python3 -m pip install --upgrade pip
pip install $TEST_DEPENDENCIES
- name: test
run: tox -e "py3${{ matrix.minor_versions }}"





129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Created by https://www.gitignore.io/api/python

### Python ###
# 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/
*.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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

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

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# 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/

### Python Patch ###
.venv/

### Python.VirtualEnv Stack ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json


### PyCharm ###
.idea/

# tox envname junit/coverage reports
/.reports
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

### 1.0.0

**Date:** [08.10.24]

* Library for creating HTTP clients to various services with flexible transport customization
Loading

0 comments on commit b1cc59f

Please sign in to comment.