From 7e413e2de5658fba7776f36c0545cf5c5551e20e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sat, 8 Jan 2022 10:34:51 +0100 Subject: [PATCH 1/6] chore: fix contribution instructions --- CONTRIBUTING.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f7b8f26..b542bce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,13 +25,12 @@ Before writing the code, first create a fork of the repository and clone it. You Then create a new branch and start coding. Finally, commit and push, then open a PR on this project. If your project is not complete, feel free to open it as Draft (if you forgot to activate the Draft status, just edit the first comment to say it), then mark it as ready for review when you're done. -### Choosing the right target branch +### Choosing the right branch -Whatever you are doing, always base your working branch on `master`. -When you create your PR, please consider selecting the right target branch: +When you create your PR, please select the right base and target branch depending on what you are doing: -- If you are fixing a bug or optimizing something, then target the `master` branch. -- If you are doing anything else, then target the `feature` branch. +- If you are fixing a bug or optimizing something, target the `main` branch. +- If you are adding a new feature, target the `features` branch. This allows to make easier to publish patch releases, which have a higher priority than the minor releases. From 8ea4a9f7317cfe7d833d5fb0ae7cac702ad862fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sat, 8 Jan 2022 10:36:04 +0100 Subject: [PATCH 2/6] chore: fix black Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 04f11cf..7689c87 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ black: - poetry run black kosmorrolib setup.py + poetry run black kosmorrolib .PHONY: tests tests: doctests From a99ef9d6a6b174f653abe2887d8211c809b3a732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sat, 8 Jan 2022 22:41:17 +0100 Subject: [PATCH 3/6] fix: fix Python support for NumPy (#40) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 050a23a..4e3f6ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.7" +python = ">=3.7,<3.11" skyfield = "^1.21" skyfield-data = "^3.0" numpy = "^1.17" From 761ec4ef21b95473829672d69320330f52d1890b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sat, 8 Jan 2022 22:48:58 +0100 Subject: [PATCH 4/6] fix: make the opposition detection more reliable (#39) --- kosmorrolib/events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kosmorrolib/events.py b/kosmorrolib/events.py index 46f5e35..e1c84fb 100644 --- a/kosmorrolib/events.py +++ b/kosmorrolib/events.py @@ -153,6 +153,9 @@ def _search_oppositions(start_time: Time, end_time: Time, timezone: int) -> [Eve >>> _search_oppositions(get_timescale().utc(2021, 3, 20), get_timescale().utc(2021, 3, 21), 0) [] + + >>> _search_oppositions(get_timescale().utc(2022, 12, 24), get_timescale().utc(2022, 12, 25), 0) + [] """ earth = get_skf_objects()["earth"] sun = get_skf_objects()["sun"] @@ -187,7 +190,7 @@ def _search_oppositions(start_time: Time, end_time: Time, timezone: int) -> [Eve times, _ = find_discrete(start_time, end_time, is_oppositing) for time in times: - if get_angle(time) < 0: + if int(get_angle(time)) != 180: # If the angle is negative, then it is actually a false positive. # Just ignoring it. continue From f0b42679853d2d8310005cdde2afd1c7674ccaf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sun, 9 Jan 2022 11:24:31 +0100 Subject: [PATCH 5/6] fix: remove NumPy direct dependency (#41) Note that Numpy is still a dependency of Skyfield and its dependencies. --- kosmorrolib/events.py | 3 +-- kosmorrolib/model.py | 5 ++--- pyproject.toml | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/kosmorrolib/events.py b/kosmorrolib/events.py index e1c84fb..7b4c9f8 100644 --- a/kosmorrolib/events.py +++ b/kosmorrolib/events.py @@ -23,10 +23,9 @@ from skyfield.timelib import Time from skyfield.searchlib import find_discrete, find_maxima, find_minima from skyfield.units import Angle from skyfield import almanac, eclipselib -from numpy import pi +from math import pi from kosmorrolib.model import ( - Object, Event, Object, Star, diff --git a/kosmorrolib/model.py b/kosmorrolib/model.py index 6f83fe1..aadf068 100644 --- a/kosmorrolib/model.py +++ b/kosmorrolib/model.py @@ -19,8 +19,7 @@ from abc import ABC, abstractmethod from typing import Union from datetime import datetime, timezone - -import numpy +from math import asin from skyfield.api import Topos, Time, Angle from skyfield.vectorlib import VectorSum as SkfPlanet @@ -180,7 +179,7 @@ class Object(Serializable): .radec() ) - return Angle(radians=numpy.arcsin(self.radius / distance.km) * 2.0) + return Angle(radians=asin(self.radius / distance.km) * 2.0) def serialize(self) -> dict: """Serialize the given object diff --git a/pyproject.toml b/pyproject.toml index 4e3f6ae..0b85428 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ classifiers = [ python = ">=3.7,<3.11" skyfield = "^1.21" skyfield-data = "^3.0" -numpy = "^1.17" python-dateutil = "^2.8" [tool.poetry.dev-dependencies] From 6f2a9a5d0dae591254976739fffeb325ca234992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sun, 9 Jan 2022 13:23:36 +0100 Subject: [PATCH 6/6] build: bump version 1.0.2 --- CHANGELOG.md | 11 +++++++++++ pyproject.toml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f27c9..11aec56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# [Version 1.0.2](https://github.com/Kosmorro/lib/compare/v1.0.1...v1.0.2) (2022-01-09) + + +### Bug Fixes + +* fix Python support for NumPy ([#40](https://github.com/Kosmorro/lib/issues/40)) ([a99ef9d](https://github.com/Kosmorro/lib/commit/a99ef9d6a6b174f653abe2887d8211c809b3a732)) +* make the opposition detection more reliable ([#39](https://github.com/Kosmorro/lib/issues/39)) ([761ec4e](https://github.com/Kosmorro/lib/commit/761ec4ef21b95473829672d69320330f52d1890b)) +* remove NumPy direct dependency ([#41](https://github.com/Kosmorro/lib/issues/41)) ([f0b4267](https://github.com/Kosmorro/lib/commit/f0b42679853d2d8310005cdde2afd1c7674ccaf9)) + + Note that Numpy is still a dependency of Skyfield and its dependencies, so NumPy is actually still needed to run Kosmorrolib. But now, it is not used anymore here. + # [Version 1.0.1](https://github.com/Kosmorro/lib/compare/v1.0.0...v1.0.1) (2021-11-01) diff --git a/pyproject.toml b/pyproject.toml index 0b85428..1080842 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "kosmorrolib" -version = "1.0.1" +version = "1.0.2" authors = ["Jérôme Deuchnord "] homepage = "https://kosmorro.space/lib" repository = "https://github.com/Kosmorro/lib"