Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to dev-cmd 0.12.0 and simplify. #25

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ __pycache__/
/dist/

# Tool caches.
.mypy_cache/
.mypy_cache*/
.pytest_cache/
.ruff_cache/
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.