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
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
a tiny package for fast python c++ binding build.

ccimport 0.2.x support python 3.5.
ccimport >= 0.3 support python 3.6-3.10.
ccimport >= 0.3 support python 3.6-3.14.

## Usage

Expand Down
9 changes: 8 additions & 1 deletion ccimport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
from .core import ccimport
from .buildmeta import BuildMeta
from .buildmeta import BuildMeta

try:
from .__version__ import __version__
except ImportError:
__version__ = "unknown"

__all__ = ["ccimport", "BuildMeta", "__version__"]
8 changes: 6 additions & 2 deletions ccimport/buildtools/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import subprocess
from collections import OrderedDict
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from typing import Any, Dict, List, Optional, Union

from ninja.ninja_syntax import Writer
from ccimport import compat
Expand All @@ -21,7 +21,11 @@

DEFAULT_MSVC_DEP_PREFIX = LOCALE_TO_MSVC_DEP_PREFIX["en"]

_LOC = locale.getdefaultlocale()[0]
try:
_LOC = locale.getlocale()[0]
except Exception:
_LOC = None

if _LOC is not None:
if _LOC in LOCALE_TO_MSVC_DEP_PREFIX:
DEFAULT_MSVC_DEP_PREFIX = LOCALE_TO_MSVC_DEP_PREFIX[_LOC]
Expand Down
51 changes: 50 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
[build-system]
requires = ["setuptools>=41.0", "wheel"]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "ccimport"
dynamic = ["version"]
description = "a tiny package for fast python c++ binding build."
readme = "README.md"
requires-python = ">=3.6"
license = {text = "MIT"}
authors = [
{name = "Yan Yan", email = "yanyan.sub@outlook.com"}
]
keywords = ["pybind11", "c++", "bindings", "compilation", "ninja"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"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",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Code Generators",
]
dependencies = [
"pybind11",
"ninja",
"requests",
"importlib-metadata>=2.0; python_version < '3.8'",
"dataclasses; python_version == '3.6'",
]

[project.urls]
Homepage = "https://github.com/FindDefinition/ccimport"
Repository = "https://github.com/FindDefinition/ccimport"
Issues = "https://github.com/FindDefinition/ccimport/issues"

[tool.setuptools]
packages = ["ccimport", "ccimport.buildtools", "ccimport.ccpkg"]
include-package-data = true

[tool.setuptools.dynamic]
version = {file = "version.txt"}
97 changes: 16 additions & 81 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
"""
Minimal setup.py for custom commands and dynamic version handling.
Most configuration has been moved to pyproject.toml.
"""

import io
import os
import sys
from shutil import rmtree

from setuptools import Command, find_packages, setup
from setuptools import Command, setup

# Package meta-data.
NAME = 'ccimport'
DESCRIPTION = 'a tiny package for fast python c++ binding build.'
URL = 'https://github.com/FindDefinition/ccimport'
EMAIL = 'yanyan.sub@outlook.com'
AUTHOR = 'Yan Yan'
REQUIRES_PYTHON = '>=3.6'
VERSION = None

# What packages are required for this module to be executed?
REQUIRED = [
"pybind11",
"ninja",
"requests",
"importlib-metadata>=2.0; python_version < \"3.8\"",
"dataclasses; python_version == \"3.6\"",
]

# What packages are optional?
EXTRAS = {
# 'fancy feature': ['django'],
}

# The rest you shouldn't have to touch too much :)
# ------------------------------------------------
# Except, perhaps the License and Trove Classifiers!
# If you do change the License, remember to change the Trove Classifier for that!

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

# Import the README and use it as the long-description.
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
try:
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()
except FileNotFoundError:
long_description = DESCRIPTION

# Load the package's __version__.py module as a dictionary.
about = {}
if not VERSION:
with open('version.txt', 'r') as f:
version = f.read().strip()
else:
version = VERSION
cwd = os.path.dirname(os.path.abspath(__file__))

# Load version from version.txt
with open('version.txt', 'r') as f:
version = f.read().strip()


def _convert_build_number(build_number):
parts = build_number.split(".")
Expand All @@ -69,12 +33,13 @@ def _convert_build_number(build_number):
raise NotImplementedError


# Handle dev version suffix from environment variable
env_suffix = os.environ.get("CCIMPORT_VERSION_SUFFIX", "")
if env_suffix != "":
version += ".dev{}".format(_convert_build_number(env_suffix))
version_path = os.path.join(cwd, NAME, '__version__.py')
about['__version__'] = version

# Write version to __version__.py
version_path = os.path.join(cwd, NAME, '__version__.py')
with open(version_path, 'w') as f:
f.write("__version__ = '{}'\n".format(version))

Expand Down Expand Up @@ -103,51 +68,21 @@ def run(self):
except OSError:
pass

self.status('Building Source and Wheel (universal) distribution...')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(
sys.executable))
self.status('Building Source and Wheel distribution...')
os.system('{0} -m build'.format(sys.executable))

self.status('Uploading the package to PyPI via Twine...')
os.system('twine upload dist/*')

self.status('Pushing git tags...')
os.system('git tag v{0}'.format(about['__version__']))
os.system('git tag v{0}'.format(version))
os.system('git push --tags')

sys.exit()


# Where the magic happens:
# Minimal setup call - most config is in pyproject.toml
setup(
name=NAME,
version=about['__version__'],
description=DESCRIPTION,
long_description=long_description,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
packages=find_packages(exclude=('tests', )),
# If your package is a single module, use this instead of 'packages':
# py_modules=['mypackage'],
entry_points={
'console_scripts': [],
},
install_requires=REQUIRED,
extras_require=EXTRAS,
include_package_data=True,
license='MIT',
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
],
# $ setup.py publish support.
cmdclass={
'upload': UploadCommand,
},
Expand Down
2 changes: 1 addition & 1 deletion test/test_source_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_source_iter():
pair = siter.next_curly()
assert pair is not None

return siter.identifiers
assert siter.identifiers


def test_source_iter2():
Expand Down