Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/memray/_vendor/** linguist-generated=true
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -qy npm git
- name: Install Python dependencies
run: |
python3 -m pip install -r requirements-extra.txt
- name: Check if files are up to date
run: make build-js
run: |
make build-js
make vendor-update
python3 tools/check_vendor_versions.py
- name: Check for changes
run: |
git add -u
Expand Down
13 changes: 11 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: "^(src/memray/reporters/templates/assets|src/vendor|benchmarks|docs/_static/flamegraphs)/"
exclude: "^(src/memray/reporters/templates/assets|src/vendor|src/memray/_vendor|benchmarks|docs/_static/flamegraphs)/"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -11,7 +11,7 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: "^([.]bumpversion[.]cfg|.*/__snapshots__/)"
exclude: "^([.]bumpversion[.]cfg|.*/__snapshots__/|tools/vendoring/patches/.*\\.patch$)"

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down Expand Up @@ -64,3 +64,12 @@ repos:
files: ^news/
types: [rst]
additional_dependencies: ["sphinx"]

- repo: local
hooks:
- id: no-bare-textual-imports
name: Forbid bare textual imports
language: pygrep
entry: '^\s*(from textual\b|import textual\b)'
types: [python]
exclude: "^(src/memray/_vendor/|tests/conftest\\.py)"
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ recursive-include src/vendor *
recursive-include src/memray *.py
recursive-include src/memray *.pyi
recursive-include src/memray *.html *.js *.css
recursive-include src/memray/_vendor/textual *
recursive-include src/memray *.pyx *.pxd
recursive-include src/memray *.gdb *.lldb
recursive-include src/memray/_memray *
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ cpp_files := $(shell find src/memray/_memray -name \*.cpp -o -name \*.h)
# Use this to inject arbitrary commands before the make targets (e.g. docker)
ENV :=

.PHONY: vendor-update
vendor-update: ## Update vendored dependencies (Textual)
$(PYTHON) -m vendoring sync .

.PHONY: build
build: build-js build-vendor build-ext ## (default) Build package extensions, JS assets, and vendor assets in-place

Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ It really makes a difference!

# Installation

Memray requires Python 3.7+ and can be easily installed using most common Python
Memray requires Python 3.9+ and can be easily installed using most common Python
packaging tools. We recommend installing the latest stable release from
[PyPI](https://pypi.org/project/memray/) with pip:

Expand Down Expand Up @@ -119,6 +119,28 @@ pre-commit install

This will ensure that your contribution passes our linting checks.

# Vendoring Textual

Memray vendors Textual under `src/memray/_vendor/textual`.

To bump Textual:

```shell
# 1) Update pins
# - vendor.txt: textual==<new-version>
# - tools/vendoring/patches/textual-version.patch: __version__ = "<new-version>"
# - setup.py test_requires: textual==<new-version>

# 2) Regenerate vendored tree
make vendor-update

# 3) Verify version consistency checks
python3 tools/check_vendor_versions.py
```

CI (`.github/workflows/build.yml`, `check_generated_files`) reruns vendoring
and `tools/check_vendor_versions.py`, then fails if generated files drift.

# Documentation

You can find the latest documentation available [here](https://bloomberg.github.io/memray/).
Expand Down
4 changes: 2 additions & 2 deletions docs/supported_environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Supported Python versions

Every Python version that hasn't reached end of life is supported.

Currently that's Python 3.8 through 3.14.
Currently that's Python 3.9 through 3.14.

Supported operating systems
---------------------------
Expand All @@ -38,7 +38,7 @@ are available on PyPI.

For macOS, we test on ``x86-64`` and ``arm64`` - so, both Intel and Apple
Silicon Macs. Pre-built wheels are available for both architectures, though
only for Python 3.8 and newer.
only for Python 3.9 and newer.

Supported runtime environments
------------------------------
Expand Down
24 changes: 22 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ build-backend = 'setuptools.build_meta'
line-length = 95
select = ["C4", "E", "F", "I001", "PERF", "W"]
fix = true
exclude = ["src/memray/_vendor"]

[tool.ruff.isort]
force-single-line = true
Expand Down Expand Up @@ -59,10 +60,10 @@ ignore = [
]

[tool.mypy]
exclude="tests/integration/(native_extension|multithreaded_extension)/"
exclude = "tests/integration/(native_extension|multithreaded_extension)/|_vendor/"

[tool.cibuildwheel]
build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
build = ["cp39-*", "cp310-*", "cp311-*"]
skip = "*musllinux*{i686,aarch64}*"
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
Expand Down Expand Up @@ -116,6 +117,24 @@ before-test = [
"codesign --remove-signature /Library/Frameworks/Python.framework/Versions/*/Resources/Python.app/Contents/MacOS/Python || true",
]

[tool.vendoring]
destination = "src/memray/_vendor/"
requirements = "vendor.txt"
namespace = "memray._vendor"
protected-files = ["__init__.py"]
patches-dir = "tools/vendoring/patches"

[tool.vendoring.transformations]
drop = [
"tests/",
"docs/",
"examples/",
"*.md",
"*.rst",
"*.txt",
"CHANGELOG*",
]

[tool.coverage.run]
plugins = [
"Cython.Coverage",
Expand All @@ -128,6 +147,7 @@ branch = true
parallel = true
omit = [
"*__init__.py",
"src/memray/_vendor/*",
]

[tool.coverage.report]
Expand Down
1 change: 1 addition & 0 deletions requirements-extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ mypy
bump2version
towncrier
pre-commit
vendoring
-r requirements-docs.txt
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pytest
pytest-cov
ipython
setuptools
textual==8.2.1
pkgconfig
pytest-textual-snapshot
textual >= 0.43, != 0.65.2, != 0.66
packaging
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def build_js_files(self):

install_requires = [
"jinja2 >= 2.9",
"typing_extensions; python_version < '3.8.0'",
"rich >= 11.2.0",
"textual >= 0.41.0",
"rich >= 14.2.0",
"markdown-it-py",
"platformdirs",
]
docs_requires = [
"IPython",
Expand All @@ -109,6 +109,7 @@ def build_js_files(self):
"isort",
"mypy",
"check-manifest",
"vendoring",
]

test_requires = [
Expand All @@ -119,7 +120,7 @@ def build_js_files(self):
"ipython",
"setuptools",
"pytest-textual-snapshot",
"textual >= 0.43, != 0.65.2, != 0.66",
"textual==8.2.1",
"packaging",
]

Expand Down Expand Up @@ -305,7 +306,7 @@ def build_js_files(self):
setup(
name="memray",
version=about["__version__"],
python_requires=">=3.7.0",
python_requires=">=3.9.0",
description="A memory profiler for Python applications",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
Expand All @@ -316,8 +317,6 @@ def build_js_files(self):
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
1 change: 1 addition & 0 deletions src/memray/_vendor/__init__.py

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

21 changes: 21 additions & 0 deletions src/memray/_vendor/textual/LICENSE

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

Loading
Loading