Skip to content

Commit 5d31a61

Browse files
Merge branch 'main' into 2224
2 parents 3b6b011 + b00bc92 commit 5d31a61

File tree

285 files changed

+23733
-5459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+23733
-5459
lines changed

.github/workflows/mypy_primer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
pip install git+https://github.com/hauntsaninja/mypy_primer.git
3939
- uses: dtolnay/rust-toolchain@master
4040
with:
41-
toolchain: nightly-2025-09-14
41+
toolchain: nightly-2025-12-05
4242
components: clippy, rustfmt
4343
- name: Run mypy_primer
4444
shell: bash
@@ -61,7 +61,7 @@ jobs:
6161
--new $GITHUB_SHA --old base_commit \
6262
--num-shards 10 --shard-index ${{ matrix.shard-index }} \
6363
--debug \
64-
--project-selector '^(?!.*(python-attrs/attrs|scipy/scipy|scikit-learn/scikit-learn|pandas-dev/pandas|google/jax|apache/spark|spack/spack|sympy/sympy|PyCQA/flake8-pyi|Gobot1234/steam\.py|rotki/rotki|enthought/comtypes|pytest-dev/pytest|internetarchive/openlibrary|narwhals-dev/narwhals))' \
64+
--project-selector '^(?!.*(python-attrs/attrs|scipy/scipy|scikit-learn/scikit-learn|pandas-dev/pandas|pandas-dev/pandas-stubs|apache/spark|spack/spack|sympy/sympy|PyCQA/flake8-pyi|Gobot1234/steam\.py|rotki/rotki|enthought/comtypes|pytest-dev/pytest|internetarchive/openlibrary|narwhals-dev/narwhals|mhammond/pywin32|aaugustin/websockets|ibis-project/ibis))' \
6565
--type-checker pyrefly \
6666
--output concise \
6767
| tee diff_${{ matrix.shard-index }}.txt

.github/workflows/mypy_primer_comment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
with:
5050
github-token: ${{ secrets.GITHUB_TOKEN }}
5151
script: |
52-
const MAX_CHARACTERS = 50000
53-
const MAX_CHARACTERS_PER_PROJECT = MAX_CHARACTERS / 3
52+
const MAX_CHARACTERS = 100000
53+
const MAX_CHARACTERS_PER_PROJECT = MAX_CHARACTERS / 4
5454
5555
const fs = require('fs')
5656
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })

