fc-data 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. datasmith/__init__.py +330 -0
  2. datasmith/__init__.pyi +194 -0
  3. datasmith/agents/__init__.py +31 -0
  4. datasmith/agents/classifiers.py +272 -0
  5. datasmith/agents/codex.py +25 -0
  6. datasmith/agents/config.py +108 -0
  7. datasmith/agents/extractors.py +197 -0
  8. datasmith/agents/installed/README.md +52 -0
  9. datasmith/agents/installed/__init__.py +22 -0
  10. datasmith/agents/installed/base.py +240 -0
  11. datasmith/agents/installed/claude.py +134 -0
  12. datasmith/agents/installed/codex.py +91 -0
  13. datasmith/agents/installed/gemini.py +118 -0
  14. datasmith/agents/installed/none.py +27 -0
  15. datasmith/agents/sandbox.py +547 -0
  16. datasmith/agents/synthesizer.py +439 -0
  17. datasmith/agents/templates/AGENTS.md.j2 +150 -0
  18. datasmith/agents/templates/sandbox_verify.py +428 -0
  19. datasmith/docker/__init__.py +31 -0
  20. datasmith/docker/context.py +112 -0
  21. datasmith/docker/images.py +158 -0
  22. datasmith/docker/publish.py +56 -0
  23. datasmith/docker/templates/Dockerfile.base +26 -0
  24. datasmith/docker/templates/Dockerfile.pr +42 -0
  25. datasmith/docker/templates/Dockerfile.repo +11 -0
  26. datasmith/docker/templates/docker_build_base.sh +780 -0
  27. datasmith/docker/templates/docker_build_env.sh +309 -0
  28. datasmith/docker/templates/docker_build_final.sh +106 -0
  29. datasmith/docker/templates/docker_build_pkg.sh +99 -0
  30. datasmith/docker/templates/docker_build_run.sh +124 -0
  31. datasmith/docker/templates/entrypoint.sh +62 -0
  32. datasmith/docker/templates/parser.py +1405 -0
  33. datasmith/docker/templates/profile.sh +199 -0
  34. datasmith/docker/templates/pytest_runner.py +692 -0
  35. datasmith/docker/templates/run-tests.sh +197 -0
  36. datasmith/docker/verifiers.py +131 -0
  37. datasmith/filters.py +154 -0
  38. datasmith/github/__init__.py +22 -0
  39. datasmith/github/client.py +333 -0
  40. datasmith/github/hooks.py +50 -0
  41. datasmith/github/links.py +110 -0
  42. datasmith/github/models.py +206 -0
  43. datasmith/github/render.py +173 -0
  44. datasmith/github/search.py +66 -0
  45. datasmith/github/templates/comment.md.j2 +5 -0
  46. datasmith/github/templates/final.md.j2 +66 -0
  47. datasmith/github/templates/issues.md.j2 +21 -0
  48. datasmith/github/templates/repo.md.j2 +1 -0
  49. datasmith/preflight.py +162 -0
  50. datasmith/publish/__init__.py +13 -0
  51. datasmith/publish/huggingface.py +104 -0
  52. datasmith/publish/pipeline.py +60 -0
  53. datasmith/publish/records.py +91 -0
  54. datasmith/py.typed +1 -0
  55. datasmith/resolution/__init__.py +14 -0
  56. datasmith/resolution/blocklist.py +145 -0
  57. datasmith/resolution/cache.py +120 -0
  58. datasmith/resolution/constants.py +277 -0
  59. datasmith/resolution/dependency_resolver.py +174 -0
  60. datasmith/resolution/git_utils.py +378 -0
  61. datasmith/resolution/import_analyzer.py +66 -0
  62. datasmith/resolution/metadata_parser.py +412 -0
  63. datasmith/resolution/models.py +41 -0
  64. datasmith/resolution/orchestrator.py +522 -0
  65. datasmith/resolution/package_filters.py +312 -0
  66. datasmith/resolution/python_manager.py +110 -0
  67. datasmith/runners/__init__.py +15 -0
  68. datasmith/runners/base.py +112 -0
  69. datasmith/runners/classify_prs.py +48 -0
  70. datasmith/runners/render_problems.py +113 -0
  71. datasmith/runners/resolve_packages.py +66 -0
  72. datasmith/runners/scrape_commits.py +166 -0
  73. datasmith/runners/scrape_repos.py +44 -0
  74. datasmith/runners/synthesize_images.py +310 -0
  75. datasmith/update/__init__.py +5 -0
  76. datasmith/update/cli.py +169 -0
  77. datasmith/update/offline.py +173 -0
  78. datasmith/update/pipeline.py +497 -0
  79. datasmith/utils/__init__.py +18 -0
  80. datasmith/utils/core.py +67 -0
  81. datasmith/utils/db.py +156 -0
  82. datasmith/utils/tokens.py +65 -0
  83. fc_data-0.2.0.dist-info/METADATA +441 -0
  84. fc_data-0.2.0.dist-info/RECORD +87 -0
  85. fc_data-0.2.0.dist-info/WHEEL +4 -0
  86. fc_data-0.2.0.dist-info/entry_points.txt +2 -0
  87. fc_data-0.2.0.dist-info/licenses/LICENSE +28 -0
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env bash
2
+ # Generate baseline ASV results (HEAD of current repo) once.
3
+ set -euo pipefail
4
+ # Ensure artifacts written by the container are world-readable on the host
5
+ umask 022
6
+
7
+ show_help() {
8
+ cat <<EOF
9
+ Usage: $(basename "$0") [LOG_PATH] [ADDITIONAL_ASV_ARGS]
10
+
11
+ Options:
12
+ LOG_PATH Full path for logging/results (required)
13
+ ADDITIONAL_ASV_ARGS Additional arguments to pass to ASV (optional)
14
+ -h, --help Show this help message and exit
15
+
16
+ Description:
17
+ This script generates baseline ASV results for the current repository HEAD.
18
+ It sets up the environment, runs benchmarks, bundles results into a tar.gz,
19
+ and then deletes unwanted intermediate files inside LOG_DIR.
20
+ EOF
21
+ }
22
+
23
+ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
24
+ show_help
25
+ exit 0
26
+ fi
27
+
28
+ if [ -z "${1:-}" ]; then
29
+ echo "Error: LOG_PATH argument required." >&2
30
+ show_help
31
+ exit 1
32
+ fi
33
+
34
+ RAW_LOG_DIR="$1"
35
+ # Ensure the directory exists before resolving its absolute path
36
+ mkdir -p "$RAW_LOG_DIR"
37
+ LOG_DIR=$(realpath "$RAW_LOG_DIR")
38
+ ADDITIONAL_ASV_ARGS="${2:-}"
39
+ RESULTS_DIR="${LOG_DIR}/results"
40
+ HTML_DIR="${LOG_DIR}/html"
41
+ TARBALL="${LOG_DIR}.tar.gz"
42
+ BASE_SHA_FILE="${LOG_DIR}/sha.txt"
43
+ BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
44
+
45
+ source /etc/profile.d/asv_build_vars.sh || true
46
+
47
+ CURR_DIR="$(pwd)"
48
+ cd /workspace/repo
49
+
50
+ # Best-effort: ensure asv_runner available in task env
51
+ micromamba run -n "$ENV_NAME" uv pip install -q --upgrade asv_runner || true
52
+
53
+ mkdir -p "$LOG_DIR" "$RESULTS_DIR" "$HTML_DIR"
54
+
55
+ COMMIT_SHA="$(git rev-parse HEAD)"
56
+ MACHINE="dockertest"
57
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
58
+
59
+ # compute the paths as you already do
60
+ TEST_CONF="$(dirname "$CONF_NAME")/asv.test.conf.json"
61
+
62
+ # make sure the Python process can see them
63
+ export CONF_NAME TEST_CONF RESULTS_DIR HTML_DIR BRANCH_NAME REPO_ROOT
64
+
65
+ # Create a temp constraints file and make pip use it for every install
66
+
67
+ (python - <<'PY'
68
+ import json, os, sys
69
+ from asv.config import Config
70
+
71
+ conf_path = os.environ["CONF_NAME"]
72
+ out_path = os.environ["TEST_CONF"]
73
+ results = os.environ["RESULTS_DIR"]
74
+ html = os.environ["HTML_DIR"]
75
+
76
+ conf = Config.load(conf_path)
77
+ conf.results_dir = results
78
+ conf.html_dir = html
79
+
80
+ # Write out a plain JSON config as before
81
+ fields = [
82
+ "version","project","project_url","repo","repo_subdir","branches",
83
+ "pythons","matrix","exclude","include","environment_type",
84
+ "conda_channels","conda_environment_file","benchmark_dir","env_dir",
85
+ "results_dir","html_dir","show_commit_url","hash_length",
86
+ "build_command","install_command","uninstall_command",
87
+ "regressions_first_commits","regressions_thresholds","plugins"
88
+ ]
89
+ data = {k: getattr(conf, k) for k in fields if hasattr(conf, k)}
90
+ data['version'] = 1
91
+ repo_root = os.environ.get('REPO_ROOT')
92
+ if repo_root:
93
+ data['repo'] = repo_root
94
+
95
+ if "environment_type" in data:
96
+ data["environment_type"] = "existing"
97
+
98
+ data["branches"] = [os.environ["BRANCH_NAME"]]
99
+ with open(out_path, "w", encoding="utf-8") as f:
100
+ json.dump(data, f, indent=2)
101
+ PY
102
+ )
103
+
104
+ # use the basename $TEST_CONF
105
+ echo "[profile] Running ASV baseline on $COMMIT_SHA"
106
+ # cd into the dirname $TEST_CONF directory
107
+ OLD_DIR="$(pwd)"
108
+ REAL_TEST_CONF="$(realpath "$TEST_CONF")"
109
+ cd "$(dirname "$TEST_CONF")"
110
+ micromamba run -n "$ENV_NAME" asv machine --yes --config "$REAL_TEST_CONF" \
111
+ --machine "$MACHINE" \
112
+ --num_cpu "1" \
113
+ --ram "4GB" | tee "${LOG_DIR}.machine.log"
114
+
115
+ ASV_ARGS=(--config "$REAL_TEST_CONF" -a "rounds=1" -a "repeat=0" --python=same --machine="$MACHINE" --append-samples --show-stderr --set-commit-hash="$COMMIT_SHA")
116
+ # Add additional ASV args if provided (string, might be blank)
117
+ if [ -n "$ADDITIONAL_ASV_ARGS" ]; then
118
+ # shellcheck disable=SC2206
119
+ ASV_ARGS+=($ADDITIONAL_ASV_ARGS)
120
+ fi
121
+ micromamba run -n "$ENV_NAME" asv run "${ASV_ARGS[@]}" | tee "${LOG_DIR}.asv.log" || true
122
+ # Always run just-discover to enumerate benchmarks (coverage removed)
123
+ echo "[profile] Discovering benchmarks"
124
+ micromamba run -n "$ENV_NAME" asv run --bench just-discover --config "$REAL_TEST_CONF" --python=same --machine="$MACHINE" | tee "${LOG_DIR}.asv.log" || true
125
+ # asv publish --config "$REAL_TEST_CONF" | tee "${LOG_DIR}.publish.log" || true
126
+ cd "$OLD_DIR"
127
+
128
+ # Record base SHA for robust compare later
129
+ echo "$COMMIT_SHA" > "$BASE_SHA_FILE"
130
+
131
+ # Bundle everything once
132
+ if [ ! -d "$LOG_DIR" ]; then
133
+ echo "[profile] WARN: log directory missing at $LOG_DIR; skipping tarball" >&2
134
+ else
135
+ if [ -f "$TEST_CONF" ]; then
136
+ TEST_CONF_BASENAME="$(basename "$TEST_CONF")"
137
+ cp "$TEST_CONF" "$LOG_DIR/$TEST_CONF_BASENAME" || \
138
+ echo "[profile] WARN: failed copying $TEST_CONF into $LOG_DIR; tarball will omit it" >&2
139
+ else
140
+ echo "[profile] WARN: expected ASV test config at $TEST_CONF; tarball will omit it" >&2
141
+ fi
142
+
143
+ tmp_tar="$(mktemp "$(dirname "$TARBALL")/tmp.tar.XXXXXX")"
144
+
145
+ if tar -czf "$tmp_tar" -C "$(dirname "$LOG_DIR")" "$(basename "$LOG_DIR")"; then
146
+ mv "$tmp_tar" "$TARBALL"
147
+ chmod 644 "$TARBALL" || true
148
+ echo "[profile] Baseline written to $TARBALL"
149
+ else
150
+ rm -f "$tmp_tar"
151
+ echo "[profile] WARN: failed to create $TARBALL" >&2
152
+ fi
153
+ fi
154
+
155
+ echo "[profile] Write the list of benchmarks to /workspace/repo/asv_benchmarks.txt"
156
+ cat > get_benchmarks.py << 'EOF'
157
+ from asv.config import Config
158
+ from asv.benchmarks import Benchmarks
159
+ import argparse
160
+ parser = argparse.ArgumentParser()
161
+ parser.add_argument('test_conf', type=str, help='Path to ASV test config file')
162
+ parser.add_argument('--out_file', type=str, help='Output file for list of benchmarks')
163
+ args = parser.parse_args()
164
+ conf = Config.load(args.test_conf)
165
+ bm = Benchmarks.load(conf)
166
+ # print("\n".join(sorted(bm._all_benchmarks.keys())))
167
+ with open(args.out_file, 'w') as f:
168
+ for b in sorted(bm._all_benchmarks.keys()):
169
+ f.write(b + '\n')
170
+ EOF
171
+
172
+ if [ ! -f /workspace/repo/asv_benchmarks.txt ]; then
173
+ micromamba run -n "$ENV_NAME" python get_benchmarks.py "$TEST_CONF" --out_file /workspace/repo/asv_benchmarks.txt
174
+ echo "[profile] Write the list of benchmarks to /workspace/repo/asv_benchmarks.txt"
175
+ fi
176
+
177
+ echo "[profile] Cleaning up intermediate files..."
178
+
179
+ # Delete the get_benchmarks.py script
180
+ rm get_benchmarks.py
181
+
182
+
183
+ # Delete logs
184
+ rm -f "${LOG_DIR}.machine.log" \
185
+ "${LOG_DIR}.asv.log"
186
+
187
+ # Delete ASV config copy
188
+ rm -f "$TEST_CONF"
189
+
190
+ # Delete benchmark result directories
191
+ rm -rf "$RESULTS_DIR" "$HTML_DIR" "$LOG_DIR"
192
+
193
+
194
+ # Optionally delete the commit SHA text file if not needed later
195
+ # (comment out the next line if you want to keep sha.txt)
196
+ rm -f "$BASE_SHA_FILE"
197
+
198
+ cd "$CURR_DIR"
199
+ echo "[profile] Cleanup complete. Remaining artifact: $TARBALL"