summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-08-22 16:44:21 -0500
committerptmcg <ptmcg@austin.rr.com>2022-08-22 16:44:21 -0500
commit3a3700b43b74d1de7c115f7b2d1affc4915a19f1 (patch)
tree378eb9875dba02b95767693402903bf11ac896e8
parent121e575e3d4ed95dcc32e0b55cdf2fd6f0364708 (diff)
downloadpyparsing-git-3a3700b43b74d1de7c115f7b2d1affc4915a19f1.tar.gz
Update CONTRIBUTING.md notes on submitting examples - related to #440
-rw-r--r--CONTRIBUTING.md70
1 files changed, 39 insertions, 31 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2fd5409..a2da1a5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -34,6 +34,45 @@ If you have a question on using pyparsing, there are a number of resources avail
other open and closed issues. Or post your question on SO or reddit. But don't wait until you are desperate and
frustrated - just ask! :)
+## Submitting examples
+
+If you have an example you wish to submit, please follow these guidelines.
+
+- **License - Submitted example code must be available for distribution with the rest of pyparsing under the MIT
+ open source license.**
+
+- Please follow PEP8 name and coding guidelines, and use the black formatter
+ to auto-format code.
+
+- Examples should import pyparsing and the common namespace classes as:
+
+ import pyparsing as pp
+ # if necessary
+ ppc = pp.pyparsing_common
+ ppu = pp.pyparsing_unicode
+
+- Submitted examples *must* be Python 3.6.8 or later compatible. (It is acceptable if examples use Python
+ features added after 3.6)
+
+- Where possible use operators to create composite parse expressions:
+
+ expr = expr_a + expr_b | expr_c
+
+ instead of:
+
+ expr = pp.MatchFirst([pp.And([expr_a, expr_b]), expr_c])
+
+ Exception: if using a generator to create an expression:
+
+ import keyword
+ python_keywords = keyword.kwlist
+ any_keyword = pp.MatchFirst(pp.Keyword(kw)
+ for kw in python_keywords))
+
+- Learn [Common Pitfalls When Writing Parsers](https://github.com/pyparsing/pyparsing/wiki/Common-Pitfalls-When-Writing-Parsers) and
+ how to avoid them when developing new examples.
+
+- See additional notes under [Some Coding Points](#some-coding-points).
## Submitting changes
@@ -73,10 +112,6 @@ These coding styles are encouraged whether submitting code for core pyparsing or
applications - DO NOT MODIFY OR REMOVE THESE NAMES.
See more information at the [PEP8 wiki page](https://github.com/pyparsing/pyparsing/wiki/PEP-8-planning).
- If you wish to submit a new example, please follow PEP8 name and coding guidelines, and use the black formatter
- to auto-format code. Example code must be available for distribution with the rest of pyparsing under the MIT
- open source license.
-
- No backslashes for line continuations.
Continuation lines for expressions in ()'s should start with the continuing operator:
@@ -94,33 +129,6 @@ These coding styles are encouraged whether submitting code for core pyparsing or
- List, tuple, and dict literals should include a trailing comma after the last element, which reduces changeset
clutter when another element gets added to the end.
-- Examples should import pyparsing and the common namespace classes as:
-
- import pyparsing as pp
- # if necessary
- ppc = pp.pyparsing_common
- ppu = pp.pyparsing_unicode
-
- Submitted examples *must* be Python 3.6.8 or later compatible.
-
-- Where possible use operators to create composite parse expressions:
-
- expr = expr_a + expr_b | expr_c
-
- instead of:
-
- expr = pp.MatchFirst([pp.And([expr_a, expr_b]), expr_c])
-
- Exception: if using a generator to create an expression:
-
- import keyword
- python_keywords = keyword.kwlist
- any_keyword = pp.MatchFirst(pp.Keyword(kw)
- for kw in python_keywords))
-
-- Learn [Common Pitfalls When Writing Parsers](https://github.com/pyparsing/pyparsing/wiki/Common-Pitfalls-When-Writing-Parsers) and
- how to avoid them when developing new examples.
-
- New features should be accompanied by updates to unitTests.py and a bullet in the CHANGES file.
- Do not modify pyparsing_archive.py. This file is kept as a reference artifact from when pyparsing was distributed