.github/workflows/pyrefly.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
prefix-key: pyrefly
3838
- uses: dtolnay/rust-toolchain@master
3939
with:
40-
toolchain: nightly-2025-09-14
40+
toolchain: nightly-2025-12-05
4141
components: clippy, rustfmt
4242
- run: cargo fmt -- --check
4343
- run: cargo clippy --release
@@ -50,5 +50,6 @@ jobs:
5050
JQ: jq
5151
TEST_PY: ${{ github.workspace }}/test.py
5252
PYREFLY_PY: ${{ github.workspace }}/pyrefly/python
53+
TENSOR_TEST_ROOT: ${{ github.workspace }}/test/tensor_shapes
5354
run: env -u GITHUB_ACTIONS scrut test test
5455
if: ${{ matrix.os != 'windows-latest' }}
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
name: Release binaries
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag_name:
9+
description: 'Tag name to upload assets to (e.g., 0.51.0)'
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: write
15+
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
GH_REPO: ${{ github.repository }}
19+
# Use release tag if triggered by release, otherwise use manual input
20+
TAG_NAME: ${{ github.event.release.tag_name || inputs.tag_name }}
21+
22+
jobs:
23+
build:
24+
name: Build ${{ matrix.artifact_name }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
# Linux
30+
- os: ubuntu-latest
31+
target: x86_64-unknown-linux-gnu
32+
artifact_name: pyrefly-linux-x86_64
33+
github_env: $GITHUB_ENV
34+
- os: ubuntu-latest
35+
target: i686-unknown-linux-gnu
36+
artifact_name: pyrefly-linux-i686
37+
cross: true
38+
github_env: $GITHUB_ENV
39+
- os: ubuntu-24.04-arm
40+
target: aarch64-unknown-linux-gnu
41+
artifact_name: pyrefly-linux-arm64
42+
container: ubuntu:20.04
43+
github_env: $GITHUB_ENV
44+
# macOS
45+
- os: macos-15-intel
46+
target: x86_64-apple-darwin
47+
artifact_name: pyrefly-macos-x86_64
48+
github_env: $GITHUB_ENV
49+
- os: macos-14
50+
target: aarch64-apple-darwin
51+
artifact_name: pyrefly-macos-arm64
52+
github_env: $GITHUB_ENV
53+
# Windows
54+
- os: windows-latest
55+
target: x86_64-pc-windows-msvc
56+
artifact_name: pyrefly-windows-x86_64
57+
github_env: $env:GITHUB_ENV
58+
- os: windows-latest
59+
target: i686-pc-windows-msvc
60+
artifact_name: pyrefly-windows-i686
61+
cross: true
62+
github_env: $env:GITHUB_ENV
63+
- os: windows-latest
64+
target: aarch64-pc-windows-msvc
65+
artifact_name: pyrefly-windows-arm64
66+
cross: true
67+
github_env: $env:GITHUB_ENV
68+
69+
runs-on: ${{ matrix.os }}
70+
container: ${{ matrix.container }}
71+
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v6
75+
with:
76+
persist-credentials: false
77+
ref: ${{ github.event.release.tag_name || inputs.tag_name }}
78+
79+
- name: Install container dependencies
80+
if: matrix.container == 'ubuntu:20.04'
81+
run: |
82+
apt-get update && apt-get -y install curl build-essential git
83+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
84+
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
85+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
86+
apt-get update && apt-get -y install gh
87+
# Fix git safe.directory for container builds (checkout creates repo with different owner)
88+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
89+
90+
- name: Read rust-toolchain file
91+
run: echo "toolchain=$(cat pyrefly/rust-toolchain)" && echo "toolchain=$(cat pyrefly/rust-toolchain)" >> ${{ matrix.github_env }}
92+
93+
- name: Install Rust toolchain
94+
uses: dtolnay/rust-toolchain@stable
95+
with:
96+
toolchain: ${{ env.toolchain }}
97+
targets: ${{ matrix.target }}
98+
99+
- name: Set up Rust cache
100+
uses: Swatinem/rust-cache@v2
101+
with:
102+
prefix-key: pyrefly-release
103+
104+
- name: Set Windows cargo home
105+
if: runner.os == 'Windows'
106+
run: echo "CARGO_HOME=C:\cargo" >> ${{ matrix.github_env }}
107+
108+
- name: Set jemalloc page size for ARM64 Linux
109+
if: matrix.target == 'aarch64-unknown-linux-gnu'
110+
run: echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> ${{ matrix.github_env }}
111+
112+
- name: Build binary (native)
113+
if: ${{ !matrix.cross }}
114+
run: cargo build --release --manifest-path pyrefly/Cargo.toml -p pyrefly --target ${{ matrix.target }}
115+
116+
- name: Build binary (cross-compile)
117+
if: ${{ matrix.cross }}
118+
uses: houseabsolute/actions-rust-cross@v1
119+
with:
120+
command: build
121+
target: ${{ matrix.target }}
122+
args: "--release --manifest-path pyrefly/Cargo.toml -p pyrefly"
123+
toolchain: ${{ env.toolchain }}
124+
125+
- name: Package binary (Unix)
126+
if: runner.os != 'Windows'
127+
run: |
128+
mkdir -p staging
129+
cp target/${{ matrix.target }}/release/pyrefly staging/
130+
cd staging
131+
tar -czvf ../${{ matrix.artifact_name }}.tar.gz pyrefly
132+
133+
- name: Package binary (Windows)
134+
if: runner.os == 'Windows'
135+
shell: pwsh
136+
run: |
137+
New-Item -ItemType Directory -Force -Path staging
138+
Copy-Item "target/${{ matrix.target }}/release/pyrefly.exe" -Destination staging/
139+
Compress-Archive -Path staging/pyrefly.exe -DestinationPath "${{ matrix.artifact_name }}.zip"
140+
141+
- name: Generate checksum (Unix)
142+
if: runner.os != 'Windows'
143+
run: |
144+
if command -v sha256sum >/dev/null 2>&1; then
145+
sha256sum ${{ matrix.artifact_name }}.tar.gz > ${{ matrix.artifact_name }}.tar.gz.sha256
146+
else
147+
shasum -a 256 ${{ matrix.artifact_name }}.tar.gz > ${{ matrix.artifact_name }}.tar.gz.sha256
148+
fi
149+
150+
- name: Generate checksum (Windows)
151+
if: runner.os == 'Windows'
152+
shell: pwsh
153+
run: |
154+
$hash = (Get-FileHash -Algorithm SHA256 "${{ matrix.artifact_name }}.zip").Hash.ToLower()
155+
"$hash ${{ matrix.artifact_name }}.zip" | Out-File -Encoding ASCII "${{ matrix.artifact_name }}.zip.sha256"
156+
157+
- name: Upload to release (Unix)
158+
if: runner.os != 'Windows'
159+
run: |
160+
gh release upload ${{ env.TAG_NAME }} \
161+
${{ matrix.artifact_name }}.tar.gz \
162+
${{ matrix.artifact_name }}.tar.gz.sha256 \
163+
--clobber
164+
165+
- name: Upload to release (Windows)
166+
if: runner.os == 'Windows'
167+
shell: pwsh
168+
run: |
169+
gh release upload ${{ env.TAG_NAME }} `
170+
"${{ matrix.artifact_name }}.zip" `
171+
"${{ matrix.artifact_name }}.zip.sha256" `
172+
--clobber

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ Coding style: All code must be clean, documented and minimal. That means:
6363
- Minimize the number of places `Expr` nodes are passed around and the number of
6464
times they are parsed. Generally, this means extracting semantic information
6565
as early as possible.
66+
- **Imports:** Always add `use` imports at the top of the file rather than using
67+
inline qualified paths (e.g., write `use crate::foo::Bar;` and then `Bar`,
68+
not `crate::foo::Bar` inline). The only exception is when there is a name
69+
collision between two imports, which is rare.
6670

6771
## Development environments
6872

@@ -96,6 +100,7 @@ the project root. BUCK files are not exported to GitHub, so:
96100
you are confident the feature is complete.
97101
- By default, `test.py` auto-detects the build tool based on BUCK file presence.
98102
You can override this with `--mode buck` or `--mode cargo`.
103+
- For external builds, always use `python3 test.py` instead of `./test.py`.
99104
- To run just formatting and linting (much faster than running tests):
100105
`./test.py --no-test --no-conformance`
101106

0 commit comments

Comments
 (0)