Skip to content
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

Heresy refactor #2

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2d2831d
setup: Start of a heresy. Renamed to Juiced Jinja2 command-line tool …
m000 Mar 10, 2021
b24390a
context processing: Renamed read_context_data2() to read_context_data().
m000 Jul 28, 2019
3d582e5
cli options: Added -I/--ignore-missing flag for ignoring missing data…
m000 Nov 21, 2019
a92a49d
context processing: Fix for env format parsing.
m000 Nov 21, 2019
983b163
filters: Exported a bunch of Python functions as filters.
m000 Nov 21, 2019
86d8508
cli options: Fixed bug with verbosity level wrapping-around.
m000 Dec 19, 2019
84b4edb
cli options: Restored previous behaviour for --undefined option.
m000 Dec 19, 2019
7f01adb
filters: Added ifelse/onoff/yesno.
m000 Apr 17, 2020
3f9d682
filters: Added align_suffix filter.
m000 Apr 17, 2020
ac8ffcb
filters: Added ctxlookup.
m000 May 8, 2020
3879fba
filters: Added sh_realpath, sh_opt, sh_optq.
m000 May 8, 2020
cc83255
cli options: Grouped options in categories. More readable help output.
m000 Mar 8, 2021
925a119
cli options: More robust data spec string parsing. Change of data spe…
m000 May 10, 2021
08d3b8d
refactor 1/: cli.py -> render.py
m000 May 12, 2021
41da67f
refactor 2/: Spun-off cli-parts from render.py.
m000 Nov 5, 2023
6aac2eb
refactor 3/: context.py -> parsers.py
m000 May 12, 2021
47e0e1e
refactor 4/: Collected dispersed defaults in a module.
m000 Nov 5, 2023
b17825d
cli: Added jj2dep tool for analyzing template dependencies.
m000 Nov 5, 2023
33ac346
setup/tests: Modernize tooling and fix tests.
m000 May 10, 2021
35bf635
Removed docs produced by exdoc tool.
m000 May 21, 2021
5926e13
documentation: Rehaul. Tool rename. Keep only the important stuff in …
m000 Nov 21, 2019
10b3c72
documentation: Update copyrights.
m000 Nov 3, 2023
74f7e55
changelog: Updates for v0.5.0.
m000 May 17, 2021
e99652e
linting: Linter fixes across the codebase.
m000 May 10, 2021
982f620
f
m000 Nov 12, 2023
b05f822
x
m000 Nov 12, 2023
6baa61b
x
m000 Nov 12, 2023
d48ed5e
x
m000 Nov 12, 2023
13025a4
x
m000 Nov 12, 2023
bcc5d66
x
m000 Nov 12, 2023
9b59279
x
m000 Nov 12, 2023
d94e835
x
m000 Nov 12, 2023
fe43605
l
m000 Nov 12, 2023
1c843d7
ll
m000 Nov 12, 2023
0bf0926
xxx
m000 Nov 12, 2023
191bc58
l
m000 Nov 12, 2023
9b8f87b
lala
m000 Nov 12, 2023
8fecb2e
f
m000 Nov 12, 2023
1a605c7
fff
m000 Nov 12, 2023
4392794
x
m000 Dec 11, 2023
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
84 changes: 84 additions & 0 deletions .github/workflows/j2cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Related documentation:
# https://jacobian.org/til/github-actions-poetry/
# https://github.com/snok/install-poetry
name: m000/j2cli
on:
push:
branches:
- "**/*"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10", "3.11" ]
runs-on: ${{ matrix.os }}
# env:
# TOXENV: py${{ matrix.python-version }}-pyyaml6
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Python ${{ matrix.python-version }} setup
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Env-Inspect1 (py${{ matrix.python-version }})
run: (echo "\n--- env"; env | sort; echo "\n--- tox"; which tox; echo "\n--- poetry"; which poetry) || true
- name: File-Inspect1 (py${{ matrix.python-version }})
run: find .

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: 1.7.0
virtualenvs-create: true
virtualenvs-in-project: true # create .venv in test directory
- name: Install Poetry development dependencies # main dependencies are handled by tox
if: steps.cached-poetry.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --only=dev

- name: Env-Inspect2 (py${{ matrix.python-version }})
run: (echo "\n--- env"; env | sort; echo "\n--- tox"; which tox; echo "\n--- poetry"; which poetry) || true
- name: File-Inspect2 (py${{ matrix.python-version }})
run: find .

- name: Activate Poetry development dependencies # main dependencies are handled by tox
if: steps.cached-poetry.outputs.cache-hit == 'true'
run: source .venv/bin/activate

- name: Env-Inspect3 (py${{ matrix.python-version }})
run: (echo "\n--- env"; env | sort; echo "\n--- tox"; which tox; echo "\n--- poetry"; which poetry) || true
- name: File-Inspect3 (py${{ matrix.python-version }})
run: find .

- name: Load cached tox environment
id: cached-toxenv
uses: actions/cache@v3
with:
path: .tox/py${{ matrix.python-version }}-**
key: toxenv-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock', 'tox.ini') }}

