Skip to content

Kanchenjunga Release (1.1.2) #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
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
32 changes: 32 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: "Python Test Suite"

on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install -e '.[development]'
- name: Test with pytest
run: |
pytest
Empty file added .packaging/build/.keep
Empty file.
Empty file added .packaging/dist/.keep
Empty file.
Empty file added .packaging/release/.keep
Empty file.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: python
sudo: false
cache: pip

branches:
Expand All @@ -14,6 +13,11 @@ python:
- "3.5"
- "3.6"

matrix:
include:
- python: "3.7"
dist: xenial

install:
- travis_retry pip install --upgrade setuptools pip codecov
- pip install -e '.[development]'
Expand Down
3 changes: 2 additions & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Copyright © 2006-2018 Alice Bevan-McGregor and contributors.
Copyright © 2006-2022 Alice Bevan-McGregor and contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

40 changes: 28 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,44 @@ USE = development

.PHONY: all develop clean veryclean test release

all: clean develop test
all: clean develop test ## Clean caches, refresh project metadata, execute all tests.

develop: ${PROJECT}.egg-info/PKG-INFO
develop: ${PROJECT}.egg-info/PKG-INFO ## Populate project metadata.

clean:
help: ## Show this help message and exit.
@echo "Usage: make <command>\n\033[36m\033[0m"
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*?##/ { printf "\033[36m%-18s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | sort

clean: ## Remove executable caches and ephemeral collections.
find . -name __pycache__ -exec rm -rfv {} +
find . -iname \*.pyc -exec rm -fv {} +
find . -iname \*.pyo -exec rm -fv {} +
rm -rvf build htmlcov

