Skip to content

Commit 87f7b79

Browse files
authored
init repo (#1)
* init repo * fix * add pytest-recording * setup auto version * add 3.11
1 parent 7e622af commit 87f7b79

26 files changed

+1804
-0
lines changed

.github/workflows/python-package.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: python-unittest
5+
on:
6+
push:
7+
branches: ["**"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.10", "3.11"]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install Poetry & export Requirements
24+
run: |
25+
curl -sSL https://install.python-poetry.org | python3 -
26+
- name: Install dependencies
27+
run: |
28+
bash ./scripts/build.sh
29+
pip install -r ./requirements-test.txt
30+
- name: Lint with pre-commit
31+
run: |
32+
poetry run pre-commit run --all-files
33+
- name: Test with pytest
34+
run: |
35+
poetry run pytest ./src --cov=./src --record-mode=none
36+
env: # Or as an environment variable
37+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
38+
- name: Coveralls
39+
uses: coverallsapp/github-action@v2

.github/workflows/python-publish.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Set up Python
25+
uses: actions/setup-python@v3
26+
with:
27+
python-version: "3.x"
28+
- name: Install Poetry & export Requirements
29+
run: |
30+
curl -sSL https://install.python-poetry.org | python3 -
31+
poetry self add poetry-dynamic-versioning[plugin]
32+
- name: Build package
33+
run: poetry build
34+
- name: Publish package
35+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
36+
with:
37+
user: __token__
38+
password: ${{ secrets.PYPI_API_TOKEN }}

.pre-commit-config.yaml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
# - id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-json
8+
- id: check-merge-conflict
9+
- id: check-yaml
10+
- id: end-of-file-fixer
11+
- id: fix-encoding-pragma
12+
args: [--remove]
13+
- id: mixed-line-ending
14+
- id: trailing-whitespace
15+
args: [--markdown-linebreak-ext=md]
16+
exclude: "__snapshots__/"
17+
# this is not technically always safe but usually is
18+
# use comments `# isort: off` and `# isort: on` to disable/re-enable isort
19+
- repo: https://github.com/pycqa/isort
20+
rev: 5.12.0
21+
hooks:
22+
- id: isort
23+
args: [--line-length=240, --profile=black]
24+
25+
# this is slightly dangerous because python imports have side effects
26+
# and this tool removes unused imports, which may be providing
27+
# necessary side effects for the code to run
28+
- repo: https://github.com/PyCQA/autoflake
29+
rev: v1.6.1
30+
hooks:
31+
- id: autoflake
32+
args:
33+
- "--in-place"
34+
- "--expand-star-imports"
35+
- "--remove-duplicate-keys"
36+
- "--remove-unused-variables"
37+
- "--remove-all-unused-imports"
38+
39+
- repo: https://github.com/psf/black
40+
rev: 22.8.0
41+
hooks:
42+
- id: black
43+
args: [--line-length=240, --exclude=""]
44+
45+
- repo: local
46+
hooks:
47+
- id: mypy
48+
name: mypy
49+
entry: mypy
50+
language: system
51+
types: [python]
52+
exclude: migrations/|commands/|scripts/
53+
args:
54+
[
55+
--pretty,
56+
--show-error-codes,
57+
--implicit-optional,
58+
--follow-imports=silent,
59+
--warn-redundant-casts,
60+
--warn-unused-ignores,
61+
--disallow-any-generics,
62+
--check-untyped-defs,
63+
--no-implicit-reexport,
64+
--disallow-untyped-defs,
65+
]

poetry.lock

+952
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[tool.poetry]
2+
name = "fuzy-jon"
3+
version = "0.0.0"
4+
description = ""
5+
authors = ["lucemia <[email protected]>"]
6+
readme = "README.md"
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.10"
10+
11+
[tool.poetry.group.test.dependencies]
12+
syrupy = "^4.0.2"
13+
pytest-cov = "^4.1.0"
14+
coveralls = "^3.3.1"
15+
pytest-recording = "^0.12.2"
16+
17+
18+
[tool.poetry.group.dev.dependencies]
19+
pre-commit = "^3.5.0"
20+
mypy = "^1.6.1"
21+
22+
[tool.poetry-dynamic-versioning]
23+
enable = true
24+
pattern = "default-unprefixed"
25+
26+
[build-system]
27+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
28+
build-backend = "poetry_dynamic_versioning.backend"

scripts/build.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# basic reference for writing script for travis
3+
4+
set -ev
5+
6+
poetry export --without-hashes -f requirements.txt -o requirements.txt
7+
poetry export --without-hashes --with test,dev -f requirements.txt -o requirements-test.txt

src/fuzzy_json/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .decoder import loads
2+
3+
__all__ = ["loads"]

0 commit comments

Comments
 (0)