Skip to content

Commit 89caefe

Browse files
committed
Add uv support, try again for the CI.
1 parent 3967c38 commit 89caefe

5 files changed

Lines changed: 100 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: |
5252
python setup.py test
5353
54-
Install:
54+
Install-Pip:
5555
runs-on: ubuntu-24.04
5656
strategy:
5757
matrix:
@@ -68,8 +68,38 @@ jobs:
6868
pip install -r requirements.txt
6969
git submodule update --init --recursive
7070
71-
- name: Install
71+
- name: Install with pip
7272
shell: bash
7373
run: |
7474
python setup.py install
7575
pcpp --version
76+
77+
Install-Uv:
78+
runs-on: ubuntu-24.04
79+
strategy:
80+
matrix:
81+
python-version: ['3.x', 'pypy3.11']
82+
83+
steps:
84+
- uses: actions/checkout@v5
85+
- uses: actions/setup-python@v6
86+
with:
87+
python-version: ${{ matrix.python-version }}
88+
89+
- name: Install uv
90+
shell: bash
91+
run: |
92+
curl -LsSf https://astral.sh/uv/install.sh | sh
93+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
94+
95+
- shell: bash
96+
run: |
97+
git submodule update --init --recursive
98+
99+
- name: Install with uv
100+
shell: bash
101+
run: |
102+
uv venv test_env
103+
source test_env/bin/activate
104+
uv pip install -e .
105+
pcpp --version

README.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ A C99 preprocessor written in pure Python
44
:language: c
55

66
.. |travis| image:: https://github.com/ned14/pcpp/workflows/CI/badge.svg?branch=master
7-
:align: middle
8-
:target: https://github.com/ned14/pcpp/actions
7+
:align: middle
8+
:target: https://github.com/ned14/pcpp/actions
99

1010
\(C) 2018-2026 Niall Douglas http://www.nedproductions.biz/ and (C) 2007-2020 David Beazley http://www.dabeaz.com/
1111

@@ -21,6 +21,19 @@ can stand in for a conventional C preprocessor (i.e. it'll accept similar argume
2121
Works great under PyPy, and you can expect performance gains of between 0.84x and 2.62x
2222
(average = 2.2x, median = 2.31x).
2323

24+
To install pcpp, you can use either pip or uv:
25+
26+
Using pip:
27+
::
28+
29+
pip install pcpp
30+
31+
Using uv (faster installation):
32+
::
33+
34+
uv install pcpp
35+
36+
2437
Your includes can be benchmarked for heft in order to improve your build times! See
2538
the ``--times`` and ``--filetimes`` options, and you can see graphs from pcpp for the
2639
C++ STLs at https://github.com/ned14/stl-header-heft.

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pcpp"
7+
version = "1.31"
8+
description = "A C99 preprocessor written in pure Python"
9+
readme = "README.rst"
10+
license = {text = "BSD"}
11+
authors = [
12+
{name = "Niall Douglas and David Beazley"}
13+
]
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Intended Audience :: Developers",
17+
"Topic :: Software Development :: Build Tools",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3 :: Only",
20+
"Programming Language :: Python :: 3.6",
21+
"Programming Language :: Python :: 3.7",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12"
27+
]
28+
requires-python = ">=3.6"
29+
30+
[project.scripts]
31+
pcpp = "pcpp:main"
32+
33+
[tool.setuptools]
34+
packages = ["pcpp", "pcpp.ply.ply"]
35+
36+
[tool.setuptools.package-data]
37+
pcpp = ["../LICENSE.txt"]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
setuptools
2+
wheel

setup.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
#!/usr/bin/env python
22

3-
from setuptools import setup, find_packages
4-
import os, pcpp
3+
from setuptools import setup
4+
import os
5+
import re
56

67
here = os.path.abspath(os.path.dirname(__file__))
78

89
# Get the long description from the README file
910
with open(os.path.join(here, 'README.rst')) as f:
1011
long_description = f.read()
11-
12+
13+
# Read version from pcpp/pcmd.py without importing it
14+
with open(os.path.join(here, 'pcpp', 'pcmd.py')) as f:
15+
content = f.read()
16+
version_match = re.search(r"^version=['\"]([^'\"]*)['\"]", content, re.M)
17+
if version_match:
18+
version = version_match.group(1)
19+
else:
20+
raise RuntimeError("Unable to find version string.")
21+
1222
setup(
1323
name='pcpp',
14-
version=pcpp.version,
24+
version=version,
1525
description='A C99 preprocessor written in pure Python',
1626
long_description=long_description,
1727
author='Niall Douglas and David Beazley',
1828
url='https://github.com/ned14/pcpp',
19-
packages=['pcpp', 'pcpp/ply/ply'],
29+
packages=['pcpp', 'pcpp.ply.ply'],
2030
package_data={'pcpp' : ['../LICENSE.txt']},
2131
test_suite='tests',
2232
entry_points={
@@ -28,7 +38,6 @@
2838
'Development Status :: 5 - Production/Stable',
2939
'Intended Audience :: Developers',
3040
'Topic :: Software Development :: Build Tools',
31-
'License :: OSI Approved :: BSD License',
3241
'Programming Language :: Python :: 3',
3342
'Programming Language :: Python :: 3 :: Only',
3443
'Programming Language :: Python :: 3.6',

0 commit comments

Comments
 (0)