Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fetch models #1

Merged
merged 19 commits into from
Sep 25, 2023
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# 4 space indentation
[*.{py,java,r,R}]
indent_style = space
indent_size = 4

# 2 space indentation
# [*.{js,json,y{a,}ml,html,cwl}]
# indent_style = space
# indent_size = 2

[*.{md,Rmd,rst}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2
187 changes: 187 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
name: CI

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


permissions:
checks: write
id-token: write
contents: write

jobs:
pre-commit:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Pre-commit checks
uses: pre-commit/action@v3.0.0
env:
SKIP: no-commit-to-branch

test:
permissions: write-all
name: Tests
runs-on: ubuntu-latest
services:
arango:
image: arangodb
ports:
- 8529:8529
env:
ARANGO_NO_AUTH: '1'



outputs:
release-id: ${{ steps.generate-release-id.outputs.release-id }}
steps:
- name: Checkout the code
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: cache poetry install
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-1.1.12-0

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: false
installer-parallel: true


- name: cache deps
id: cache-deps
uses: actions/cache@v3
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

# Install dependencies. `--no-root` means "install all dependencies but not the project
# itself", which is what you want to avoid caching _your_ code. The `if` statement
# ensures this only runs on a cache miss.
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

- run: poetry install --no-interaction

- name: test

run: |
poetry run pytest --cov=pydango --cov-report=xml:coverage.xml --junitxml=test-results/test-results.xml tests


- name: Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: '**/test-results/*.xml'



- name: Coverage Report
uses: 5monkeys/cobertura-action@master
if: success() || failure()
with:
path: coverage.xml
minimum_coverage: 75
fail_below_threshold: true



release:
name: Release
if: github.ref == 'refs/heads/main'
needs:
- test
runs-on: ubuntu-latest
concurrency: release

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: cache deps
id: cache-deps
uses: actions/cache@v3
with:
path: /semantic-release
key: semantic-release


- name: cache poetry install
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-1.1.12-0

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: false
installer-parallel: true

- name: Python Semantic Release
id: semver
uses: python-semantic-release/python-semantic-release@v8.0.8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- run: |
poetry build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
if: steps.semver.outputs.released == 'true'

with:
name: python-package-distributions
path: dist/

outputs:
released: ${{ steps.semver.outputs.released }}

publish:
name: Publish
needs:
- pre-commit
- release
if: needs.release.outputs.released == 'true'
concurrency: release
runs-on: ubuntu-latest

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI

uses: pypa/gh-action-pypi-publish@release/v1

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
40 changes: 0 additions & 40 deletions .github/workflows/python-package.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ cython_debug/
__pycache__
.idea
local
stubs/*
59 changes: 39 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
fail_fast: false
default_stages:
- commit
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.7.0
rev: v3.13.0
hooks:
- id: pyupgrade
args:
Expand All @@ -17,15 +18,15 @@ repos:
- --profile=black


- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
args:
- --config=pyproject.toml

- repo: https://github.com/myint/autoflake
rev: v2.1.1
rev: v2.2.1
hooks:
- id: autoflake
exclude: .*/__init__.py
Expand All @@ -36,10 +37,10 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables

- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.2
hooks:
- id: autopep8
# - repo: https://github.com/pre-commit/mirrors-autopep8
# rev: v2.0.4
# hooks:
# - id: autopep8

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand All @@ -48,13 +49,13 @@ repos:
- id: python-check-blanket-noqa

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.275'
rev: v0.0.291
hooks:
- id: ruff
args:
- --config
- ./pyproject.toml # args:
# - --fix
- ./pyproject.toml
- --fix

- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
Expand All @@ -65,22 +66,25 @@ repos:
args:
- -c
- pyproject.toml
- --quiet
additional_dependencies:
- bandit[toml]
- toml

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.0
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies:
- 'pydantic'
- mypy-extensions
- pydantic==1.10.12
- pytest~=7.3.1
- httpx~=0.18.2
- pydiction~=0.1.0
- pytest-asyncio~=0.21.0



# - repo: https://github.com/jendrikseipp/vulture
# rev: v2.7
# hooks:
# - id: vulture
# pass_filenames: true

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand All @@ -99,8 +103,23 @@ repos:


- repo: https://github.com/python-poetry/poetry
rev: '1.5.0'
rev: 1.4.0
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
args:
- --no-update
# - id: poetry-export


- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args:
- --offset
- '2'
- --mapping
- '2'
- --sequence
- '4'
Loading