-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a03c5a2
commit 93a07b6
Showing
14 changed files
with
670 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
"*.github" | ||
], | ||
"_template": "https://github.com/MartinBernstorff/swift-python-cookiecutter", | ||
"add_makefile": "y", | ||
"author": "Martin Bernstorff", | ||
"copyright_year": "2023", | ||
"email": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
diff a/.github/workflows/static_type_checks.yml b/.github/workflows/static_type_checks.yml (rejected hunks) | ||
@@ -1,7 +1,7 @@ | ||
-# We do not include mypy as a pre-commit hook because pre-commit hooks | ||
-# are installed in their own virtual environment, so mypy cannot | ||
+# We do not include static_type_checks as a pre-commit hook because pre-commit hooks | ||
+# are installed in their own virtual environment, so static_type_checks cannot | ||
# use stubs from imports | ||
-name: mypy | ||
+name: static_type_checks | ||
|
||
on: | ||
pull_request: | ||
@@ -10,46 +10,44 @@ on: | ||
branches: [main] | ||
|
||
jobs: | ||
- mypy: | ||
+ static_type_checks: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.ref }}" | ||
cancel-in-progress: true | ||
+ strategy: | ||
+ matrix: | ||
+ os: [ubuntu-latest] | ||
+ python-version: ["3.9"] | ||
steps: | ||
- - uses: actions/checkout@v2 | ||
+ - uses: actions/checkout@v3 | ||
|
||
- - name: Cache venv | ||
+ - name: Cache tox | ||
uses: actions/[email protected] | ||
- id: cache_venv | ||
+ id: cache_tox | ||
with: | ||
path: | | ||
- .venv | ||
- key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | ||
+ .tox | ||
+ key: ${{ runner.os }}-${{ matrix.python-version }}-static-type-checks | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
id: setup_python | ||
- if: steps.cache_venv.outputs.cache-hit != 'true' | ||
with: | ||
- python-version: "3.9" | ||
+ python-version: ${{ matrix.python-version}} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
- if: steps.cache_venv.outputs.cache-hit != 'true' | ||
run: | | ||
- python -m venv .venv | ||
- source .venv/bin/activate | ||
- python -m pip install --upgrade pip | ||
- pip install -e .[dev] | ||
+ pip install invoke tox | ||
|
||
- name: Run static type checker | ||
id: pyright | ||
continue-on-error: true | ||
run: | | ||
- source .venv/bin/activate | ||
- if pyright .; then | ||
+ if inv static-type-checks; then | ||
echo "pyright check passed" | ||
echo "pyright_failed=0" >> $GITHUB_OUTPUT | ||
else | ||
@@ -91,4 +94,4 @@ jobs: | ||
id: fail_run | ||
if: ${{steps.pyright.outputs.pyright_failed == 1}} | ||
run: | | ||
- pyright . # Rerunning pyright isn't optimal computationally, but typically takes no more than a couple of seconds, and this ensures that the errors are in the failing step | ||
+ inv static-type-checks # Rerunning pyright isn't optimal computationally, but typically takes no more than a couple of seconds, and this ensures that the errors are in the failing step |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff a/.gitignore b/.gitignore (rejected hunks) | ||
@@ -1,5 +1,4 @@ | ||
# Python | ||
-.mypy_cache/ | ||
/.python-version | ||
/.pytype/ | ||
/dist/ | ||
@@ -7,6 +6,10 @@ | ||
/src/*.egg-info/ | ||
__pycache__/ | ||
.*venv* | ||
+_build/ | ||
+.tox | ||
+ | ||
+# | ||
|
||
# VSCode | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff a/README.md b/README.md (rejected hunks) | ||
@@ -4,9 +4,8 @@ | ||
|
||
[![PyPI](https://img.shields.io/pypi/v/timeseriesflattener.svg)][pypi status] | ||
[![Python Version](https://img.shields.io/pypi/pyversions/timeseriesflattener)][pypi status] | ||
-[![documentation](https://github.com/MartinBernstorff/timeseriesflattener/workflows/documentation/badge.svg)][documentation] | ||
+[![documentation](https://github.com/MartinBernstorff/timeseriesflattener/actions/workflows/documentation.yml/badge.svg)][documentation] | ||
[![Tests](https://github.com/MartinBernstorff/timeseriesflattener/actions/workflows/tests.yml/badge.svg)][tests] | ||
- | ||
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black] | ||
|
||
[pypi status]: https://pypi.org/project/timeseriesflattener/ | ||
@@ -29,6 +28,9 @@ You can install `timeseriesflattener` via [pip] from [PyPI]: | ||
pip install timeseriesflattener | ||
``` | ||
|
||
+[pip]: https://pip.pypa.io/en/stable/installing/ | ||
+[PyPI]: https://pypi.org/project/timeseriesflattener/ | ||
+ | ||
## Usage | ||
|
||
TODO: Add minimal usage example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
diff a/docs/conf.py b/docs/conf.py (rejected hunks) | ||
@@ -82,7 +82,7 @@ html_theme_options = { | ||
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16"> | ||
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path> | ||
</svg> | ||
- """, # noqa: E501 | ||
+ """, | ||
"class": "", | ||
}, | ||
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,6 @@ exclude = [ | |
".eggs", | ||
".git", | ||
".hg", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pytype", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
diff a/pyproject.toml b/pyproject.toml (rejected hunks) | ||
@@ -3,55 +3,57 @@ requires = ["setuptools>=61.0.0", "wheel", "setuptools_scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
+ | ||
+ | ||
name = "timeseriesflattener" | ||
version = "0.0.0" | ||
authors = [ | ||
- {name = "Martin Bernstorff", email = "[email protected]"} | ||
+ { name = "Martin Bernstorff", email = "[email protected]" }, | ||
] | ||
description = "Timeseriesflattener" | ||
classifiers = [ | ||
"Operating System :: POSIX :: Linux", | ||
"Operating System :: MacOS :: MacOS X", | ||
"Operating System :: Microsoft :: Windows", | ||
- "Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.9", | ||
- "Programming Language :: Python :: 3.10" | ||
+ "Programming Language :: Python :: 3.10", | ||
+ "Programming Language :: Python :: 3.11", | ||
] | ||
requires-python = ">=3.9" | ||
-dependencies = [ | ||
- "pydantic" | ||
-] | ||
- | ||
+dependencies = ["pydantic"] | ||
[project.license] | ||
file = "LICENSE" | ||
name = "MIT" | ||
[project.optional-dependencies] | ||
dev = [ | ||
- "cruft", | ||
- "pyright", | ||
- "pre-commit==2.20.0,<2.21.0", | ||
- "ruff==0.0.254", # important that these match the pre-commit hooks | ||
- "black[jupyter]==22.8.0", # important that these match the pre-commit hooks | ||
- "pandas-stubs", # type stubs for pandas | ||
- "invoke", | ||
+ "cruft>=2.0.0", | ||
+ "pyright==1.1.305", | ||
+ "pyright-polite>=0.0.1", | ||
+ "pre-commit>=2.20.0", | ||
+ "ruff>=0.0.254", | ||
+ "black[jupyter]>=22.8.0", | ||
+ "pandas-stubs>=0.0.0", # type stubs for pandas | ||
+ "invoke==2.1.1", | ||
] | ||
tests = [ | ||
- "pytest>=7.1.3,<7.3.0", | ||
- "pytest-cov>=3.0.0,<3.1.0", | ||
- "pytest-xdist>=3.0.0,<3.2.0", | ||
- "pytest-sugar>=0.9.4,<0.10.0", | ||
+ "pytest>=7.1.3", | ||
+ "pytest-cov>=3.0.0", | ||
+ "pytest-xdist>=3.0.0", | ||
+ "pytest-sugar>=0.9.4", | ||
+ "tox>=4.5.0", | ||
] | ||
docs = [ | ||
- "sphinx>=5.3.0,<5.4.0", | ||
- "furo>=2022.12.7,<2022.12.8", # theme | ||
- "sphinx-copybutton>=0.5.1,<0.5.2", | ||
- "sphinxext-opengraph>=0.7.3,<0.7.4", | ||
- "sphinx_design>=0.3.0,<0.3.1", | ||
- "sphinx_togglebutton>=0.2.3,<0.4.0", | ||
- "myst-nb>=0.6.0,<1.17.0", # for rendering notebooks | ||
- "jupyter>=1.0.0,<1.1.0", # for tutorials | ||
+ "sphinx>=5.3.0", | ||
+ "furo>=2022.12.7", # theme | ||
+ "sphinx-copybutton>=0.5.1", | ||
+ "sphinxext-opengraph>=0.7.3", | ||
+ "sphinx_design>=0.3.0", | ||
+ "sphinx_togglebutton>=0.2.3", | ||
+ "myst-nb>=0.6.0", # for rendering notebooks | ||
+ "jupyter>=1.0.0", # for tutorials | ||
] | ||
|
||
+ | ||
[project.readme] | ||
file = "README.md" | ||
content-type = "text/markdown" | ||
@@ -62,7 +64,8 @@ repository = "https://github.com/MartinBernstorff/timeseriesflattener" | ||
documentation = "https://MartinBernstorff.github.io/timeseriesflattener/" | ||
|
||
[tool.pyright] | ||
-exclude = [".*venv*"] | ||
+exclude = [".*venv*", ".tox"] | ||
+pythonPlatform = "Darwin" | ||
|
||
[tool.ruff] | ||
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default. | ||
@@ -92,17 +95,9 @@ select = [ | ||
"RET", | ||
"RUF", | ||
"SIM", | ||
- "W" | ||
-] | ||
-ignore = [ | ||
- "ANN101", | ||
- "ANN401", | ||
- "E402", | ||
- "E501", | ||
- "F401", | ||
- "F841", | ||
- "RET504" | ||
+ "W", | ||
] | ||
+ignore = ["ANN101", "ANN401", "E402", "E501", "F401", "F841", "RET504"] | ||
ignore-init-module-imports = true | ||
# Allow autofix for all enabled rules (when `--fix`) is provided. | ||
unfixable = ["ERA"] | ||
@@ -148,12 +142,39 @@ max-complexity = 10 | ||
|
||
[tool.semantic_release] | ||
branch = "main" | ||
-version_variable = [ | ||
- "pyproject.toml:version" | ||
-] | ||
-upload_to_pypi = false | ||
-upload_to_release = false | ||
+version_toml = ["pyproject.toml:project.version"] | ||
build_command = "python -m pip install build; python -m build" | ||
|
||
+ | ||
[tool.setuptools] | ||
include-package-data = true | ||
+ | ||
+ | ||
+[tool.tox] | ||
+legacy_tox_ini = """ | ||
+[tox] | ||
+envlist = py{39,310} | ||
+ | ||
+[testenv] | ||
+description: run unit tests | ||
+extras = tests | ||
+use_develop = true | ||
+commands = | ||
+ pytest -n auto {posargs:test} | ||
+ | ||
+[testenv:type] | ||
+description: run type checks | ||
+extras = tests, dev | ||
+basepython = py39 # Setting these explicitly avoid recreating env if your shell is set to a different version | ||
+use_develop = true | ||
+commands = | ||
+ pyright src/ | ||
+ | ||
+[testenv:docs] | ||
+description: build docs | ||
+extras = docs | ||
+basepython = py39 # Setting these explicitly avoid recreating env if your shell is set to a different version | ||
+use_develop = true | ||
+commands = | ||
+ sphinx-build -b html docs docs/_build/html | ||
+""" |
Oops, something went wrong.