Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ updates:
schedule:
interval: "daily"
time: "09:00"
reviewers:
- "@Learnosity/ai-labs-dev"
reviewers:
- "@Learnosity/ai-labs-dev"
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ on:
pull_request:

jobs:
pre_commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Pre-commit Dependencies
run: pip install pre-commit

- name: Run Pre-commit Hooks
run: pre-commit run --all-files

tests:
runs-on: ubuntu-latest
strategy:
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-json
- id: pretty-format-json
args: [ --autofix ]
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key

- repo: https://github.com/crate-ci/typos
rev: v1.26.8
hooks:
- id: typos
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contribution in the form of [PRs] are welcome.

Why We Are No Longer Accepting Public Issues
Why We Are No Longer Accepting Public Issues
After careful consideration, we’ve decided to discontinue accepting issues via GitHub Issues for our public repositories.

Here’s why:
Expand Down
8 changes: 6 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [unreleased] - 2024-11-01
### Added
- Added pre-commit hooks and Github CI action for code formatting and linting.

## [v0.3.11] - 2024-11-01
### Fixed
- Deprecation warning for `datetime.utcnow()`
Expand Down Expand Up @@ -74,9 +78,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [v0.3.1] - 2019-08-07
### Fixed
- Fixed an issue where the `DataApi` class's `results_iter` method would return no data
- Fixed an issue where the `DataApi` class's `results_iter` method would return no data
when receiving responses from Data API endpoints that set the "`data`" field of the
response to an object (like the [itembank/questions endpoint](https://reference.learnosity.com/data-api/endpoints/itembank_endpoints#getQuestions)
response to an object (like the [itembank/questions endpoint](https://reference.learnosity.com/data-api/endpoints/itembank_endpoints#getQuestions)
when `item_references` is included in the request).

## [v0.3.0] - 2019-06-17
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center"><img width="50%" height="50%" src="https://github.com/Learnosity/learnosity-sdk-python/blob/master/docs/images/image-logo-graphic.png?raw=true"></p>
<h1 align="center">Learnosity SDK - Python</h1>
<p align="center">Everything you need to start building your app in Learnosity, with the Python programming language.<br>
<p align="center">Everything you need to start building your app in Learnosity, with the Python programming language.<br>
(Prefer another language? <a href="https://help.learnosity.com/hc/en-us/sections/360000194318-Server-side-development-SDKs">Click here</a>)<br>
An official Learnosity open-source project.</p>

Expand Down Expand Up @@ -72,7 +72,7 @@ Then, if you're following the tutorial on this page, also run:
pip install learnosity_sdk[quickstart]

### **Alternative method 1: download the zip file**
Download the latest version of the SDK as a self-contained ZIP file from the [GitHub Releases](https://github.com/Learnosity/learnosity-sdk-python/releases) page. The distribution ZIP file contains all the necessary dependencies.
Download the latest version of the SDK as a self-contained ZIP file from the [GitHub Releases](https://github.com/Learnosity/learnosity-sdk-python/releases) page. The distribution ZIP file contains all the necessary dependencies.

Note: after installation, run this command in the SDK root folder:

Expand Down Expand Up @@ -163,7 +163,7 @@ host = "localhost"
port = 8000
```

Now we'll declare the configuration parameters for Items API. These specify which assessment content should be rendered, how it should be displayed, which user is taking this assessment and how their responses should be stored.
Now we'll declare the configuration parameters for Items API. These specify which assessment content should be rendered, how it should be displayed, which user is taking this assessment and how their responses should be stored.

``` python
items_request = {
Expand Down Expand Up @@ -252,10 +252,10 @@ The call to `init()` returns an instance of the ItemsApp, which we can use to pr
The Jinja template is rendered by the following line, which will bring in those variables.

``` python
response = template.render(name='Standalone Assessment Example', generated_request=generated_request)
response = template.render(name='Standalone Assessment Example', generated_request=generated_request)
```

There is some additional code in [standalone_assessment.py](docs/quickstart/assessment/standalone_assessment.py), which runs Python's built-in web server.
There is some additional code in [standalone_assessment.py](docs/quickstart/assessment/standalone_assessment.py), which runs Python's built-in web server.

This marks the end of the quick start guide. From here, try modifying the example files yourself, you are welcome to use this code as a basis for your own projects. As mentioned earlier, the Jinja template used here can be easily re-used in another framework, for example Python Flask or Django.

Expand All @@ -271,7 +271,7 @@ See a more detailed breakdown of all the SDK features, and examples of how to us
### **Additional quick start guides**
There are more quick start guides, going beyond the initial quick start topic of loading an assessment, these further tutorials show how to set up authoring and analytics:
* [Authoring Items quick start guide](https://help.learnosity.com/hc/en-us/articles/360000754958-Getting-Started-With-the-Author-API) (Author API) - create and edit new Questions and Items for your Item bank, then group your assessment Items into Activities, and
* [Analytics / student reporting quick start guide](https://help.learnosity.com/hc/en-us/articles/360000755838-Getting-Started-With-the-Reports-API) (Reports API) - view the results and scores from an assessment Activity.
* [Analytics / student reporting quick start guide](https://help.learnosity.com/hc/en-us/articles/360000755838-Getting-Started-With-the-Reports-API) (Reports API) - view the results and scores from an assessment Activity.

### **Learnosity demos repository**
On our [demo site](https://demos.learnosity.com/), browse through many examples of Learnosity API integration. You can also download the entire demo site source code, the code for any single demo, or browse the codebase directly on GitHub.
Expand Down Expand Up @@ -318,7 +318,7 @@ We use this data to enable better support and feature planning.
[(Back to top)](#table-of-contents)

## Further reading
Thanks for reading to the end! Find more information about developing an app with Learnosity on our documentation sites:
Thanks for reading to the end! Find more information about developing an app with Learnosity on our documentation sites:

* [help.learnosity.com](http://help.learnosity.com/hc/en-us) -- general help portal and tutorials,
* [reference.learnosity.com](http://reference.learnosity.com) -- developer reference site, and
Expand Down
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ print(signed_request)
```

## Further reading
Thanks for reading to the end! Find more information about developing an app with Learnosity on our documentation sites:
Thanks for reading to the end! Find more information about developing an app with Learnosity on our documentation sites:
<ul>
<li><a href="http://help.learnosity.com">help.learnosity.com</a> -- general help portal and tutorials,
<li><a href="http://reference.learnosity.com">reference.learnosity.com</a> -- developer reference site, and
<li><a href="http://authorguide.learnosity.com">authorguide.learnosity.com</a> -- authoring documentation for content creators.
</ul>

Back to [README.md](README.md)
Back to [README.md](README.md)
4 changes: 2 additions & 2 deletions docs/quickstart/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The consumerKey and consumerSecret are the public & private
# security keys required to access Learnosity APIs and
# data. Learnosity will provide keys for your own private account.
# Note: The consumer secret should be in a properly secured credential store,
# and *NEVER* checked into version control.
# Note: The consumer secret should be in a properly secured credential store,
# and *NEVER* checked into version control.
# The keys listed here grant access to Learnosity's public demos account.

consumer_key = 'yis0TYCu7U9V4o7M'
Expand Down
2 changes: 1 addition & 1 deletion learnosity_sdk/request/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def generate_signature(self) -> str:
vals = []

# Add each valid security field.
# The order is signifcant.
# The order is significant.
for key in self.security_keys:
if key in self.security:
vals.append(self.security[key])
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
]

TEST_REQUIRES = [
'pre-commit',
'pytest >=4.6.6',
'pytest-cov >=2.8.1',
'pytest-subtests',
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_dataapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

# WARNING: Normally the consumer secret should not be committed to a public
# repository like this one. Only this specific key is publically available.
# repository like this one. Only this specific key is publicly available.
consumer_secret = '74c5fd430cf1242a527f6223aebd42d30464be22'
action = 'get'

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_dataapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def setUp(self):
'domain': 'demos.learnosity.com'
}
# WARNING: Normally the consumer secret should not be committed to a public
# repository like this one. Only this specific key is publically available.
# repository like this one. Only this specific key is publicly available.
self.consumer_secret = '74c5fd430cf1242a527f6223aebd42d30464be22'
self.request = {
# These items should already exist for the demos consumer
Expand Down
Loading