Skip to content

Commit a35fea6

Browse files
authored
Merge pull request #448 from ucfopen/develop
Release v2.1.0
2 parents ab1ec27 + 94d735a commit a35fea6

66 files changed

Lines changed: 737 additions & 186 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CONTRIBUTING.md

Lines changed: 58 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,31 @@ Below you'll find guidelines for contributing that will keep our codebase clean
66

77
## Table of Contents
88

9-
* [How can I contribute?](#how-can-i-contribute)
10-
* [Bug reports](#bug-reports)
11-
* [Resolving issues](#resolving-issues)
12-
* [Making your first contribution](#making-your-first-contribution)
13-
* [Setting up the environment](#setting-up-the-environment)
14-
* [Writing tests](#writing-tests)
15-
* [API Coverage Tests](#api-coverage-tests)
16-
* [Engine tests](#engine-tests)
17-
* [Running tests / coverage reports](#running-tests--coverage-reports)
18-
* [Making a Pull Request](#making-a-pull-request)
19-
* [Code style guidelines](#code-style-guidelines)
20-
* [Foolish consistency](#foolish-consistency)
21-
* [Method docstrings](#method-docstrings)
22-
* [Descriptions](#descriptions)
23-
* [Links to related API endpoints](#links-to-related-api-endpoints)
24-
* [Parameters](#parameters)
25-
* [Returns](#returns)
26-
* [Docstring examples](#docstring-examples)
9+
* [Contributing to CanvasAPI](#contributing-to-canvasapi)
10+
* [Table of Contents](#table-of-contents)
11+
* [How can I contribute?](#how-can-i-contribute)
12+
* [Bug reports](#bug-reports)
13+
* [Resolving issues](#resolving-issues)
14+
* [Making your first contribution](#making-your-first-contribution)
15+
* [Setting up the environment](#setting-up-the-environment)
16+
* [Writing tests](#writing-tests)
17+
* [API coverage tests](#api-coverage-tests)
18+
* [Engine tests](#engine-tests)
19+
* [Running tests / coverage reports](#running-tests--coverage-reports)
20+
* [Making a pull request](#making-a-pull-request)
21+
* [Code style guidelines](#code-style-guidelines)
22+
* [Running code style checks](#running-code-style-checks)
23+
* [Foolish consistency](#foolish-consistency)
24+
* [Method docstrings](#method-docstrings)
25+
* [Descriptions](#descriptions)
26+
* [Links to related API endpoints](#links-to-related-api-endpoints)
27+
* [Parameters](#parameters)
28+
* [Returns](#returns)
29+
* [Docstring Examples](#docstring-examples)
2730

2831
## How can I contribute?
2932

30-
### Bug Reports
33+
### Bug reports
3134

3235
Bug reports are awesome. Writing quality bug reports helps us identify issues and solve them even faster. You can submit bug reports directly to our [issue tracker](https://github.com/ucfopen/canvasapi/issues).
3336

@@ -42,28 +45,29 @@ Here are a few things worth mentioning when making a report:
4245

4346
We welcome pull requests for bug fixes and new features! Feel free to browse our open, unassigned issues and assign yourself to them. You can also filter by labels:
4447

45-
* [simple](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Asimple) -- easier issues to start working on; great for getting familiar with the codebase.
46-
* [api coverage](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Aapi-coverage) -- covering new endpoints or updating existing ones.
47-
* [enhancement](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Aenhancement) -- updates to the engine to improve performance or add new functionality.
48-
* [major](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Amajor) -- difficult or major changes or additions that require familiarity with the library.
49-
* [bug](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Abug) -- happy little code accidents.
50-
* [fixed-in-develop](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Afixed-in-develop) -- issues that have been resolved but the changes are not in the latest release yet.
51-
* [canvas-bug](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Acanvas-bug) -- confirmed to be an issue with the Canvas LMS rather than the CanvasAPI library.
52-
* [help wanted](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3A"help%20wanted") -- we need *your* help to figure these out!
53-
* [documentation](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Adocumentation) -- issues relating to Documentation. Specifically, any of the `.md` files or our [class reference docs](http://canvasapi.readthedocs.io/en/latest/).
48+
* [api coverage](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Aapi-coverage): covering new endpoints or updating existing ones.
49+
* [backstage](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Abackstage): issues affecting the repository or project internals rather than user-facing features.
50+
* [bug](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Abug): happy little code accidents.
51+
* [canvas](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Acanvas-bug): confirmed to be an issue with the Canvas LMS rather than the CanvasAPI library.
52+
* [documentation](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Adocumentation): issues relating to Documentation. Specifically, any of the `.md` files or our [class reference docs](http://canvasapi.readthedocs.io/en/latest/).
53+
* [enhancement](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Aenhancement): updates to the engine to improve performance or add new functionality.
54+
* [help wanted](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3A"help%20wanted"): we need *your* help to figure these out!
55+
* [major](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Amajor): difficult or major changes or additions that require familiarity with the library.
56+
* [question](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Aquestion): issues that aren't reporting functionality or requesting improvement but requesting clarification on existing behavior
57+
* [simple](https://github.com/ucfopen/canvasapi/issues?q=sort%3Aid_desc-desc+is%3Aopen+label%3Asimple): easier issues to start working on; great for getting familiar with the codebase.
5458

5559
Once you've found an issue you're interested in tackling, take a look at our [first contribution tutorial](#making-your-first-contribution) for information on our pull request policy.
5660

5761
### Making your first contribution
5862

5963
#### Setting up the environment
6064

61-
Now that you've selected an issue to work on, you'll need to set up an environment for writing code. We'll assume you already have pip, virtualenv, and git installed and are using a terminal. If not, please set those up before continuing.
65+
Now that you've selected an issue to work on, you'll need to set up an environment for writing code. We'll assume you already have Python 3 (pip / venv) and git installed and are using a terminal. If not, please set those up before continuing.
6266

63-
1. Clone our repository by executing `git clone git@github.com:ucfopen/canvasapi.git`
64-
2. Checkout (`git checkout develop`) and then pull the latest commit from the develop branch: `git pull origin develop`
67+
1. Fork CanvasAPI on GitHub ([see the docs here](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo))
68+
2. Checkout (`git checkout develop`) and then pull the latest commit from the develop branch: `git pull upstream develop`
6569
3. Create a new branch with the format **issue/[issue_number]-[issue-title]**: `git checkout -b issue/1-test-issue-for-documentation`
66-
4. Set up a new virtual environment ( `virtualenv env` ) and activate it (`source env/bin/activate`)
70+
4. Set up a new virtual environment ( `python3 -m venv ~/.virtualenvs/canvasapi` ) and activate it
6771
5. Install the required dependencies with `pip install -r dev_requirements.txt`
6872

6973
From here, you can go about working on your issue you normally would. Please make sure to adhere to our [style guidelines for both code and docstrings](#code-style-guidelines). Once you're satisfied with the result, it's time to write a unit test for it.
@@ -74,7 +78,7 @@ Tests are a critical part of building applications, and we [pity the fool who do
7478

7579
You'll notice our tests live in the creatively named `tests` directory. Within that directory, you'll see several files in the form `test_[class].py` and another directory named `fixtures`. Depending on the scope of the issue you're solving, you'll be writing two different kinds of tests.
7680

77-
##### API Coverage Tests
81+
##### API coverage tests
7882

7983
We use the [requests-mock](https://pypi.python.org/pypi/requests-mock) library to simulate API responses. Those mock responses live inside the `fixtures` directory in JSON files. Each file's name describes the endpoints that are contained within. For example, course endpoints live in `course.json`. These fixtures are loaded on demand in a given test. Let's look at `test_get_user` in `test_course.py` as an example:
8084

@@ -196,17 +200,30 @@ TOTAL 1586 0 100%
196200

197201
Certain statements can be omitted from the coverage report by adding `# pragma: no cover` but this should be used conservatively. If your tests pass and your coverage is at 100%, you're ready to [submit a pull request](https://github.com/ucfopen/canvasapi/pulls)!
198202

199-
#### Making a Pull Request
203+
#### Making a pull request
200204

201205
Be sure to include the issue number in the title with a pound sign in front of it (#123) so we know which issue the code is addressing. Point the branch at `develop` and then submit it for review.
202206

203-
## Code Style Guidelines
207+
## Code style guidelines
204208

205209
We try to adhere to Python's [PEP 8](https://www.python.org/dev/peps/pep-0008/) specification as much as possible. In short, that means:
206210

207211
* We use four spaces for indentation.
208212
* Lines should be around 80 characters long, but up to 99 is allowed. Once you get into the 85+ territory, consider breaking your code into separate lines.
209213

214+
### Running code style checks
215+
216+
The following tools can help you check your code for style correctness. We run these tools in our CI pipeline, so running them locally is a great way to speed up acceptance of your pull requests.
217+
218+
You can use [pre-commit](https://pre-commit.com/) to force each check to run before you create a commit locally:
219+
220+
```sh
221+
pip install pre-commit
222+
pre-commit install
223+
```
224+
225+
Alternatively, each step can be run manually one-by-one, or all at once executing `./scripts/run_tests.sh`.
226+
210227
We use `flake8` for linting:
211228

212229
```sh
@@ -225,6 +242,12 @@ We require methods to be in alphabetical order for ease of reading. Run this scr
225242
python scripts/alphabetic.py
226243
```
227244

245+
All endpoint methods should accept arbitrary keyword arguments to enable parameter pass-through to Canvas:
246+
247+
```sh
248+
python scripts/find_missing_kwargs.py
249+
```
250+
228251
### Foolish consistency
229252

230253
> A foolish consistency is the hobgoblin of little minds. -- Ralph Waldo Emerson

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/docs/_build/
1616
/env/
1717
/env3/
18+
venv/
1819
/htmlcov/
1920
\#*#
2021
.vscode/settings.json

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ install:
1616
script:
1717
- coverage run -m unittest discover
1818
- black --check canvasapi tests
19+
- isort --check canvasapi tests
1920
- flake8 canvasapi tests
2021
- mdl . .github
2122
- python scripts/alphabetic.py

AUTHORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ Patches and Suggestions
1616
- [@amorqiu](https://github.com/amorqiu)
1717
- Andrew Gardener [@andrew-gardener](https://github.com/andrew-gardener)
1818
- Anthony Rodriguez [@AnthonyRodriguez726](https://github.com/AnthonyRodriguez726)
19+
- Ashutosh Saxena [@Xx-Ashutosh-xX](https://github.com/Xx-Ashutosh-xX)
1920
- Ben Liblit [@liblit](https://github.com/liblit)
2021
- Bill Wrbican [@wjw27](https://github.com/wjw27)
22+
- [@blepabyte](https://github.com/blepabyte)
2123
- Bradford Lynch [@bradfordlynch](https://github.com/bradfordlynch)
2224
- Brian Bennett [@bennettscience](https://github.com/bennettscience)
2325
- Bruce Spang [@brucespang](https://github.com/brucespang)

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
## [Unreleased]
44

5+
## [2.1.0] - 2020-12-04
6+
7+
### New Endpoint Coverage
8+
9+
- Course TODO items (Thanks, [@onomou](https://github.com/onomou))
10+
- Create observer pairing code (Thanks, [@bennettscience](https://github.com/bennettscience))
11+
12+
### General
13+
14+
- Added missing documentation for the get_current_user method and clarifications to the `CurrentUser` class. (Thanks, [@Xx-Ashutosh-xX](https://github.com/Xx-Ashutosh-xX))
15+
- `Canvas.get_announcement` now has a required parameter `context_codes`, which accepts a list of course IDs or `Course` objects.
16+
- Updated contributing guide
17+
- Added missing documentation for the "Smart DateTimes" feature
18+
- Added basic troubleshooting guide to documentation
19+
20+
### Bugfixes
21+
22+
- Fixed an issue where an `Announcement` object sometimes didn't have an associated course ID. (Thanks, [@bennettscience](https://github.com/bennettscience))
23+
- Fixed an issue where an encoding problem could lead to file downloads hanging indefinitely. (Thanks, [@blepabyte](https://github.com/blepabyte))
24+
25+
### Deprecation Warnings
26+
27+
- The `enrollment_type` argument on `Course.enroll_user` is now deprecated. Pass this information to `enrollment[type]` as a keyword argument instead. e.g. `enroll_user(enrollment={'type': 'StudentEnrollment'})`
28+
529
## [2.0.0] - 2020-08-14
630

731
### General
@@ -487,7 +511,8 @@ Huge thanks to [@liblit](https://github.com/liblit) for lots of issues, suggesti
487511
- Fixed some incorrectly defined parameters
488512
- Fixed an issue where tests would fail due to an improperly configured requires block
489513

490-
[Unreleased]: https://github.com/ucfopen/canvasapi/compare/v2.0.0...develop
514+
[Unreleased]: https://github.com/ucfopen/canvasapi/compare/v2.1.0...develop
515+
[2.1.0]: https://github.com/ucfopen/canvasapi/compare/v2.0.0...v2.1.0
491516
[2.0.0]: https://github.com/ucfopen/canvasapi/compare/v1.0.0...v2.0.0
492517
[1.0.0]: https://github.com/ucfopen/canvasapi/compare/v0.16.1...v1.0.0
493518
[0.16.1]: https://github.com/ucfopen/canvasapi/compare/v0.16.0...v0.16.1

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ CanvasAPI is a Python library for accessing Instructure’s [Canvas LMS API](htt
1313

1414
## Table of Contents
1515

16-
* [Installation](#installation)
17-
* [Documentation](#documentation)
18-
* [Quickstart](#quickstart)
19-
* [Working with Canvas Objects](#working-with-canvas-objects)
20-
* [Course Objects](#course-objects)
21-
* [User Objects](#user-objects)
22-
* [Paginated Lists](#paginated-lists)
23-
* [Keyword Arguments](#keyword-arguments)
24-
* [Contact Us](#contact-us)
16+
* [CanvasAPI](#canvasapi)
17+
* [Table of Contents](#table-of-contents)
18+
* [Installation](#installation)
19+
* [Documentation](#documentation)
20+
* [Contributing](#contributing)
21+
* [Quickstart](#quickstart)
22+
* [Working with Canvas Objects](#working-with-canvas-objects)
23+
* [Course objects](#course-objects)
24+
* [User objects](#user-objects)
25+
* [Paginated Lists](#paginated-lists)
26+
* [Keyword arguments](#keyword-arguments)
27+
* [Contact Us](#contact-us)
2528

2629
## Installation
2730

@@ -33,6 +36,10 @@ You can install CanvasAPI with pip:
3336

3437
Full documentation is available at [Read the Docs](http://canvasapi.readthedocs.io/).
3538

39+
## Contributing
40+
41+
Want to help us improve CanvasAPI? Check out our [Contributing Guide](.github/CONTRIBUTING.md) to learn about running CanvasAPI as a developer, picking issues to work on, submitting bug reports, contributing patches, and more.
42+
3643
## Quickstart
3744

3845
Getting started with CanvasAPI is easy.
@@ -58,7 +65,7 @@ You can now use `canvas` to begin making API calls.
5865

5966
### Working with Canvas Objects
6067

61-
CanvasAPI converts the JSON responses from the Canvas API into Python objects. These objects provide further access to the Canvas API. You can find a full breakdown of the methods these classes provide in our [class documentation](http://canvasapi.readthedocs.io/en/latest/class-reference.html). Below, you’ll find a few examples of common CanvasAPI use cases.
68+
CanvasAPI converts the JSON responses from the Canvas API into Python objects. These objects provide further access to the Canvas API. You can find a full breakdown of the methods these classes provide in our [class documentation](http://canvasapi.readthedocs.io/en/stable/class-reference.html). Below, you’ll find a few examples of common CanvasAPI use cases.
6269

6370
#### Course objects
6471

@@ -146,7 +153,7 @@ Most of Canvas’s API endpoints accept a variety of arguments. CanvasAPI allows
146153
>>> courses = user.get_courses(per_page=50)
147154
```
148155

149-
For a more detailed description of how CanvasAPI handles more complex keyword arguments, check out the [Keyword Argument Documentation](http://canvasapi.readthedocs.io/en/latest/keyword-args.html).
156+
For a more detailed description of how CanvasAPI handles more complex keyword arguments, check out the [Keyword Argument Documentation](http://canvasapi.readthedocs.io/en/stable/keyword-args.html).
150157

151158
## Contact Us
152159

canvasapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
__all__ = ["Canvas"]
66

7-
__version__ = "2.0.0"
7+
__version__ = "2.1.0"

canvasapi/account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from canvasapi.canvas_object import CanvasObject
22
from canvasapi.exceptions import CanvasException, RequiredFieldMissing
33
from canvasapi.feature import Feature, FeatureFlag
4-
from canvasapi.grading_standard import GradingStandard
54
from canvasapi.grading_period import GradingPeriod
5+
from canvasapi.grading_standard import GradingStandard
66
from canvasapi.outcome_import import OutcomeImport
77
from canvasapi.paginated_list import PaginatedList
88
from canvasapi.rubric import Rubric

canvasapi/assignment.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from canvasapi.progress import Progress
66
from canvasapi.submission import Submission
77
from canvasapi.upload import Uploader
8-
from canvasapi.user import User
9-
from canvasapi.user import UserDisplay
8+
from canvasapi.user import User, UserDisplay
109
from canvasapi.util import combine_kwargs, obj_or_id
1110

1211

0 commit comments

Comments
 (0)