-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation about CPython. Make example programs work out of the box. #23
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
Conversation
simonprickett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but don't change the default for use_ssl. Having it default to true covers the most common use case and minimizes extra code on microcontrollers.
README.md
Outdated
| user="user", | ||
| password="password" | ||
| password="password", | ||
| use_ssl=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need use_ssl by default... by design, as microcontrollers will mostly be connecting to the cloud which requires it so it's on by default to help minimize code size. Could be a micro-optimization but that was why it's on by default and originally only mentioned in the local network / Docker Crate example.
README.md
Outdated
| port=4201, | ||
| password="password" | ||
| password="password", | ||
| use_ssl=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can drop use_ssl as it's on by default.
cratedb.py
Outdated
|
|
||
| class CrateDB: | ||
| def __init__(self, host, port=4200, user=None, password=None, schema="doc", use_ssl=True): | ||
| def __init__(self, host, port=4200, user=None, password=None, schema="doc", use_ssl=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a good reason why it was True, I disagree with this.
docs/cpython.md
Outdated
| @@ -0,0 +1,38 @@ | |||
| # Running on CPython | |||
|
|
|||
| The module is being conceived for [MicroPython], but also works on [CPython]. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The module is being conceived for [MicroPython], but also works on [CPython]. | |
| The module is designed for [MicroPython], but also works on [CPython]. |
examples/example_usage.py
Outdated
|
|
||
| # CrateDB Docker / local network, no SSL. | ||
| # crate = cratedb.CrateDB(host="hostname", use_ssl=False) | ||
| crate = cratedb.CrateDB(host="localhost") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use use_ssl=False.
examples/example_usage.py
Outdated
| host="testdrive.cratedb.net", | ||
| user="username", | ||
| password="password", | ||
| use_ssl=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove, as True should be the default.
examples/object_examples.py
Outdated
|
|
||
| # CrateDB Docker / local network, no SSL. | ||
| # crate = cratedb.CrateDB(host="hostname", use_ssl=False) | ||
| crate = cratedb.CrateDB(host="localhost") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add use_ssl=False
examples/object_examples.py
Outdated
| host="testdrive.cratedb.net", | ||
| user="username", | ||
| password="password", | ||
| use_ssl=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omit, as True should be the default.
| Start CrateDB. | ||
| ```shell | ||
| docker run --rm -it --name=cratedb \ | ||
| --publish=4200:4200 --publish=5432:5432 \ | ||
| --env=CRATE_HEAP_SIZE=2g crate:latest -Cdiscovery.type=single-node | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also add this snippet to the main README, to educate users how actually easy it is to get started in homelab-mode only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. ✅
Lines 61 to 63 in c473674
| If you're running CrateDB on your workstation (with Docker for example, | |
| by using `docker run --rm -it --publish=4200:4200 crate`), connect like | |
| this: |
Thanks. I've just reverted corresponding changes, still staging the example files ready to be invoked on a non-SSL instance, in order to be able to wrap them into a test suite without any complications. |
By applying minor adjustments, the example programs are now in a form that supports integration testing with CrateDB.
About
By applying minor adjustments, the example programs are now in a form that supports integration testing with CrateDB.
Rationale
Based on a project layout like this, it will be easy to add integration tests that validate the package, also considering its "examples" collection as the first and always best set of general test cases. When run to completion on behalf of a test suite, it also yields piece of mind because you always know your example programs stay healthy.
What's Next
Integration tests and a CI/GHA configuration will be added by a subsequent patch.