Skip to content

Commit

Permalink
Merge pull request #156 from gocardless/joesouthan-gh-actions
Browse files Browse the repository at this point in the history
Use github actions + update dependencies
  • Loading branch information
JoeSouthan authored Aug 3, 2023
2 parents d436c45 + bafbb26 commit 4f6681a
Show file tree
Hide file tree
Showing 10 changed files with 831 additions and 692 deletions.
131 changes: 0 additions & 131 deletions .circleci/config.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests

on:
push:
branches:
- master
pull_request:

jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up pipx and poetry
run: |-
pip3 install --upgrade pip pipx
python3 -m pip install --user $(whoami)
python3 -m pipx ensurepath
pipx install poetry==1.5.1
- name: Install dependencies
run: poetry install

- name: Run pytest
run: poetry run python -m pytest

- name: Lint
run: poetry run flake8 business test --statistics

- name: MyPy typechecking
run: poetry run mypy business
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ dmypy.json

# Pyre type checker
.pyre/

# IDEs
.idea
.vscode
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.0 - July 26, 2023
- dropped support for EOL versions of Python 3.6 and 3.7
- updated project's dependencies

## 2.0.3 - August 2, 2021
- stricter type checking

Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![circleci-badge](https://circleci.com/gh/gocardless/business-python.svg?style=shield)](https://app.circleci.com/pipelines/github/gocardless/business-python) [![pypi-badge](https://badge.fury.io/py/business-python.svg)](https://badge.fury.io/py/business-python)

Date calculations based on business calendars. (Python 3.6+)
Date calculations based on business calendars. (Python 3.8+)

Python implementation of https://github.com/gocardless/business

Expand All @@ -14,6 +14,10 @@ To get business, simply:
$ pip install business-python
```

## Version 2.1.0 breaking changes

In version 2.1.0 we have dropped support for End-of-Life Python version 3.6 and 3.7. Last release supporting these versions is [v2.0.3](https://github.com/gocardless/business-python/tree/v2.0.3).

## Version 2.0.0 breaking changes

In version 2.0.0 we have removed the bundled calendars. If you still need these they are available on [v1.0.1](https://github.com/gocardless/business-python/tree/74fe7e4068e0f16b68e7478f8b5ca1cc52f9a7d0/business/data).
Expand Down Expand Up @@ -70,7 +74,7 @@ The `load_cache` method allows a thread safe way to avoid reloading the same cal

#### Using business-python

Define your calendars in a folder eg: `lib/calendars` and set this directory on `Calendar.load_paths=`
Define your calendars in a folder eg: `lib/calendars` and set this directory on `Calendar.load_paths=`

```python
Calendar.load_paths = ['lib/calendars']
Expand Down Expand Up @@ -164,6 +168,7 @@ input_date = Calendar.parse_date("Thursday, 12 June 2014")
calendar.get_business_day_of_month(input_date)
# => 9
```

## License & Contributing

- This is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Expand Down
6 changes: 2 additions & 4 deletions business/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

def get_version() -> str:
"""Get package version."""
try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version # type: ignore
from importlib.metadata import version

return version("business")


Expand Down
2 changes: 1 addition & 1 deletion business/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

day_interval = datetime.timedelta(days=1)
INPUT_TYPES = Union[str, datetime.date]
T = TypeVar('T')
T = TypeVar("T")


class Mutex(Generic[T]):
Expand Down
Loading

0 comments on commit 4f6681a

Please sign in to comment.