Skip to content

Commit

Permalink
Merge branch 'master' into 1014/all-granularity
Browse files Browse the repository at this point in the history
  • Loading branch information
systemcatch committed Jan 2, 2022
2 parents f6143cc + 7d7926a commit 5b336f2
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 90 deletions.
72 changes: 15 additions & 57 deletions .github/workflows/continuous_integration.yml
Expand Up @@ -12,7 +12,6 @@ jobs:
test:
name: ${{ matrix.os }} (${{ matrix.python-version }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
Expand All @@ -22,102 +21,61 @@ jobs:
# pypy3 randomly fails on Windows builds
- os: windows-latest
python-version: "pypy-3.7"

include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
steps:
# Check out latest code
- uses: actions/checkout@v2

# Configure pip cache
- name: Cache pip (Linux)
uses: actions/cache@v2
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip (macOS)
uses: actions/cache@v2
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip (Windows)
- name: Cache pip
uses: actions/cache@v2
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Set up Python
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# Install dependencies
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U tox tox-gh-actions
# Run tests
- name: Test with tox
run: tox

# Upload coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: coverage.xml

lint:
runs-on: ubuntu-latest

steps:
# Check out latest code
- uses: actions/checkout@v2

# Set up Python
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"

# Configure pip cache
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Configure pre-commit cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache pre-commit
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
# Install dependencies
restore-keys: ${{ runner.os }}-pre-commit-
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U tox
# Lint code
- name: Lint code
run: tox -e lint

# Lint docs
run: tox -e lint -- --show-diff-on-failure
- name: Lint docs
run: tox -e docs
24 changes: 14 additions & 10 deletions .pre-commit-config.yaml
Expand Up @@ -2,25 +2,27 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: fix-encoding-pragma
args: [--remove]
- id: requirements-txt-fixer
- id: check-ast
- id: check-yaml
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-builtin-literals
- id: debug-statements
- id: end-of-file-fixer
- id: fix-encoding-pragma
args: [--remove]
- id: requirements-txt-fixer
args: [requirements/requirements.txt, requirements/requirements-docs.txt, requirements/requirements-tests.txt]
- id: trailing-whitespace
- repo: https://github.com/timothycrosley/isort
rev: 5.9.3
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v2.30.1
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand All @@ -29,12 +31,14 @@ repos:
hooks:
- id: python-no-eval
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/psf/black
rev: 21.9b0
rev: 21.12b0
hooks:
- id: black
args: [--safe, --quiet, --target-version=py36]
Expand All @@ -44,7 +48,7 @@ repos:
- id: flake8
additional_dependencies: [flake8-bugbear,flake8-annotations]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.910-1'
rev: 'v0.930'
hooks:
- id: mypy
additional_dependencies: [types-python-dateutil]
3 changes: 2 additions & 1 deletion MANIFEST.in
@@ -1,3 +1,4 @@
include LICENSE CHANGELOG.rst README.rst Makefile requirements-dev.txt tox.ini
include LICENSE CHANGELOG.rst README.rst Makefile tox.ini
recursive-include requirements *.txt
recursive-include tests *.py
recursive-include docs *.py *.rst *.bat Makefile
15 changes: 11 additions & 4 deletions Makefile
@@ -1,6 +1,6 @@
.PHONY: auto test docs clean

auto: build39
auto: build310

build36: PYTHON_VER = python3.6
build37: PYTHON_VER = python3.7
Expand All @@ -12,7 +12,8 @@ build36 build37 build38 build39 build310: clean
$(PYTHON_VER) -m venv venv
. venv/bin/activate; \
pip install -U pip setuptools wheel; \
pip install -r requirements-dev.txt; \
pip install -r requirements/requirements-tests.txt; \
pip install -r requirements/requirements-docs.txt; \
pre-commit install

test:
Expand All @@ -22,14 +23,20 @@ test:

lint:
. venv/bin/activate; \
pre-commit run --all-files --show-diff-on-failure
pre-commit run --all-files

docs:
clean-docs:
rm -rf docs/_build

docs:
. venv/bin/activate; \
cd docs; \
make html

live-docs: clean-docs
. venv/bin/activate; \
sphinx-autobuild docs docs/_build/html

clean: clean-dist
rm -rf venv .pytest_cache ./**/__pycache__
rm -f .coverage coverage.xml ./**/*.pyc
Expand Down
4 changes: 2 additions & 2 deletions arrow/locales.py
Expand Up @@ -46,7 +46,7 @@
]


_locale_map: Dict[str, Type["Locale"]] = dict()
_locale_map: Dict[str, Type["Locale"]] = {}


def get_locale(name: str) -> "Locale":
Expand Down Expand Up @@ -5743,7 +5743,7 @@ class SinhalaLocale(Locale):
}
# Sinhala: the general format to describe timeframe is different from past and future,
# so we do not copy the original timeframes dictionary
timeframes_only_distance = dict()
timeframes_only_distance = {}
timeframes_only_distance["second"] = "තත්පරයක්"
timeframes_only_distance["seconds"] = "තත්පර {0}"
timeframes_only_distance["minute"] = "මිනිත්තුවක්"
Expand Down
4 changes: 4 additions & 0 deletions docs/conf.py
Expand Up @@ -58,3 +58,7 @@
html_sidebars = {
"**": ["about.html", "localtoc.html", "relations.html", "searchbox.html"]
}

# Generate PDFs with unicode characters
# https://docs.readthedocs.io/en/stable/guides/pdf-non-ascii-languages.html
latex_engine = "xelatex"
5 changes: 5 additions & 0 deletions requirements/requirements-docs.txt
@@ -0,0 +1,5 @@
-r requirements.txt
doc8
sphinx
sphinx-autobuild
sphinx-autodoc-typehints
11 changes: 5 additions & 6 deletions requirements-dev.txt → requirements/requirements-tests.txt
@@ -1,11 +1,10 @@
-r requirements.txt
dateparser==1.*
pre-commit==2.*
pytest==6.*
pytest-cov==3.*
pytest-mock==3.*
pre-commit
pytest
pytest-cov
pytest-mock
python-dateutil>=2.7.0
pytz==2021.1
simplejson==3.*
sphinx==4.*
sphinx-autodoc-typehints==1.*
typing_extensions; python_version < '3.8'
2 changes: 2 additions & 0 deletions requirements/requirements.txt
@@ -0,0 +1,2 @@
python-dateutil>=2.7.0
typing_extensions; python_version < '3.8'

0 comments on commit 5b336f2

Please sign in to comment.