Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam committed Aug 27, 2022
0 parents commit c913ffd
Show file tree
Hide file tree
Showing 23 changed files with 4,887 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = True

[*]
end_of_line = lf
insert_final_newline = True
indent_style = space
indent_size = 4
trim_trailing_whitespace = True

[*.py]
charset = utf-8

[*.{yml,yaml,md,toml}]
indent_size = 2

[Makefile]
indent_style = tab
79 changes: 79 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI
on:
push:
branches:
- main
pull_request:

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
name: Static analysis
uses: less-action/reusables/.github/workflows/pre-commit.yaml@v2
with:
python-version: "3.10"

check-build:
name: Check packaging metadata
uses: less-action/reusables/.github/workflows/python-test-build.yaml@v2

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11-dev"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: ${{ runner.os }}-pip
- run: pip install -e '.[test]'
- run: coverage run -m pytest
- run: |
coverage report
coverage xml
# - uses: codecov/codecov-action@v2
# with:
# file: coverage.xml
# fail_ci_if_error: true
# name: codecov-py${{ matrix.python-version }}

check-generate-currencies:
name: Check currencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11-dev"
- name: pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('generate-requirements.txt') }}
restore-keys: ${{ runner.os }}-pip
- run: pip install -r generate-requirements.txt
- run: |
python generate-currencies.py
diff=$(git --no-pager diff)
if [[ ! -z "$diff" ]]; then
echo "💥 Non-empty output from git diff."
echo
echo "$diff"
exit 1
else
echo "✅ No diff to current currency module."
fi
11 changes: 11 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Release

on:
release:
types: [published]

jobs:
build-and-publish:
uses: less-action/reusables/.github/workflows/python-publish.yaml@v2
secrets:
pypi_api_token: ${{ secrets.PYPI_API_TOKEN }}
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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/
pip-wheel-metadata/
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/

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

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__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/
104 changes: 104 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.3.0"
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- id: detect-private-key
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.4.0"
hooks:
- id: editorconfig-checker
alias: ec
args:
- -disable-indent-size
- repo: https://github.com/asottile/pyupgrade
rev: "v2.37.3"
hooks:
- id: pyupgrade
args:
- --py310-plus
- repo: https://github.com/myint/autoflake
rev: "v1.4"
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --ignore-init-module-imports
- repo: https://github.com/pycqa/isort
rev: "5.10.1"
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: "22.6.0"
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: "v1.12.1"
hooks:
- id: blacken-docs
additional_dependencies: ["black==22.3.0"]
- repo: https://gitlab.com/pycqa/flake8
rev: "5.0.4"
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==22.8.23
- flake8-comprehensions==3.10.0
- flake8-tidy-imports==4.8.0
- repo: https://github.com/sirosen/check-jsonschema
rev: "0.17.1"
hooks:
- id: check-github-workflows
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.971"
hooks:
- id: mypy
args: ["--strict"]
pass_filenames: false
additional_dependencies:
- pytest==7.1.2
- types-setuptools==65.3.0
- phantom-types==0.17.1
- abcattrs==0.3.2
- typing-extensions==4.3.0
- hypothesis==6.54.4
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
- id: prettier
alias: format-markdown
types: [markdown]
args:
- --parser=markdown
- --print-width=88
- --prose-wrap=always
- repo: https://github.com/mgedmin/check-manifest
rev: "0.48"
hooks:
- id: check-manifest
args: ["--no-build-isolation"]

exclude: |
(?x)(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.pytest_cache
| \.nox
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
)
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2022, Anton Agestam
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 changes: 11 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exclude Makefile
exclude .editorconfig
recursive-exclude .github *
recursive-exclude tests *
recursive-include src py.typed
exclude *.yaml
exclude *.yml
include README.md
include LICENSE
exclude generate-currencies.py
exclude generate-requirements.txt
Loading

0 comments on commit c913ffd

Please sign in to comment.