Skip to content

Commit

Permalink
Update copier template to v0.10.1 (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: quant-ranger[bot] <132915763+quant-ranger[bot]@users.noreply.github.com>
Co-authored-by: kklein <[email protected]>
  • Loading branch information
quant-ranger[bot] and kklein authored Apr 1, 2024
1 parent 05338cc commit e9d95bf
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 16 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ env:

jobs:
pre-commit-checks:
name: Pre-commit checks - Python 3.10
name: Pre-commit Checks
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# needed for 'pre-commit-mirrors-insert-license'
fetch-depth: 0
- name: Run pre-commit-conda
uses: quantco/pre-commit-conda@v1
with:
python-version: "3.10"

linux-unittests:
name: "Unit tests - Python ${{ matrix.PYTHON_VERSION }}"
Expand Down Expand Up @@ -56,4 +58,4 @@ jobs:
uses: quantco/pytest-action@v2
with:
report-title: "Unit tests Linux - Python ${{ matrix.PYTHON_VERSION }}"
custom-arguments: --cov-report=xml ./tests
custom-arguments: --cov=metalearners --cov-report=xml --cov-report term-missing --color=yes
36 changes: 36 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Type check
on: [push]

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

defaults:
run:
shell: "bash -el {0}"

env:
QUETZ_API_KEY: "${{ secrets.QUETZ_API_KEY }}"

jobs:
mypy:
name: Run Mypy
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: "${{ github.head_ref }}"
fetch-depth: 0
- name: Set up Conda env
uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7
with:
condarc-file: .github/assets/.condarc
environment-file: environment.yml
cache-environment: true
- name: Install repository
run: >-
python -m pip install --no-build-isolation --no-deps
--disable-pip-version-check -e .
- name: Run mypy
run: mypy .
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Build conda package
uses: quantco/[email protected].2
uses: quantco/[email protected].3
with:
quetz-api-key: ${{ secrets.QUETZ_API_KEY }}
upload-quetz: ${{ startsWith(github.ref, 'refs/tags/') }}
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
exclude: ^\.copier-answers\.yml$
repos:
- repo: https://github.com/Quantco/pre-commit-mirrors-insert-license
rev: 1.3.0
hooks:
- id: insert-license
types: [python]
args:
- --dynamic-years
- --comment-style
- "#"
- repo: https://github.com/Quantco/pre-commit-mirrors-docformatter
rev: 1.7.5
hooks:
Expand Down Expand Up @@ -33,12 +42,3 @@ repos:
rev: 1.19.0
hooks:
- id: typos-conda
- repo: https://github.com/Quantco/pre-commit-mirrors-insert-license
rev: 1.3.0
hooks:
- id: insert-license
types: [python]
args:
- --dynamic-years
- --comment-style
- "#"
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- pip
- python>=3.9
- setuptools-scm
- mypy=1.9.0
- setuptools>=61 # Adds support for pyproject.toml package declaration.
## Documentation
- make
Expand Down
4 changes: 3 additions & 1 deletion metalearners/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# SPDX-License-Identifier: LicenseRef-QuantCo

import importlib.metadata
import warnings

try:
__version__ = importlib.metadata.version(__name__)
except Exception:
except importlib.metadata.PackageNotFoundError as e: # pragma: no cover
warnings.warn(f"Could not determine version of {__name__}\n{e!s}", stacklevel=2)
__version__ = "unknown"
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ version_scheme = "post-release"
[project]
name = "metalearners"
description = "MetaLearners for CATE estimation"
readme = "README.md"
dynamic = ["version"]
authors = [
{name = "QuantCo, Inc.", email = "[email protected]"},
Expand Down Expand Up @@ -72,9 +71,13 @@ ignore_missing_imports = true
no_implicit_optional = true
check_untyped_defs = true

exclude = ["docs/"]

[tool.pytest.ini_options]
addopts = "--import-mode=importlib --cov=metalearners --cov-report term-missing --color=yes"
testpaths = [
"tests",
]

[tool.typos.default]
extend-ignore-re = ["HTE"]

0 comments on commit e9d95bf

Please sign in to comment.