Skip to content
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

Add Sphinx build config and more user docs, docstrings, type annotations, etc. #70

Merged
merged 14 commits into from
Apr 12, 2022
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
pyrate_limiter.egg-info/
__pycache__/
dist/
docs/_build/
docs/modules/
examples/
htmlcov/
env/
test-reports/
Expand Down
15 changes: 15 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Read the Docs configuration file
version: 2

sphinx:
builder: html
configuration: docs/conf.py

python:
version: 3.8
system_packages: True
install:
- method: pip
path: .
extra_requirements:
- docs
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.7.0] - TBD
## [2.8.1] - 2022-04-11
### Added
* Add Sphinx config
* Add documentation site: https://pyrate-limiter.readthedocs.io
* Add some missing type hints
* Add package metadata to indicate PEP-561 compliance

## [2.8.0] - 2022-04-10
### Added
* Add `flush()` method to all bucket classes

## [2.7.0] - 2022-04-06
### Added
* Add `FileLockSQliteBucket` for a SQLite backend with file-based locking
* Add optional backend dependencies to package metadata
Expand Down
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing Guide
Here are some basic instructions for local development setup and contributing to the project.

## Setup & Commands
To setup local development, *Poetry* and *Python 3.6* is required. Python can be installed using *Pyenv* or normal installation from binary source. To install *poetry*, follow the official guideline (https://python-poetry.org/docs/#installation).

Then, in the repository directory, run the following to install all optional backend dependencies and dev dependencies:
```shell
$ poetry install -E all
```

Some shortcuts are included for some common development tasks, using [nox](https://nox.thea.codes):
- Run tests with: `nox -e test`
- To run tests with coverage: `nox -e cover`
- Format & check for lint error: `nox -e lint`
- To run linting for every commit, run: `pre-commit install`

## Documentation
Documentation is generated using [Sphinx](https://www.sphinx-doc.org) and published on readthedocs.io.
To build this documentation locally:
```
poetry install -E docs
nox -e docs
```

## Guideline & Notes
We have GitHub Action CICD to do the checking, testing and publishing work. So, there are few small notes when making Pull Request:
- All existing tests must pass (Of course!)
- Reduction in *Coverage* shall result in failure. (below 98% is not accepted)
- When you are making bug fixes, or adding more features, remember to bump the version number in **pyproject.toml**. The number should follow *semantic-versioning* rules

## TODO
Planned features:
* A rate limit may reset on a fixed schedule, eg: every first-day of a month
* Sometimes, we may need to apply specific rate-limiting strategies based on schedules/region or some other metrics. It
requires the capability to switch the strategies instantly without re-deploying the whole service.
* Reference: https://www.keycdn.com/support/rate-limiting#types-of-rate-limits
Loading