flake8 new release 3.8.0 added new checks and gate pep8
job start failing. hacking 3.0.1 fix the pinning of flake8 to
avoid bringing in a new version with new checks.
Though it is fixed in latest hacking but 2.0 and 3.0 has cap for
flake8 as <4.0.0 which mean flake8 new version 3.9.0 can also
break the pep8 job if new check are added.
To avoid similar gate break in future, we need to bump the hacking min
version.
- http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014828.html
Change-Id: Icf9fa58f9c9ae9e1bbe436638fe915974543dddb
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Update local hacking checks for new flake8.
Change-Id: Idffc923ac339978714001be22e3c9ef285e907f5
The 2.0.0 is breaking in that it removes the use of warnerrors in
build_sphinux.
YAQL isn't using that feature, so it shoudln't break.
The cap on pbr is preventing other OpenStack projects that would like to
use pbr 2.0.0 (and sphinx 1.5.1) from doing so as it breaks
co-installability with yaql
Also hacking <0.11 had a similar issue so use a newer version of that also
Change-Id: I23e1d7aa715003250131bf5c88a438f278e4d4da
Related-Bug: 1668848
Contexts:
* context module was renamed to contexts
* convention property is now part of ContextBase class.
* Standard Context implementation automatically uses convention
from parent context
* Context interface was enhanced to add capability to check key presence,
get data with different default or not try to access parent context
* MultiContext to virtually merge several contexts without of making them related.
All merged contexts may have parents of their own which are also merged.
Source contexts are not modified. This is sort of context mix-in
Parser:
* keyword arguments (name => value) now require name to be keyword token.
So f('abc' => value) will not work. This doesnt affect dict() and similar functions
as they use different argument format.
* tokens that start with two underscores (__) are no more valid. This is done so that it
would be possible to have auto-injected Python arguments like "__context" without
affecting possible kwargs of the same function
Delegates:
* Added ability to call delegate (callable) passed as a context value.
The syntax is $var(args) (or even $(args)).
* Delegate doesn't have to be a context value but also can be result of expression:
func(args1)(args2), (f() op g())() and so on
* Delegates are disabled by default for security reasons. "allow_delegates" parameter
was added to both YaqlFactory classes to enable them
* (expr)(args) will be translated to #call(expr, args). So for this to work #call function
must be present in context. Standard context doesn't provide this function by default.
Use delegates=True parameter of create_context method (including legacy mode version)
to register #call() and lambda() functions
* additional lambda(expression) method that returns delegate to passed expression thus
making it 2nd order lambda. This delegate may be stored in context using let() method
(or alternatives) or be called as usual. lambda(expression)(args) is equal to expression(args)
Function specs:
* FunctionDefinition now has "meta" dictionary to store arbitrary extended metadata for the
function (for example version etc.)
* use @specs.meta('key', 'value') decorator to assign meta value to the function. Several
decorators may be applied to single function
* Context.__call__() / runner.call() now accept optional function_filter parameter that is a
predicate (functionDefinition, context -> boolean) to additionally filter function candidates
based on context values, function metadata and so on.
* returns_context decorator and functionality was removed because it was shawn to be useless
* "__context" and "__engine" parameters where not explicitly declared treated the
same way as "context" and "engine"
* added ability to control what type be assigned to parameters without explicit specification
based on parameter name
* added ability to get function definition with stripped hidden parameters for function wrappers
* refactoring of ParameterDefinition creation code. Code from decorator was moved to a more
generic set_parameter method of FunctionDefinition to support wider range of scenarios
(for example to overwrite auto-generated parameter specs)
* FunctionDefinition.__call__ was changed:
a) order of parameter was changed so the sender could have default value
b) args now automatically prefixed with sender when provided.
There is no need to provide it twice anymore
* a helper functions was added to utils to get yaql 0.2 style extension methods specs
for functions that already registered in context as pure functions or methods
Smart types:
* "context" argument was added to each check() method so that it would be possible to do
checks using context values. Non of standard smart-types use it, however custom types may do.
* return_context flag was removed from Lambda/Delegate/Super types for the same reasons as in FD
* GenericType helper class was added as a base class for custom non-lazy smart-types simplifying
their development
* added ability to pass received Lambda (Delegate etc) to another method (or base method version)
when the later expects it in another format (for example sender had Lambda() while the receiver
had Lambda(with_context=True))
Standard library:
* "#operator_." method for obj.method() now expects first argument (sender expression) to be object
(pre-evaluated) rather than Lambda. This doesn't brake anything but allows to override this function
in child contexts for some more specific types of sender without getting resolution error because of
several versions of the same function being differ by parameter laziness
* collection.flatten() method was added
* string.matches(regexpString) method was added to complement
regexp.matches(string) that was before
* string.join(collection) method was added to complement collection.join(string)
that was before. Also now both functions apply str() function to each element
of collection
* now int(null) = 0 and float(null) = 0.0
Also bumps requirements to latest OpenStack global-requirements and removes version
number from setup.cfg to use git tag-driven versioning of pbr
Change-Id: I0dd06bf1fb70296157ebb0e9831d2b70d93ca137
Use tox to test and build the project:
* configuration files are generated from:
http://git.openstack.org/cgit/openstack-dev/cookiecutter/
* things to be done in later commits:
- fix failing pep8 checks
- fix py26 compatibility
- fix py3.x compatibility
- add more documentation