Skip to content

Commit 56a7cba

Browse files
committed
Modernize build process.
TODO: Add Sphinx to dev dependencies.
1 parent aec3732 commit 56a7cba

File tree

14 files changed

+1308
-307
lines changed

14 files changed

+1308
-307
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,31 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v4
2525

26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v5
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v6
2828
with:
29+
enable-cache: true
2930
python-version: ${{ matrix.python-version }}
3031

3132
- name: Install Linux dependencies
3233
run: |
3334
sudo apt-get update
3435
sudo apt-get install -y libattr1-dev libfuse3-dev fuse3
35-
sudo apt-get install -y pkg-config gcc ninja-build meson
36+
sudo apt-get install -y pkg-config gcc
3637
37-
- name: Install Python dependencies (misc)
38-
run: pip install setuptools trio pytest pytest_trio mypy sphinx
39-
40-
- name: Install Python dependencies (Cython 0.29)
38+
- name: Install old Cython
4139
if: ${{ matrix.cython-version == '0.29' }}
4240
run: pip install "Cython<3"
4341

44-
- name: Install Python dependencies (Cython 3.x)
42+
- name: Install modern Cython
4543
if: ${{ matrix.cython-version == '3' }}
4644
run: pip install "Cython>=3"
4745

4846
- name: Build
49-
run: |
50-
# Disable developer mode, so that build does not suddenly break if
51-
# e.g. a newer compiler version results in new warning messages.
52-
rm MANIFEST.in
53-
python setup.py build_cython
54-
python setup.py build_ext --inplace
55-
56-
- name: Test
57-
run: pytest -v -rs test/
47+
run: uv sync --locked
5848

59-
- name: Typecheck
60-
run: mypy
49+
- name: Run tests
50+
run: uv run pytest -v -rs test/
6151

6252
- name: Build docs
6353
run: sphinx-build -b html rst doc/html

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ graft rst
77
graft util
88
graft test
99
prune test/.cache
10+
prune .github
1011
exclude MANIFEST.in
12+
exclude .git*
13+
exclude .readthedocs.yaml
1114
recursive-include src *.pyx *.pyi *.py *.pxi *.pxd *.c *.h
1215
global-exclude *.pyc

developer-notes/release_process.rst

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
Steps for Releasing a New Version
22
---------------------------------
33

4-
* pip install twine sphinx
5-
* pip install -U Cython # important: use latest/best Cython!
6-
* Bump version in `setup.py` and version/release in `rst/conf.py`
4+
* Bump version in `pyproject.toml` and version/release in `rst/conf.py`
75
* Add release date to `Changes.rst`
8-
* `./setup.py build_cython`
9-
* `./setup.py sdist`
10-
* Extract tarball in temporary directory,
11-
* `python3 setup.py build_ext --inplace && python3 -m pytest test`
12-
* Run tests under valgrind. Build python `--with-valgrind --with-pydebug`, then `valgrind --trace-children=yes "--trace-children-skip=*mount*" python-dbg -m pytest test/`
6+
* `uv sync --locked` (also installs twine, sphinx, Cython)
137
* `sphinx-build -b html rst doc/html`
14-
* `./setup.py build_ext --inplace`
15-
* `./setup.py sdist`
168
* Git commit / tag & sign
9+
* `uv build --sdist` (or `python3 -m build --sdist`)
1710
* `util/sdist-sign 1.2.3`
1811
* `util/upload-pypi 1.2.3`
1912
* Send announcement to mailing list

