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/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. 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 diff --git a/kosmorrolib/events.py b/kosmorrolib/events.py index 46f5e35..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, @@ -153,6 +152,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 +189,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 diff --git a/kosmorrolib/model.py b/kosmorrolib/model.py index 9c86593..7a04003 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 050a23a..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" @@ -20,10 +20,9 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.7" +python = ">=3.7,<3.11" skyfield = "^1.21" skyfield-data = "^3.0" -numpy = "^1.17" python-dateutil = "^2.8" [tool.poetry.dev-dependencies]