Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
python-version: ${{ matrix.python }}
- name: Install
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e .
python -m pip install --upgrade pip
python -m pip install .
python -m pip install -r test_requirements.txt
- name: Display Python version
run: python -c "import sys; print(sys.version)"
Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Setting up development can be done using the following commands:

$ virtualenv -p /usr/bin/python3 vmprof3
$ source vmprof3/bin/activate
$ python setup.py develop
$ pip install meson-python meson ninja
$ pip install --no-build-isolation --editable .

You need to install python development packages. In case of e.g. Debian or Ubuntu the package you need is `python3-dev` and `libunwind-dev`.
Now it is time to write a test and implement your feature. If you want
Expand Down
3 changes: 2 additions & 1 deletion docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ An optional stage. It is only necessary if you want to co develop `vmprof-python

# install vmprof for development (only needed if you want to co develop vmprof-python)
$ cd vmprof-python
$ python setup.py develop
$ pip install meson-python meson ninja
$ pip install --no-build-isolation --editable .


Now you are able to change both the python package and the server and see the results.
Expand Down
106 changes: 106 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
project('vmprof', 'c',
version: '0.5.0',
license: 'MIT',
meson_version: '>=1.1.0',
)

py = import('python').find_installation(pure: false)
py_dep = py.dependency()
cc = meson.get_compiler('c')

# PyPy ships _vmprof as a built-in module, so the PyPy wheel is pure python.
is_pypy = run_command(py, '-c',
'import sys; print("__pypy__" in sys.builtin_module_names)',
check: true,
).stdout().strip() == 'True'

# The pure python packages. The test packages are not installed.
python_dir = py.get_install_dir(pure: is_pypy)
install_subdir('vmprof',
install_dir: python_dir,
exclude_directories: ['test', '__pycache__'],
)
install_subdir('jitlog',
install_dir: python_dir,
exclude_directories: ['test', '__pycache__'],
)
install_subdir('vmshare',
install_dir: python_dir,
exclude_directories: ['__pycache__'],
)

if not is_pypy
system = host_machine.system()

sources = files(
'src/_vmprof.c',
'src/machine.c',
'src/compat.c',
'src/vmp_stack.c',
'src/vmprof_common.c',
'src/vmprof_memory.c',
)
c_args = []
deps = [py_dep]
# libbacktrace ships a pre-generated config.h, so it is built as plain
# sources without running its configure script.
inc = include_directories('src', 'src/libbacktrace')

if system == 'windows'
sources += files('src/vmprof_win.c')
c_args += ['-DVMPROF_WINDOWS=1']
elif system == 'darwin'
sources += files(
'src/symboltable.c',
'src/vmprof_unix.c',
'src/vmprof_mt.c',
)
c_args += ['-DVMPROF_APPLE=1', '-DVMPROF_UNIX=1']
elif system == 'linux' or system == 'freebsd'
sources += files(
'src/symboltable.c',
'src/vmprof_unix.c',
'src/vmprof_mt.c',
'src/libbacktrace/backtrace.c',
'src/libbacktrace/state.c',
'src/libbacktrace/elf.c',
'src/libbacktrace/dwarf.c',
'src/libbacktrace/fileline.c',
'src/libbacktrace/mmap.c',
'src/libbacktrace/mmapio.c',
'src/libbacktrace/posix.c',
'src/libbacktrace/sort.c',
)
c_args += ['-DVMPROF_UNIX=1']
unwind_dep = dependency('libunwind', required: false)
if not unwind_dep.found()
unwind_dep = cc.find_library('unwind')
endif
deps += unwind_dep
if system == 'linux'
c_args += ['-DVMPROF_LINUX=1']
deps += cc.find_library('dl', required: false)
else
c_args += ['-DVMPROF_BSD=1']
inc = [inc, include_directories('/usr/local/include')]
endif
else
error('platform "' + system + '" is not supported')
endif

if system != 'windows'
c_args += cc.get_supported_arguments('-Wno-unused')
endif

if py.language_version().version_compare('>=3.11')
sources += files('src/populate_frames.c')
endif

py.extension_module('_vmprof',
sources,
c_args: c_args,
include_directories: inc,
dependencies: deps,
install: true,
)
endif
37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[build-system]
build-backend = "mesonpy"
requires = ["meson-python>=0.17"]

[project]
name = "vmprof"
dynamic = ["version"]
description = "Python's vmprof client"
readme = "README.md"
license = "MIT"
license-files = ["LICENSE"]
authors = [
{name = "vmprof team", email = "fijal@baroquesoftware.com"},
]
requires-python = ">=3.9,<3.16"
dependencies = [
"requests",
"six",
"pytz",
"colorama",
]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

[project.urls]
Homepage = "https://github.com/vmprof/vmprof-python"
Documentation = "https://vmprof.readthedocs.org/"

[project.scripts]
vmprofshow = "vmprof.show:main"

[tool.meson-python.args]
setup = ["--vsenv"]
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

158 changes: 0 additions & 158 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requests
urllib3==1.26.6 ; python_version < '3.9'
backports.shutil_which
cffi
setuptools
setuptools>=77
pytest
hypothesis
colorama
Expand Down
Loading