developer-notes/setup.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to run/develop pyfuse3 from Git
2+
3+
To run unit tests, build the documentation, and make changes to pyfuse3, the recommended procedure is
4+
to create a virtual environment and install S3QL, build dependencies, and development tools into
5+
this environment.
6+
7+
You can do this using a tool like [uv](https://docs.astral.sh/uv/getting-started/installation/) or
8+
by hand as follows:
9+
10+
```sh
11+
$ python3 -m venv .venv # create the venv
12+
$ . .venv/bin/activate # activate it
13+
$ pip install --upgrade pip # upgrade pip
14+
$ pip install --group dev # install build dependencies
15+
$ pip install --no-build-isolation --editable . # install pyfuse3 in editable mode
16+
```
17+
18+
As long as the venv is active, you can run tests with
19+
20+
```sh
21+
$ pytest tests/
22+
```
23+
24+
and build the HTML documentation and manpages with:
25+
```sh
26+
$ sphinx-build -b html rst doc/html
27+
```
28+

developer-notes/valgrind.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
To run tests under valgrind:
2+
3+
- Build python `--with-valgrind --with-pydebug`.
4+
- Run `valgrind --trace-children=yes "--trace-children-skip=*mount*" python-dbg -m pytest test/`

pyproject.toml

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
[build-system]
2-
requires = ["setuptools >= 78.1.1"]
3-
build-backend = "setuptools.build_meta"
4-
5-
[tool.mypy]
6-
mypy_path = ["$MYPY_CONFIG_FILE_DIR/src"]
7-
packages = ["pyfuse3"]
8-
modules = ["_pyfuse3"]
9-
namespace_packages = false
10-
strict = true
2+
requires = ["setuptools>=78.1.1", "setuptools_scm>=8.0", "Cython"]
3+
build-backend = "build_backend"
4+
backend-path = ["util"]
5+
6+
[project]
7+
name = "pyfuse3"
8+
dynamic = ["version"]
9+
description = "Python 3 bindings for libfuse 3 with async I/O support"
10+
readme = "README.rst"
11+
requires-python = ">=3.10"
12+
license = "LGPL-2.1-or-later"
13+
authors = [
14+
{name = "Nikolaus Rath", email = "Nikolaus@rath.org"}
15+
]
16+
keywords = ["FUSE", "python"]
17+
classifiers = [
18+
"Development Status :: 5 - Production/Stable",
19+
"Intended Audience :: Developers",
20+
"Programming Language :: Python",
21+
"Topic :: Software Development :: Libraries :: Python Modules",
22+
"Topic :: System :: Filesystems",
23+
"Operating System :: POSIX :: Linux",
24+
"Operating System :: MacOS :: MacOS X",
25+
"Operating System :: POSIX :: BSD :: FreeBSD",
26+
"Typing :: Typed",
27+
]
28+
dependencies = [
29+
"trio >= 0.15",
30+
]
31+
32+
[project.urls]
33+
Homepage = "https://github.com/libfuse/pyfuse3"
34+
35+
[dependency-groups]
36+
dev = [
37+
"pytest >= 3.4.0",
38+
"pytest-trio",
39+
"sphinx",
40+
"twine",
41+
]
42+
43+
[tool.setuptools_scm]
44+
45+
[tool.setuptools]
46+
include-package-data = true
47+
48+
[tool.setuptools.packages.find]
49+
where = ["src"]
50+
51+
[tool.setuptools.package-data]
52+
pyfuse3 = ["py.typed"]
53+

requirements.d/rtd.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

rst/install.rst

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,35 @@
88
Dependencies
99
============
1010

11-
In order to build and run pyfuse3 you need the following software:
11+
As usual, Python dependencies are specified in `pyproject.toml`. However, to build pyfuse3 you
12+
also need the following additional dependencies installed on your system:
1213

13-
* Linux kernel 3.9 or newer.
14-
* Version 3.3.0 or newer of the libfuse_ library, including development
14+
* libfuse_, version 3.3.0 or newer, including development
1515
headers (typically distributions provide them in a *libfuse3-devel*
1616
or *libfuse3-dev* package).
17-
* Python_ 3.8 or newer installed with development headers
18-
* The Trio_ Python module, version 0.7 or newer.
19-
* The `setuptools`_ Python module, version 1.0 or newer.
2017
* the `pkg-config`_ tool
2118
* the `attr`_ library
22-
* A C compiler (only for building)
23-
24-
To run the unit tests, you will need
25-
26-
* The `py.test`_ Python module, version 3.3.0 or newer
19+
* Python development headers (for example, the *python3-dev* or
20+
*python3-devel* package on many Linux distributions)
21+
* A C compiler
2722

2823

2924
Stable releases
3025
===============
3126

32-
To install a stable pyfuse3 release:
33-
34-
1. Download and unpack the release tarball from https://pypi.python.org/pypi/pyfuse3/
35-
2. Run ``python3 setup.py build_ext --inplace`` to build the C extension
36-
3. Run ``python3 -m pytest test/`` to run a self-test. If this fails, ask
37-
for help on the `FUSE mailing list`_ or report a bug in the
38-
`issue tracker <https://bitbucket.org/nikratio/python-pyfuse3/issues>`_.
39-
4. To install system-wide for all users, run ``sudo python setup.py
40-
install``. To install into :file:`~/.local`, run ``python3
41-
setup.py install --user``.
27+
To install a stable pyfuse3 release, ensure you have the non-Python dependencies
28+
installed and then use your favorite Python package manager to install pyfuse3 from
29+
PyPI (e.g. `pip install pyfuse3`).
4230

4331

44-
Development Version
45-
===================
32+
Installing from Git / Developing pyfuse3
33+
========================================
4634

47-
If you have checked out the unstable development version, a bit more
48-
effort is required. You need to also have Cython_ (0.29 or newer) and
49-
Sphinx_ installed, and the necessary commands are::
35+
Clone the pyfuse3_ repository and take a look at `developer_notes/setup.md`.
5036

51-
python3 setup.py build_cython
52-
python3 setup.py build_ext --inplace
53-
python3 -m pytest test/
54-
sphinx-build -b html rst doc/html
55-
python3 setup.py install
5637

5738

58-
.. _Cython: http://www.cython.org/
59-
.. _Sphinx: http://sphinx.pocoo.org/
60-
.. _Python: http://www.python.org/
61-
.. _Trio: https://github.com/python-trio/trio
62-
.. _FUSE mailing list: https://lists.sourceforge.net/lists/listinfo/fuse-devel
63-
.. _`py.test`: https://pypi.python.org/pypi/pytest/
6439
.. _libfuse: http://github.com/libfuse/libfuse
6540
.. _attr: http://savannah.nongnu.org/projects/attr/
6641
.. _`pkg-config`: http://www.freedesktop.org/wiki/Software/pkg-config
67-
.. _setuptools: https://pypi.python.org/pypi/setuptools
42+
.. _pyfuse3: https://github.com/libfuse/pyfuse3/

setup.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)