Skip to content

Commit

Permalink
Merge pull request #163 from MC-kit/devel
Browse files Browse the repository at this point in the history
add write_parquet
  • Loading branch information
dvp2015 authored Apr 11, 2023
2 parents 6aa3d63 + b4e498b commit b36a127
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 223 deletions.
2 changes: 1 addition & 1 deletion .github/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pip==23.0.1
poetry==1.4.1
poetry==1.4.2

4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ jobs:
poetry config --local cache-dir .cache/pypoetry
poetry config --local virtualenvs.create false
# - name: Run safety session
# run: |
# nox --force-color --session=safety

- name: Run pre commit checks
run: |
nox --force-color --session=pre-commit
Expand Down
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ repos:
# - id: rstcheck
- repo: local
hooks:
# Remove unused imports
# - id: pycln
# name: pycln
# exclude: tools|\.idea|\.cache|[Pp]arser|tab\.py
# entry: poetry run pycln --config pyproject.toml
# language: system
# types: [python]
# Nicely sort imports
- id: isort
name: isort
Expand Down
34 changes: 9 additions & 25 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from nox import Session

nox.options.sessions = (
# "safety",
"pre-commit",
"mypy",
"tests",
Expand Down Expand Up @@ -110,7 +109,6 @@ def activate_virtualenv_in_precommit_hooks(s: Session) -> None:
@session(name="pre-commit")
def precommit(s: Session) -> None:
"""Lint using pre-commit."""
args = s.posargs or ["run", "--all-files", "--show-diff-on-failure"]
s.run(
"poetry",
"install",
Expand All @@ -119,25 +117,12 @@ def precommit(s: Session) -> None:
"pre_commit,style,isort,black,ruff",
external=True,
)
args = s.posargs or ["run", "--all-files", "--show-diff-on-failure"]
s.run("pre-commit", *args)
if args and args[0] == "install":
activate_virtualenv_in_precommit_hooks(s)


# @session
# def safety(s: Session) -> None:
# """Scan dependencies for insecure packages."""
# s.run(
# "poetry",
# "export",
# "-f",
# "requirements.txt",
# "-o",
# requirements,
# "--only",
# "main",


@session(python=supported_pythons)
def tests(s: Session) -> None:
"""Run the test suite."""
Expand All @@ -162,8 +147,6 @@ def coverage(s: Session) -> None:
To obtain html report run
nox -rs coverage -- html
"""
args = s.posargs or ["report"]

s.run(
"poetry",
"install",
Expand All @@ -176,6 +159,7 @@ def coverage(s: Session) -> None:
if not s.posargs and any(Path().glob(".coverage.*")):
s.run("coverage", "combine")

args = s.posargs or ["report"]
s.run("coverage", *args)


Expand Down Expand Up @@ -232,7 +216,6 @@ def isort(s: Session) -> None:
@session
def black(s: Session) -> None:
"""Run black code formatter."""
args = s.posargs or locations
s.run(
"poetry",
"install",
Expand All @@ -241,13 +224,13 @@ def black(s: Session) -> None:
"black",
external=True,
)
args = s.posargs or locations
s.run("black", *args)


@session
def lint(s: Session) -> None:
"""Lint using flake8."""
args = s.posargs or locations
s.run(
"poetry",
"install",
Expand All @@ -256,13 +239,13 @@ def lint(s: Session) -> None:
"flake8",
external=True,
)
args = s.posargs or locations
s.run("flake8", *args)


@session
def mypy(s: Session) -> None:
"""Type-check using mypy."""
args = s.posargs or ["src", "docs/source/conf.py"]
s.run(
"poetry",
"install",
Expand All @@ -271,6 +254,7 @@ def mypy(s: Session) -> None:
"main,mypy",
external=True,
)
args = s.posargs or ["src", "docs/source/conf.py"]
s.run("mypy", *args)

# special case for noxfile.py: need to find `nox` itself in session
Expand All @@ -281,7 +265,6 @@ def mypy(s: Session) -> None:
@session(python="3.11")
def xdoctest(s: Session) -> None:
"""Run examples with xdoctest."""
args = s.posargs or ["--quiet", "-m", f"src/{package}"]
s.run(
"poetry",
"install",
Expand All @@ -290,13 +273,13 @@ def xdoctest(s: Session) -> None:
"main,xdoctest",
external=True,
)
args = s.posargs or ["--quiet", "-m", f"src/{package}"]
s.run("python", "-m", "xdoctest", *args)


@session(python="3.11")
def ruff(s: Session) -> None:
"""Run ruff linter."""
args = s.posargs or ["src", "tests"]
s.run(
"poetry",
"install",
Expand All @@ -305,13 +288,13 @@ def ruff(s: Session) -> None:
"main,ruff",
external=True,
)
args = s.posargs or ["src", "tests"]
s.run("ruff", *args)


@session(name="docs-build", python="3.11")
def docs_build(s: Session) -> None:
"""Build the documentation."""
args = s.posargs or ["docs/source", "docs/_build"]
s.run(
"poetry",
"install",
Expand All @@ -323,13 +306,13 @@ def docs_build(s: Session) -> None:
if build_dir.exists():
shutil.rmtree(build_dir)

args = s.posargs or ["docs/source", "docs/_build"]
s.run("sphinx-build", *args)


@session(python="3.11")
def docs(s: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = s.posargs or ["--open-browser", "docs/source", "docs/_build"]
s.run(
"poetry",
"install",
Expand All @@ -341,4 +324,5 @@ def docs(s: Session) -> None:
if build_dir.exists():
shutil.rmtree(build_dir)

args = s.posargs or ["--open-browser", "docs/source", "docs/_build"]
s.run("sphinx-autobuild", *args)
Loading

0 comments on commit b36a127

Please sign in to comment.