Skip to content

Commit 263abff

Browse files
authored
Update
1 parent f9ca121 commit 263abff

4 files changed

Lines changed: 296 additions & 818 deletions

File tree

apply_configuration.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ def _replace_all_occurences(
3333
# Get files in this repository (e.g., exclude venv/).
3434
known_files: set[Path] = set()
3535
outer_dir = Path(".").parent.resolve()
36-
proc = subprocess.run(
37-
["git", "ls-files"], encoding="utf-8", stdout=subprocess.PIPE, check=True
38-
)
36+
proc = subprocess.run(["git", "ls-files"], encoding="utf-8", stdout=subprocess.PIPE, check=True)
3937
for line in proc.stdout.split("\n"):
4038
known_files.add((outer_dir / line).resolve())
4139
known_files -= exclude
@@ -64,17 +62,11 @@ def _main() -> None:
6462
github_username = config["github-username"]
6563
assert " " not in github_username, "Malformed GitHub username"
6664
package_name = config["your-package-name"]
67-
assert " " not in package_name, (
68-
"Package names cannot contain spaces (you want to `import package_name`)"
69-
)
70-
assert "-" not in package_name, (
71-
"Package names cannot dashes (you want to `import package_name`)"
72-
)
65+
assert " " not in package_name, "Package names cannot contain spaces (you want to `import package_name`)"
66+
assert "-" not in package_name, "Package names cannot dashes (you want to `import package_name`)"
7367
python_version = config["python-version"]
7468
assert python_version.startswith("3"), "Only Python 3 is supported"
75-
assert python_version.startswith("3."), (
76-
"Missing dot in Python version (example: 3.10)"
77-
)
69+
assert python_version.startswith("3."), "Missing dot in Python version (example: 3.10)"
7870
python_subversion = python_version.split(".")[1]
7971
assert python_subversion.isdigit()
8072

@@ -87,15 +79,9 @@ def _main() -> None:
8779
git_config_file = git_repo / "config"
8880
with open(git_config_file, encoding="utf-8") as fp:
8981
git_config_contents = fp.read()
90-
if (
91-
"git@github.com:MTDickens/research-code-python-starter-template"
92-
in git_config_contents
93-
):
82+
if "git@github.com:MTDickens/research-code-python-starter-template" in git_config_contents:
9483
shutil.rmtree(git_repo)
95-
elif (
96-
"https://github.com/MTDickens/research-code-python-starter-template"
97-
in git_config_contents
98-
):
84+
elif "https://github.com/MTDickens/research-code-python-starter-template" in git_config_contents:
9985
shutil.rmtree(git_repo)
10086

10187
# Initialize the repo anew.

pyproject.toml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,28 @@ requires = ["setuptools", "setuptools-scm"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "python_starter"
6+
name = "sym-img"
77
version = "0.1.0"
8-
description = "A basic starter for Python packages."
8+
description = "Code for symbolic imagination paper"
99
readme = "README.md"
10-
requires-python = ">=3.10"
10+
requires-python = ">=3.12"
1111
dependencies = [
12-
"jaxtyping>=0.3.7",
13-
"matplotlib",
14-
"numpy",
12+
"hydra-core>=1.3.2",
13+
"ipdb>=0.13.13",
1514
]
1615

1716
[project.optional-dependencies]
18-
develop = [
19-
"pytest>=7.2.2",
20-
"ruff",
21-
"ty",
22-
]
17+
develop = ["pytest>=7.2.2", "pytest-xdist>=3.8.0", "ruff", "ty"]
2318

2419
[tool.setuptools.packages.find]
2520
where = ["src"]
2621

2722
[tool.setuptools.package-data]
28-
python_starter = ["py.typed"]
23+
sym_img = ["py.typed"]
2924

3025
[tool.ruff]
31-
line-length = 88
32-
target-version = "py310"
26+
line-length = 128
27+
target-version = "py312"
3328

3429
[tool.ruff.lint]
3530
select = ["E", "F", "W", "I", "D", "UP", "PL"]
@@ -39,8 +34,13 @@ ignore = [
3934
"F722", # jaxtyping uses strings in annotations that are not forward references (see ruff#9860)
4035
]
4136

37+
[tool.ruff.lint.pylint]
38+
max-args = 10
39+
max-branches = 30
40+
max-statements = 150
41+
4242
[tool.ruff.lint.isort]
43-
known-first-party = ["python_starter"]
43+
known-first-party = ["sym_img"]
4444

4545
[tool.ruff.lint.pydocstyle]
4646
convention = "numpy"
@@ -52,10 +52,16 @@ docstring-code-format = true
5252
docstring-code-line-length = "dynamic"
5353

5454
[tool.ty.environment]
55-
python-version = "3.10"
55+
python-version = "3.12"
5656

5757
[tool.ty.src]
5858
include = ["src", "tests"]
5959

6060
[tool.ty.analysis]
6161
respect-type-ignore-comments = true
62+
63+
[tool.uv.sources]
64+
sym-img = { workspace = true }
65+
66+
[dependency-groups]
67+
dev = ["sym-img"]

run_ci_checks.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash # Run with bash (consistent with the rest of the repo)
22
set -euo pipefail # Fail fast: -e stop on error, -u error on unset vars, pipefail propagate pipeline failures
33

4+
PYTEST_WORKERS="${PYTEST_WORKERS:-auto}" # Allow local override, default to xdist auto worker count in CI checks
5+
46
uv sync --extra develop # Ensure the uv environment exists and all dev tools are installed
57

68
uv run --no-sync ruff format --check . # Check formatting without modifying files (CI-style formatting gate)
79
uv run --no-sync ruff check . # Run Ruff lint checks without autofixing (CI-style lint gate)
810
uv run --no-sync ty check # Run ty static type checking
9-
uv run --no-sync pytest tests/ # Run unit tests in tests/ only
11+
uv run --no-sync pytest -n "${PYTEST_WORKERS}" --dist worksteal -s tests/ # Run unit tests in parallel by default

0 commit comments

Comments
 (0)