Skip to content

Commit

Permalink
Release v0.17.6 (#119)
Browse files Browse the repository at this point in the history
* ci: simplify (#117)

* ci: simplify matrix strategy

* ci: create new job running exclusively on `main` updates + make existing full CI test job run only on non-`main` branch PRs

* chore: bump version refs to `0.17.6`

* test: minor improvements to the `ContinuedFraction` unit test for rational operations

* refactor: minor code quality improvements in the `ContinuedFraction` class

* refactor: minor code quality improvements in the `sequences.coprime_pairs_generator` func

* chore(deps): update dev. and docs dependencies

* ci: reset changes in `4d60ae8f2`

* chore: update release date in citation file
  • Loading branch information
sr-murthy authored Aug 16, 2024
1 parent 9d1b07f commit 27b6a08
Show file tree
Hide file tree
Showing 9 changed files with 1,009 additions and 764 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ keywords:
- real numbers

license: MPL-2.0
version: 0.17.5
date-released: 2024-08-03
version: 0.17.6
date-released: 2024-08-16

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ includes Ruff linting, unit tests, Python doctests, and in that order.
## Versioning and Releases

The [PyPI package](https://pypi.org/project/continuedfractions/) is
currently at version `0.17.5` - the goal is to use [semantic
currently at version `0.17.6` - the goal is to use [semantic
versioning](https://semver.org/) consistently for all future releases,
but some earlier releases do not comply with strict semantic versioning.

Expand Down
859 changes: 491 additions & 368 deletions docs/requirements.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/sources/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The CI pipelines are defined in the `CI YML <https://github.com/sr-murthy/contin
Versioning and Releases :fas:`upload`
=====================================

The `PyPI package <https://pypi.org/project/continuedfractions/>`_ is currently at version ``0.17.5`` - the goal is to use `semantic versioning <https://semver.org/>`_ consistently for all future releases, but some earlier releases do not comply with strict semantic versioning.
The `PyPI package <https://pypi.org/project/continuedfractions/>`_ is currently at version ``0.17.6`` - the goal is to use `semantic versioning <https://semver.org/>`_ consistently for all future releases, but some earlier releases do not comply with strict semantic versioning.

There is currently no dedicated pipeline for releases - both `GitHub releases <https://github.com/sr-murthy/continuedfractions/releases>`_ and `PyPI packages <https://pypi.org/project/continuedfractions>`_ are published manually, but both have the same version tag.

Expand Down
880 changes: 501 additions & 379 deletions pdm.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/continuedfractions/continuedfraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def extend(self, *new_elements: int) -> None:
)

elements = self._elements + new_elements
fraction = convergent(len(elements) - 1, *elements)
fraction = fraction_from_elements(*elements)
self._numerator, self._denominator = fraction.as_integer_ratio()
self._elements = elements

Expand Down Expand Up @@ -414,7 +414,7 @@ def truncate(self, *tail_elements: int) -> None:
if len(elements) > 1 and elements[-1] == 1:
elements = elements[:-2] + (elements[-2] + 1,)

fraction = convergent(len(elements) - 1, *elements)
fraction = fraction_from_elements(*elements)
self._numerator, self._denominator = fraction.as_integer_ratio()
self._elements = elements

Expand Down
7 changes: 4 additions & 3 deletions src/continuedfractions/sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,17 @@ def coprime_integers_generator(n: int, /, *, start: int = 1, stop: int = None) -
if n in (1, 2):
yield 1
else:
chunklen = 1000
stop = stop or n
q, r = divmod((stop - start + 1), 10 ** 3)
q, r = divmod((stop - start + 1), chunklen)

if q == 0:
yield from filter(
lambda m: math.gcd(m, n) == 1,
range(stop, start - 1, -1)
)
else:
_start = ((10 ** 3) * q) + (1 if r > 0 else 0)
_start = ((chunklen) * q) + (1 if r > 0 else 0)

while _start >= start:
yield from filter(
Expand All @@ -174,7 +175,7 @@ def coprime_integers_generator(n: int, /, *, start: int = 1, stop: int = None) -
)
stop = _start - 1
q -= 1
_start = ((10 ** 3) * q) + 1
_start = ((chunklen) * q) + 1


@functools.cache
Expand Down
2 changes: 1 addition & 1 deletion src/continuedfractions/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.17.5"
__version__ = "0.17.6"
13 changes: 6 additions & 7 deletions tests/units/test_continuedfraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
import pytest

# -- Internal libraries --
from continuedfractions.continuedfraction import (
ContinuedFraction,
)
from continuedfractions.lib import convergent
from continuedfractions.continuedfraction import ContinuedFraction


class TestContinuedFraction:
Expand Down Expand Up @@ -743,15 +742,15 @@ def test_ContinuedFraction__rational_operations(self):
f3 = ContinuedFraction(3, 2)
f4 = ContinuedFraction(5, 3)

assert -f0 == -(f0) == f0.__neg__()
assert -f0 == -(f0) == f0.__neg__() == ContinuedFraction(*convergent(0, -2).as_integer_ratio())

assert -f1 == f2 == f1.__neg__()
assert -f1 == f2 == f1.__neg__() == ContinuedFraction(*convergent(4, -4, 1, 3, 12, 4).as_integer_ratio())

assert -f2 == f1 == f2.__neg__()

assert -f3 == -(f3) == f3.__neg__()
assert -f3 == -(f3) == f3.__neg__() == ContinuedFraction(*convergent(1, -2, 2).as_integer_ratio())

assert -f4 == -(f4) == f4.__neg__()
assert -f4 == -(f4) == f4.__neg__() == ContinuedFraction(*convergent(1, -2, 3).as_integer_ratio())

assert f1 + f2 == ContinuedFraction(0, 1)

Expand Down

0 comments on commit 27b6a08

Please sign in to comment.