Skip to content

Commit

Permalink
Upgrade to dev-cmd 0.12.0 and simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Jan 16, 2025
1 parent c36b6cc commit f080a32
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 51 deletions.
59 changes: 12 additions & 47 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ dev = [
"setuptools",
"types-appdirs",
"types-colorama",
"types-setuptools",
"types-tqdm",
]

Expand All @@ -88,50 +89,21 @@ line-length = 100
extend-select = ["I"]

[tool.dev-cmd.commands]
clean = [
"python",
"-c",
"""\
import os
import shutil
import sys
import colors
# The MyPy cache can get corrupted by swithing Pythons with `uv ... --python ...' and re-building
# the .venv is cheap; so we clean these as a more restricted form than `git clean -fdx`
for cache_dir in '.mypy_cache', '.venv':
if os.path.exists(cache_dir):
shutil.rmtree(cache_dir, ignore_errors=True)
print(colors.green(f"Removed directory `{cache_dir}`."), file=sys.stderr)
"""
]

fmt = ["ruff", "format"]
check-fmt = ["ruff", "format", "--diff"]

lint = ["ruff", "check", "--fix"]
check-lint = ["ruff", "check"]

type-check = ["mypy", "insta_science", "scripts", "test-support", "tests"]
type-check-38 = [
"mypy", "--python-version", "3.8", "insta_science", "scripts", "test-support", "tests"
]
type-check-39 = [
"mypy", "--python-version", "3.9", "insta_science", "scripts", "test-support", "tests"
]
type-check-310 = [
"mypy", "--python-version", "3.10", "insta_science", "scripts", "test-support", "tests"
]
type-check-311 = [
"mypy", "--python-version", "3.11", "insta_science", "scripts", "test-support", "tests"
]
type-check-312 = [
"mypy", "--python-version", "3.12", "insta_science", "scripts", "test-support", "tests"
]
type-check-313 = [
"mypy", "--python-version", "3.13", "insta_science", "scripts", "test-support", "tests"
type-check = [
"mypy",
"--python-version", "{-py:{markers.python_version}}",
"--cache-dir", ".mypy_cache_{markers.python_version}",
"setup.py",
"insta_science",
"scripts",
"test-support",
"tests",
]

[tool.dev-cmd.commands.release]
Expand All @@ -148,15 +120,8 @@ accepts-extra-args = true
checks = [
"fmt",
"lint",
[
"type-check-38",
"type-check-39",
"type-check-310",
"type-check-311",
"type-check-312",
"type-check-313",
],
"test"
["type-check-py3.{8..13}"],
"test",
]
ci = [["check-fmt", "check-lint", "type-check"], "test"]

Expand Down
2 changes: 2 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2025 Science project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import annotations

import atexit
import shutil
import tempfile
Expand Down
19 changes: 15 additions & 4 deletions python/uv.lock

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

0 comments on commit f080a32

Please sign in to comment.