Skip to content

Commit

Permalink
update *
Browse files Browse the repository at this point in the history
  • Loading branch information
grizz committed Jan 20, 2024
1 parent f6d59e9 commit 52be01a
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 215 deletions.
77 changes: 17 additions & 60 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,80 +7,37 @@ jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
# virtualenvs-path: ~/.venv

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
# install dependencies if cache does not exist
- name: Check cache and install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- uses: actions/checkout@v4
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
- name: Run linters
run: |
source .venv/bin/activate
# flake8 .
black . --check
isort .
poetry run isort .
poetry run black --check src/
poetry run pre-commit run --all-files
test:
needs: linting
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.6", "3.7", "3.8", "3.9" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/checkout@v4
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
# install dependencies if cache does not exist
- name: Check cache and install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run tests
- name: Install dependencies
run: |
source .venv/bin/activate
pytest -vv --cov-report=term-missing --cov=${{ github.event.repository.name }} --cov-report=xml tests/
coverage report
# upload coverage stats
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tests
run: tox -e py
- name: Upload coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
40 changes: 19 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
fail_fast: false
exclude: |
(?x)^(
tests/data/.*
)$
repos:
- repo: local
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.14
hooks:
- id: system
name: isort
entry: poetry run isort src/
language: system
pass_filenames: false
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: local
hooks:
- id: pyupgrade
- id: pyupgrade
name: pyupgrade
entry: poetry run pyupgrade --py38-plus
language: python
types: [python]
pass_filenames: true
- repo: local
hooks:
- id: system
name: Black
entry: poetry run black src/
language: system
pass_filenames: false
- repo: local
hooks:
- id: system
name: flake8
entry: poetry run flake8 src/
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion Ctl/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ctl:
- Ctl/tmplvars.yaml
ignore:
- \.git/

# command to remove temporary files

- name: clean
Expand Down
2 changes: 1 addition & 1 deletion Ctl/tmplvars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version: "0.4.0.1"
project_description: "Template abstraction for using multiple template engine backends in same code."
project_license: "Apache-2.0"
# FIXME
coverage_repos: "tmpl"
coverage_repos: "tmpl"
111 changes: 1 addition & 110 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 15 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ version = "1.0.0"
description = "Template abstraction for using multiple template engine backends in same code."
repository = "https://github.com/20c/tmpl"
readme = "README.md"
authors = [ "20C <code@20c.com>",]
authors = ["20C <code@20c.com>"]
license = "Apache-2.0"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
]

packages = [
{ include = "tmpl", from = "src" },
]
packages = [{ include = "tmpl", from = "src" }]

[tool.poetry.dependencies]
python = "^3.8"

[tool.poetry.dev-dependencies]
jinja2 = ">=2"

# testing
coverage = ">=5"
pytest = ">=6"
Expand All @@ -35,30 +35,26 @@ pytest-cov = "*"

# linting
ruff = ">=0.1"
black = ">=20"
isort = ">=5.7"
flake8 = ">=3.8"
mypy = ">=0.950"
pre-commit = ">=2.13"
pyupgrade = ">=2.19"

# docs
markdown = "*"
markdown-include = ">=0.5,<1"
mkdocs = "^1.2.3"
mkdocs = ">=1.2.3"

# ctl
ctl = ">=1"
jinja2 = ">=2"
twine = ">=3"

[tool.poetry.plugins."markdown.extensions"]
pymdgen = "pymdgen.md:Extension"

[tool.ruff.lint]
# Enable the isort rules.
extend-select = ["I"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
profile = "black"
multi_line_output = 3
Loading

0 comments on commit 52be01a

Please sign in to comment.