veryclean: clean
rm -rvf *.egg-info .packaging
veryclean: clean ## Remove all project metadata, executable caches, and sensitive collections.
rm -rvf *.egg-info .packaging/{build,dist,release}/*

lint: ## Execute pylint across the project.
pylint --rcfile=setup.cfg marrow

test: develop
./setup.py test
pytest

testloop: ## Automatically execute the test suite limited to one failure.
find marrow test -name \*.py | entr -c pytest --ff --maxfail=1 -q

release:
./setup.py register sdist bdist_wheel upload ${RELEASE_OPTIONS}
@echo -e "\nView online at: https://pypi.python.org/pypi/${PROJECT} or https://pypi.org/project/${PROJECT}/"
@echo -e "Remember to make a release announcement and upload contents of .packaging/release/ folder as a Release on GitHub.\n"
release: ## Package up and utilize Twine to issue a release.
./setup.py sdist bdist_wheel ${RELEASE_OPTIONS}
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

${PROJECT}.egg-info/PKG-INFO: setup.py setup.cfg cinje/release.py
${PROJECT}.egg-info/PKG-INFO: setup.py setup.cfg
@mkdir -p ${VIRTUAL_ENV}/lib/pip-cache
pip install --cache-dir "${VIRTUAL_ENV}/lib/pip-cache" -Ue ".[${USE}]"

@# General
@[ ! -e /private ] && pip install --cache-dir "${VIRTUAL_ENV}/lib/pip-cache" -e ".[${USE}]" || true

@# macOS Specific
@[ -e /private ] && env LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L$(brew --prefix [email protected])/lib -L$(brew --prefix)/lib" \
CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I$(brew --prefix [email protected])/include -I$(brew --prefix)/include" \
pip install -e '.[development]'

29 changes: 24 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cinje
=====

© 2015-2017 Alice Bevan-McGregor and contributors.
© 2015-2022 Alice Bevan-McGregor and contributors.

..

Expand Down Expand Up @@ -580,6 +580,25 @@ Just like with ``using``, the result of the expression must be a callable genera
Version History
===============

Version 1.2.0
-------------

* *Fixed* Python 3.9 compatibility by importing ABCs from the correct location.

* Added Genshi and "raw JSON" to the benchmark suite.

* Moved test automation from Travis-CI to GitHub Actions.


Version 1.1.2
-------------

* *Fixed* `Python 3.7 exception use within generators. <https://github.com/marrow/cinje/issues/28>`_

* *Added* Genshi to the `benchmark comparison suite <https://github.com/marrow/cinje/wiki/Benchmarks#python-37>`_.

* *Fixed* minor docstring typo.

Version 1.1.1
-------------

Expand All @@ -592,7 +611,6 @@ Version 1.1.1

* *Removed* Python 3.3 testing and support, `flake8` enforcement, and `tox` build/test automation.


Version 1.1
-----------

Expand Down Expand Up @@ -628,7 +646,7 @@ cinje has been released under the MIT Open Source license.
The MIT License
---------------

Copyright © 2015-2017 Alice Bevan-McGregor and contributors.
Copyright © 2015-2022 Alice Bevan-McGregor and contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
Expand All @@ -643,6 +661,7 @@ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGE
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


.. |ghwatch| image:: https://img.shields.io/github/watchers/marrow/cinje.svg?style=social&label=Watch
:target: https://github.com/marrow/cinje/subscription
:alt: Subscribe to project activity on Github.
Expand Down Expand Up @@ -683,12 +702,12 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
:target: https://github.com/marrow/cinje/issues
:alt: Github Issues

.. |ghsince| image:: https://img.shields.io/github/commits-since/marrow/cinje/1.1.1.svg
.. |ghsince| image:: https://img.shields.io/github/commits-since/marrow/cinje/1.1.2.svg
:target: https://github.com/marrow/cinje/commits/develop
:alt: Changes since last release.

.. |ghtag| image:: https://img.shields.io/github/tag/marrow/cinje.svg
:target: https://github.com/marrow/cinje/tree/1.1.1
:target: https://github.com/marrow/cinje/tree/1.1.2
:alt: Latest Github tagged release.

.. |latestversion| image:: http://img.shields.io/pypi/v/cinje.svg?style=flat
Expand Down
6 changes: 5 additions & 1 deletion cinje/block/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def _optimize(self, context, argspec):
def __call__(self, context):
input = context.input

declaration = input.next()
try:
declaration = input.next()
except StopIteration:
return

line = declaration.partitioned[1] # We don't care about the "def".
line, _, annotation = line.rpartition('->')

Expand Down
6 changes: 5 additions & 1 deletion cinje/block/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ def __call__(self, context):

input = context.input

declaration = input.next()
try:
declaration = input.next()
except StopIteration:
return

stripped = declaration.stripped
prefix, _ = declaration.partitioned

Expand Down
5 changes: 4 additions & 1 deletion cinje/block/using.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def match(self, context, line):
def __call__(self, context):
input = context.input

declaration = input.next()
try:
declaration = input.next()
except:
return

_, _, declaration = declaration.stripped.partition(' ')
name, _, args = declaration.partition(' ')
Expand Down
5 changes: 4 additions & 1 deletion cinje/inline/blank.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ def match(self, context, line):
return not line.stripped

def __call__(self, context):
yield context.input.next()
try:
yield context.input.next()
except StopIteration:
return
5 changes: 4 additions & 1 deletion cinje/inline/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ def match(self, context, line):
return line.kind == 'code'

def __call__(self, context):
yield context.input.next() # Pass through.
try:
yield context.input.next() # Pass through.
except StopIteration:
return
5 changes: 4 additions & 1 deletion cinje/inline/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def match(self, context, line):
def __call__(self, context):
"""Emit comments into the final code that aren't marked as hidden/private."""

line = context.input.next()
try:
line = context.input.next()
except StopIteration:
return

if not line.stripped.startswith('##'):
yield line
7 changes: 6 additions & 1 deletion cinje/inline/flush.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ def match(self, context, line):
return line.kind == 'code' and line.stripped in ("flush", "yield")

def __call__(self, context):
return flush_template(context, context.input.next())
try:
line = context.input.next()
except StopIteration:
return

return flush_template(context, line)
6 changes: 5 additions & 1 deletion cinje/inline/require.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def __call__(self, context):

input = context.input

declaration = input.next()
try:
declaration = input.next()
except StopIteration:
return

namespace = declaration.partitioned[1] # Ignore the "require" part, we care about the namepsace.

module = import_module(namespace)
Expand Down
17 changes: 14 additions & 3 deletions cinje/inline/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def wrap(scope, lines, format=BARE_FORMAT):
def gather(input):
"""Collect contiguous lines of text, preserving line numbers."""

line = input.next()
try:
line = input.next()
except StopIteration:
return

lead = True
buffer = []

Expand Down Expand Up @@ -137,7 +141,10 @@ def process(self, context, lines):
handler = getattr(self, 'process_' + chunk.kind, self.process_generic)(chunk.kind, context)
handler = (chunk.kind, handler)

next(handler[1]) # We fast-forward to the first yield.
try:
next(handler[1]) # We fast-forward to the first yield.
except StopIteration:
return

result = handler[1].send(chunk) # Send the handler the next contiguous chunk.
if result: yield result
Expand All @@ -147,7 +154,11 @@ def process(self, context, lines):

# Clean up the final iteration.
if handler:
result = next(handler[1])
try:
result = next(handler[1])
except StopIteration:
return

if result: yield result

def process_text(self, kind, context):
Expand Down
6 changes: 5 additions & 1 deletion cinje/inline/use.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def __call__(self, context):

input = context.input

declaration = input.next()
try:
declaration = input.next()
except StopIteration:
return

parts = declaration.partitioned[1] # Ignore the "use" part, we care about the name and arguments.
name, _, args = parts.partition(' ')

Expand Down
2 changes: 1 addition & 1 deletion cinje/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import namedtuple


version_info = namedtuple('version_info', ('major', 'minor', 'micro', 'releaselevel', 'serial'))(1, 1, 1, 'final', 0)
version_info = namedtuple('version_info', ('major', 'minor', 'micro', 'releaselevel', 'serial'))(1, 2, 0, 'final', 0)
version = ".".join([str(i) for i in version_info[:3]]) + ((version_info.releaselevel[0] + str(version_info.serial)) if version_info.releaselevel != 'final' else '')

author = namedtuple('Author', ['name', 'email'])("Alice Bevan-McGregor", '[email protected]')
Expand Down
Loading