- name: Tox tests (py${{ matrix.python-version }})
run: poetry run tox

- name: Send coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
#files: ./coverage1.xml,./coverage2.xml # optional
#flags: unittests # optional
#name: codecov-umbrella # optional
fail_ci_if_error: false
verbose: true

- name: Env-Inspect4 (py${{ matrix.python-version }})
run: (echo "\n--- env"; env | sort; echo "\n--- tox"; which tox; echo "\n--- poetry"; which poetry) || true
- name: File-Inspect4 (py${{ matrix.python-version }})
run: find .
41 changes: 21 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# ===[ APP ]=== #

# ===[ PYTHON PACKAGE ]=== #
# Python Packaging
*.egg/
*.egg-info/
pyenv/
/build/
/dist/
/MANIFEST
/*.egg/
/*.egg-info/

# ===[ OTHER ]=== #
# Python Caches
__pycache__/
*.py[cod]
*.pot
*.mo

# Python Utils
.coverage
/htmlcov/
/.tox/

# IDE Projects
.idea
Expand All @@ -24,21 +32,14 @@
*.DS_Store
Thumbs.db

# Utils
/.tox/
.sass-cache/
.coverage

# Generated
__pycache__
*.py[cod]
*.pot
*.mo

# Runtime
/*.log
/*.pid
*.log
*.pid

# Locals
local/
*.local

# ===[ EXCLUDES ]=== #
# Forced Exclusions
!.gitkeep
!.htaccess
6 changes: 0 additions & 6 deletions .python-version

This file was deleted.

31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 0.5.0 (2021-05-31)
* Project spun-off, renamed to jj2cli. Version bumped-up to 0.5.0 to
show parity plus a few extra features. Future changes to version will
not have any significance regarding to the parent j2cli project.
* New: Support for multiple input files, squashed in a single context prior
to rendering.
* New: Support for using *data-specs* to describe input files.
- Allows mixing/matching different input formats.
- Allows attaching input format in a specific location of the context.
- Support for list-formatted inputs via aforementioned attaching.
* New: `--ignore-missing`/`-I` flag, for ignoring non-existing input files.
* Change: `--undefined`/`-U` now allows you to set the behaviour of Jinja2
for undefined variables.
* Change: `--fallback-format`/`-f` now sets the *fallback* format, rather than
forcing the use of a specific format. Forcing a specific format can be
achieved via *data-specs*.
* Change: Currently only Python 3.8 and 3.9 are supported. The goal is to
eventually support Python >=3.6 and Python 2.7.

## 0.3.12 (2019-08-18)
* Fix: use `env` format from stdin

Expand Down
5 changes: 4 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Copyright (c) 2014, Mark Vartanyan
Copyright (c) 2019-2023, Manolis Stamatogiannakis
Copyright (c) 2014-2019, Mark Vartanyan
Copyright (c) 2012-2013, Matt Robenolt

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
52 changes: 42 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
all:
PYPACKAGE=jj2cli
TOX_QUICKTEST=py3.10-pyyaml6
TOX_LINTTEST=lint

.PHONY: help all clean test test-lint test-tox test-tox-quick test-pytest test-pytest-cover

help: ##- Show this help.
@sed -e '/#\{2\}-/!d; s/\\$$//; s/:[^#\t]*/:/; s/#\{2\}- *//' $(MAKEFILE_LIST)

SHELL := /bin/bash
all:
@echo no default action

# Package
.PHONY: clean
clean:
@rm -rf build/ dist/ *.egg-info/ README.md README.rst
@pip install -e . # have to reinstall because we are using self
README.md: $(shell find j2cli/) $(wildcard misc/_doc/**)
README.md: $(shell find src/) $(wildcard misc/_doc/**)
@python misc/_doc/README.py | python j2cli/__init__.py -f json -o $@ misc/_doc/README.md.j2


.PHONY: build publish-test publish
.PHONY: build check-pyenv install-pyenv publish-test publish
build: README.md
@./setup.py build sdist bdist_wheel
publish-test: README.md
@twine upload --repository pypitest dist/*
publish: README.md
@twine upload dist/*

check-pyenv:
ifeq ($(VIRTUAL_ENV),)
$(error Not in a virtualenv)
else
@printf "Installing in %s.\n" "$(VIRTUAL_ENV)"
endif

test-lint: ##- Run configured linters.
prospector

test-tox: ##- Run all Tox tests.
tox

test-tox-quick: ##- Run test only for the TOX_QUICKTEST profile.
tox -e $(TOX_QUICKTEST)

test-tox-lint: ##- Run configured linters via Tox.
tox -e $(TOX_LINTTEST)

test-pytest:
pytest

#test-nose-cover: ## Use pytest to produce a test coverage report.
#nosetests --with-coverage --cover-package $(PYPACKAGE)
#75 $(COVERAGE_XML): .coveragerc
#76 pytest --cov-report xml:$(@) --cov=.

test: test-lint test-tox test-nose ##- Run all linters and tests.

.PHONY: test test-tox
test:
@nosetests
test-tox:
@tox
install-pyenv: check-pyenv ##- Install to the current virtualenv.
pip install -e .
Loading