diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3da861f..d46fb755 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,23 +8,30 @@ on: jobs: main-windows: - uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1 with: - env: '["py38"]' + env: '["py39"]' os: windows-latest arch: '["x64", "x86"]' wheel-tags: true submodules: true main-macos: - uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1 with: - env: '["py38"]' + env: '["py39"]' os: macos-latest wheel-tags: true submodules: true + main-macos-intel: + uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1 + with: + env: '["py39"]' + os: macos-13 + wheel-tags: true + submodules: true main-linux: - uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1 with: - env: '["pypy3", "py38", "py39", "py310", "py311"]' + env: '["py39", "py310", "py311"]' os: ubuntu-latest submodules: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 791adf5f..1874d259 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -9,26 +9,30 @@ repos: - id: double-quote-string-fixer - id: name-tests-test - id: requirements-txt-fixer +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v2.8.0 + hooks: + - id: setup-cfg-fmt - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + rev: v3.15.0 hooks: - id: reorder-python-imports - args: [--py38-plus] + args: [--py39-plus] - repo: https://github.com/asottile/add-trailing-comma - rev: v3.1.0 + rev: v3.2.0 hooks: - id: add-trailing-comma - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.20.0 hooks: - id: pyupgrade - args: [--py38-plus] + args: [--py39-plus] - repo: https://github.com/hhatto/autopep8 - rev: v2.0.4 + rev: v2.3.2 hooks: - id: autopep8 - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.2.0 hooks: - id: flake8 exclude: ^docs/conf.py diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 101beec7..37c4e077 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -23,10 +23,10 @@ Tests - All code patches should contain one or more unit tests or regression tests. - All code patches have to successfully run tests on every Python version we aim to support. tox_ would help. -- All commits will be tested by `Azure Pipelines`_ (Linux and Windows). +- All commits will be tested by `GitHub Actions`_ (Linux and Windows). .. _tox: https://tox.readthedocs.io/ -.. _`Azure Pipelines`: https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=main +.. _`GitHub Actions`: https://github.com/sass/libsass-python/actions Maintainer's guide @@ -50,10 +50,9 @@ Here's a brief check list for releasing a new version: - Make a source distribution and upload it to PyPI (``python3 setup.py sdist upload``). If it's successful the new version must appear on PyPI_. -- `Azure Pipelines`_ automatically makes binary wheels for Windows, but each +- `GitHub Actions`_ automatically makes binary wheels for Windows, but each CI build takes a while. These wheels are not automatically uploaded, - but there's ``./bin/download-windows-wheels`` script that downloads built - wheels. Then upload them with ``twine``. + you can retreive them from the build's artifacts. - Run ``./bin/build-manylinux-wheels`` to build linux wheels and upload them to PyPI (takes ~5 minutes). - The `docs website`__ also has to be updated. diff --git a/README.rst b/README.rst index de214895..593c78f1 100644 --- a/README.rst +++ b/README.rst @@ -20,8 +20,6 @@ distribution/deployment. That means you can add just ``libsass`` into your ``setup.py``'s ``install_requires`` list or ``requirements.txt`` file. No need for Ruby nor Node.js. -It currently supports CPython 3.7+, and PyPy 3! - .. _Sass: https://sass-lang.com/ .. _LibSass: https://github.com/sass/libsass diff --git a/bin/build-manylinux-wheels b/bin/build-manylinux-wheels index 65e05355..233c5afc 100755 --- a/bin/build-manylinux-wheels +++ b/bin/build-manylinux-wheels @@ -22,7 +22,7 @@ def check_call(*cmd): def main(): os.makedirs('dist', exist_ok=True) with tempfile.TemporaryDirectory() as work: - pip = '/opt/python/cp37-cp37m/bin/pip' + pip = '/opt/python/cp39-cp39/bin/pip' check_call( 'docker', 'run', '-ti', # Use this so the files are not owned by root diff --git a/bin/download-windows-wheels b/bin/download-windows-wheels deleted file mode 100755 index dee25a26..00000000 --- a/bin/download-windows-wheels +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import io -import json -import os.path -import re -import urllib.request -import zipfile - -DEFINITION_RE = re.compile( - r'https://dev.azure.com/(?P[^/]+)/(?P[^/]+)' - r'/_build/latest\?definitionId=(?P\d+)', -) -BUILDS = 'https://dev.azure.com/{org}/{project}/_apis/build/builds?api-version=5.0&definitions={definition}&$top=5' # noqa: E501 -ARTIFACTS = 'https://dev.azure.com/{org}/{project}/_apis/build/builds/{build}/artifacts?api-version=5.0' # noqa: E501 - - -def main() -> int: - parser = argparse.ArgumentParser() - parser.add_argument('tag') - parser.add_argument('--dest', default='dist') - args = parser.parse_args() - - with open('README.rst') as f: - match = DEFINITION_RE.search(f.read()) - assert match - - builds_resp = urllib.request.urlopen(BUILDS.format(**match.groupdict())) - builds_json = json.load(builds_resp) - - build_id = next( - iter([ - build['id'] for build in builds_json['value'] - if build['status'] == 'completed' - if build['result'] == 'succeeded' - if build['sourceBranch'] == f'refs/tags/{args.tag}' - ]), - ) - - artifacts_url = ARTIFACTS.format(build=build_id, **match.groupdict()) - artifacts_resp = urllib.request.urlopen(artifacts_url) - artifacts_json = json.load(artifacts_resp) - - os.makedirs(args.dest, exist_ok=True) - for artifact in artifacts_json['value']: - if artifact['name'].startswith('wheel_'): - print(f'artifact: {artifact["name"]}') - resp = urllib.request.urlopen(artifact['resource']['downloadUrl']) - bio = io.BytesIO(resp.read()) - with zipfile.ZipFile(bio) as zipf: - for info in zipf.infolist(): - if info.filename.endswith('.whl'): - info.filename = os.path.basename(info.filename) - zipf.extract(info, path=args.dest) - return 0 - - -if __name__ == '__main__': - raise SystemExit(main()) diff --git a/docs/changes.rst b/docs/changes.rst index 0cc472e9..cf4b4b8e 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -1,6 +1,16 @@ Changelog ========= +Version 0.23.0 +-------------- + +Released on January 6, 2024. + +- Follow up the libsass upstream: 3.6.6 --- See the release notes of LibSass + 3.6.6__. [:issue:`452` by Anthony Sottile] + +__ https://github.com/sass/libsass/releases/tag/3.6.6 + Version 0.22.0 -------------- diff --git a/docs/conf.py b/docs/conf.py index ca7e3906..46964c23 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -267,11 +267,11 @@ extlinks = { - 'issue': ('https://github.com/sass/libsass-python/issues/%s', '#'), + 'issue': ('https://github.com/sass/libsass-python/issues/%s', '#%s'), 'branch': ( 'https://github.com/sass/libsass-python/compare/main...%s', - '', + '%s', ), - 'commit': ('https://github.com/sass/libsass-python/commit/%s', ''), - 'upcommit': ('https://github.com/sass/libsass/commit/%s', ''), + 'commit': ('https://github.com/sass/libsass-python/commit/%s', '%s'), + 'upcommit': ('https://github.com/sass/libsass/commit/%s', '%s'), } diff --git a/docs/index.rst b/docs/index.rst index dafa5845..be2ee3f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,8 +8,6 @@ distribution/deployment. That means you can add just ``libsass`` into your :file:`setup.py`'s ``install_requires`` list or :file:`requirements.txt` file. -It currently supports CPython 3.7+ and PyPy 3! - .. _Sass: https://sass-lang.com/ .. _LibSass: https://github.com/sass/libsass diff --git a/libsass b/libsass index f6afdbb9..7037f03f 160000 --- a/libsass +++ b/libsass @@ -1 +1 @@ -Subproject commit f6afdbb9288d20d1257122e71d88e53348a53af3 +Subproject commit 7037f03fabeb2b18b5efa84403f5a6d7a990f460 diff --git a/sass.py b/sass.py index 4e660883..055221fb 100644 --- a/sass.py +++ b/sass.py @@ -24,7 +24,7 @@ 'SassError', 'SassFunction', 'SassList', 'SassMap', 'SassNumber', 'SassWarning', 'and_join', 'compile', 'libsass_version', ) -__version__ = '0.22.0' +__version__ = '0.23.0' libsass_version = _sass.libsass_version diff --git a/setup.cfg b/setup.cfg index 8d0ca2bb..406413ca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,50 @@ +[metadata] +name = libsass +version = attr: sass.__version__ +description = Sass for Python: A straightforward binding of libsass for Python. +long_description = file: README.rst +long_description_content_type = text/x-rst +url = https://sass.github.io/libsass-python/ +author = Hong Minhee +author_email = minhee@dahlia.kr +license = MIT +license_files = LICENSE +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Intended Audience :: Developers + Operating System :: OS Independent + Programming Language :: C + Programming Language :: C++ + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Programming Language :: Python :: Implementation :: Stackless + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: Dynamic Content + Topic :: Software Development :: Code Generators + Topic :: Software Development :: Compilers + +[options] +packages = sassutils +py_modules = + pysassc + sass + sasstests +python_requires = >=3.9 + +[options.entry_points] +console_scripts = + pysassc = pysassc:main +distutils.commands = + build_sass = sassutils.distutils:build_sass +distutils.setup_keywords = + sass_manifests = sassutils.distutils:validate_manifests + [aliases] upload_doc = build_sphinx upload_doc release = sdist upload build_sphinx upload_doc [flake8] exclude = .tox,build,dist,docs,ez_setup.py - -[metadata] -license_file = LICENSE diff --git a/setup.py b/setup.py index fe9743e8..d877c2af 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -import ast import atexit import os.path import platform @@ -97,26 +96,7 @@ def customize_compiler(compiler): elif filename.endswith('.h'): headers.append(filename) - if sys.platform == 'win32': - from distutils.msvc9compiler import get_build_version - vscomntools_env = 'VS{}{}COMNTOOLS'.format( - int(get_build_version()), - int(get_build_version() * 10) % 10, - ) - try: - os.environ[vscomntools_env] = os.environ['VS140COMNTOOLS'] - except KeyError: - distutils.log.warn( - 'You probably need Visual Studio 2015 (14.0) ' - 'or higher', - ) - from distutils import msvccompiler, msvc9compiler - if msvccompiler.get_build_version() < 14.0: - msvccompiler.get_build_version = lambda: 14.0 - if get_build_version() < 14.0: - msvc9compiler.get_build_version = lambda: 14.0 - msvc9compiler.VERSION = 14.0 - elif platform.system() in {'Darwin', 'FreeBSD', 'OpenBSD'}: + if platform.system() in {'Darwin', 'FreeBSD', 'OpenBSD'}: # Dirty workaround to avoid link error... # Python distutils doesn't provide any way # to configure different flags for each cc and c++. @@ -169,24 +149,6 @@ def restore_cencode(): ) -def version(sass_filename='sass.py'): - with open(sass_filename) as f: - tree = ast.parse(f.read(), sass_filename) - for node in tree.body: - if isinstance(node, ast.Assign) and len(node.targets) == 1: - target, = node.targets - if isinstance(target, ast.Name) and target.id == '__version__': - return node.value.s - - -def readme(): - try: - with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: - return f.read() - except OSError: - pass - - class upload_doc(distutils.cmd.Command): """Uploads the documentation to GitHub pages.""" @@ -237,53 +199,6 @@ def finalize_options(self): setup( - name='libsass', - description='Sass for Python: ' - 'A straightforward binding of libsass for Python.', - long_description=readme(), - version=version(), ext_modules=[sass_extension], - packages=['sassutils'], - py_modules=['pysassc', 'sass', 'sasstests'], - package_data={ - '': [ - 'README.rst', - 'test/*.sass', - ], - }, - license='MIT License', - author='Hong Minhee', - author_email='minhee' '@' 'dahlia.kr', - url='https://sass.github.io/libsass-python/', - download_url='https://github.com/sass/libsass-python/releases', - entry_points={ - 'distutils.commands': [ - 'build_sass = sassutils.distutils:build_sass', - ], - 'distutils.setup_keywords': [ - 'sass_manifests = sassutils.distutils:validate_manifests', - ], - 'console_scripts': [ - ['pysassc = pysassc:main'], - ], - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: C++', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Programming Language :: Python :: Implementation :: Stackless', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Software Development :: Code Generators', - 'Topic :: Software Development :: Compilers', - ], - python_requires='>=3.8', cmdclass=cmdclass, )