Browse Source

Merge branch 'main' into features

pull/44/head
Jérôme Deuchnord 2 years ago
parent
commit
7171947e1e
12 changed files with 120 additions and 254 deletions
  1. +31
    -8
      .github/ISSUE_TEMPLATE/bug_report.yml
  2. +11
    -47
      .github/workflows/release.yml
  3. +11
    -26
      .github/workflows/tests.yml
  4. +1
    -0
      .gitignore
  5. +2
    -2
      .gitpod.yml
  6. +4
    -27
      Makefile
  7. +0
    -19
      Pipfile
  8. +7
    -42
      README.md
  9. +16
    -0
      SECURITY.md
  10. +0
    -26
      kosmorrolib/__version__.py
  11. +37
    -0
      pyproject.toml
  12. +0
    -57
      setup.py

+ 31
- 8
.github/ISSUE_TEMPLATE/bug_report.yml View File

@@ -38,10 +38,8 @@ body:
What version of Kosmorrolib are you using?

options:
- "0.11.2"
- "0.11.1"
- "0.11.0"
- "0.10.0"
- "1.0"
- "0.11"
- main branch
- features branch

@@ -86,8 +84,33 @@ body:
attributes:
label: Bug description
description: |
Describe the bug you have encountered:
Describe in some words the bug you have encountered.

- what did you try to do?
- what did you expect the program to do?
- what happened instead?
- type: textarea
id: reproducer
validations:
required: true
attributes:
label: Reproducer
description: |
Write here a small piece of code that reveals the bug.
It should be as concise as possible: no user interaction, no formating, no call to the `kosmorro` command. Just Python.
Don't forget to specify a date and position of calculation if they are necessary.

- type: textarea
id: expected
validations:
required: true
attributes:
label: Expected result
description: |
What did you expect your piece of code to do?
- type: textarea
id: actual
validations:
required: true
attributes:
label: Actual result
description: |
What did your piece of code actually do?

+ 11
- 47
.github/workflows/release.yml View File

@@ -1,66 +1,30 @@
name: Release Application

on:
push:
tags: ['v*']
- release

jobs:
release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup
run: |
sudo apt update
sudo apt install ruby
sudo gem install ronn
- name: Prepare release
id: prepare_release
run: |
changelog="$(git diff $(git describe --abbrev=0 --tags $(git describe --abbrev=0 --tags)^) -- CHANGELOG.md | grep -E '\+[#*]' | sed 's/^+/\n/')"
echo "::set-output name=changelog::$changelog"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }}
draft: true
prerelease: false
body: |
${{ steps.prepare_release.outputs.changelog }}


pip:
name: Release to PyPI
pipy:
name: Build and release to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
python-version: '3.x'
- name: Setup environment
run: |
sudo apt update
python -m pip install --upgrade pip poetry
sudo apt install ruby
sudo gem install ronn
- name: Install dependencies
- name: Build package
run: |
python -m pip install --upgrade pip pipenv twine wheel
pipenv lock --pre
pipenv sync
pipenv run pip freeze > requirements.txt
pip install -r requirements.txt
- name: Build and publish
poetry install
poetry build
- name: Publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_PASSWORD }}
run: |
make build
twine upload dist/*

poetry publish

+ 11
- 26
.github/workflows/tests.yml View File

@@ -5,6 +5,7 @@ on:
branches: [main, features]
pull_request:
branches: [main, features]
workflow_dispatch:

jobs:
doc-tests:
@@ -13,11 +14,9 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04
- macos-10.15
- ubuntu-latest
- macos-11.0
- windows-2019
- windows-latest
python_version:
- '3.7'
- '3.8'
@@ -33,37 +32,23 @@ jobs:
python-version: ${{ matrix.python_version }}
architecture: x64

- name: Prepare environment (non-Windows systems)
if: ${{ matrix.os != 'windows-2019' }}
- name: Prepare environment
run: |
pip install --upgrade pip pipenv
python3 -m pip install --upgrade pip poetry

- name: Prepare environment (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
python -mpip install --upgrade pip pipenv

- name: Install dependencies (all systems)
- name: Install dependencies
env:
PIP_PREFER_BINARY: 1
run: |
pipenv lock --pre
pipenv sync --dev
pipenv install --dev

- name: Install dependencies (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
pipenv lock -r > requirements.txt
python -mpip install -r requirements.txt
python3 -m poetry install

- name: Run doc tests (with coverage)
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.10' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python_version == '3.10' }}
run: |
make coverage-doctests

- name: Run doc tests (without coverage)
if: ${{ matrix.os != 'ubuntu-20.04' || matrix.python_version != '3.10' }}
if: ${{ matrix.os != 'ubuntu-latest' || matrix.python_version != '3.10' }}
run: |
make doctests

@@ -71,6 +56,6 @@ jobs:
env:
COVERALLS_PRO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.10' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python_version == '3.10' }}
run: |
pipenv run coveralls --service=github
python3 -m poetry run coveralls --service=github

+ 1
- 0
.gitignore View File

@@ -7,3 +7,4 @@ Pipfile.lock

# Gitpod-specific:
/.vscode/**
poetry.lock

+ 2
- 2
.gitpod.yml View File

@@ -8,5 +8,5 @@ vscode:
- editorconfig.editorconfig

tasks:
- before: pip install -U pip pipenv
init: pipenv lock --pre && pipenv sync --dev --pre
- before: pip install -U pip poetry
init: poetry install

+ 4
- 27
Makefile View File

@@ -1,42 +1,19 @@
black:
pipenv run black kosmorrolib setup.py
poetry run black kosmorrolib setup.py

.PHONY: tests
tests: doctests

coverage-doctests:
pipenv run python3 -m coverage run tests.py
python3 -m poetry run coverage run tests.py

coverage-report:
pipenv run python3 -m coverage report
python3 -m poetry run coverage report

doctests:
pipenv run python3 tests.py

.PHONY: build
build:
python3 setup.py sdist bdist_wheel

env:
@if [[ "$$RELEASE_NUMBER" == "" ]]; \
then echo "Missing environment variable: RELEASE_NUMBER."; \
echo 'Example: export RELEASE_NUMBER="1.0.0" (without the leading "v")'; \
exit 1; \
fi
python3 -m poetry run python tests.py

changelog:
conventional-changelog -p angular -i CHANGELOG.md -s
@echo -e "\e[32m✔\e[33m Changelog generated. Don't forget to update the version number before committing.\e[0m"
@echo -e " When everything is good, finish the release with 'make tag'."

tag: env
git add CHANGELOG.md kosmorrolib/__version__.py
git commit -m "build: bump version $$RELEASE_NUMBER"
git tag "v$$RELEASE_NUMBER"
git checkout features
git merge main
git checkout main

@echo
@echo -e "\e[1mVersion \e[36m$$RELEASE_NUMBER\e[39m successfully tagged!"
@echo -e "Invoke \e[33mgit push origin master features v$$RELEASE_NUMBER\e[39m to finish."

+ 0
- 19
Pipfile View File

@@ -1,19 +0,0 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
coveralls = "*"
parameterized = "*"
black = "*"
coverage = "*"

[packages]
skyfield = ">=1.32.0,<2.0.0"
numpy = ">=1.17.0,<2.0.0"
python-dateutil = ">=2.8.0,<3.0.0"
skyfield-data = ">=3.0.0,<4.0.0"

[requires]
python_version = "3"

+ 7
- 42
README.md View File

@@ -9,55 +9,20 @@
Kosmorrolib requires the following software to work:

- Python ≥ 3.7.0
- PIP

### Production environment

Keep in mind that Kosmorrolib is not considered as stable for now.
And that's all!

#### PyPI
### Production environment

Kosmorrolib is available [on PyPI](https://pypi.org/project/kosmorrolib/): `pip install kosmorrolib`.
Kosmorrolib is available [on PyPI](https://pypi.org/project/kosmorrolib/). To use it, invoke `pip install kosmorrolib`.

### Development environment

First, install [Pipenv](https://pypi.org/project/pipenv/).
To contribute to Kosmorrolib, you will need [Poetry](https://python-poetry.org), a software to manage the project from development to publishing.

Clone this repository and run `pipenv sync` to install all the dependencies.
Clone this repository and run `poetry install` to install the dependencies.
And that's all, your development environment is ready for the fight! 👏

## Using the Kosmorrolib

The Kosmorrolib provides three functions that you can use in your code:

```python
#!/usr/bin/env python3

import kosmorrolib
from datetime import date

position = kosmorrolib.Position(50.5824, 3.0624)

# Get the moon phase for today
moon_phase = kosmorrolib.get_moon_phase()

# Get the moon phase for June 9th, 2021
moon_phase = kosmorrolib.get_moon_phase(date.fromisoformat('2021-06-09'))

# Get a list of objects representing the ephemerides of today.
ephemerides = kosmorrolib.get_ephemerides(position)

# Get a list of objects representing the ephemerides of June 9th, 2021.
ephemerides = kosmorrolib.get_ephemerides(position, date.fromisoformat('2021-06-09'))

# Get a list of objects representing the events of today.
events = kosmorrolib.get_events()

# Get a list of objects representing the events on June 9th, 2021.
events = kosmorrolib.get_events(date.fromisoformat('2021-06-09'))
## Documentation

# Note that each method provides an optional parameter for the timezone:
moon_phase = kosmorrolib.get_moon_phase(timezone=2)
ephemerides = kosmorrolib.get_ephemerides(position, timezone=2)
events = kosmorrolib.get_events(timezone=2)
```
All the documentation can be found [on the website](https://kosmorro.space/lib/doc).

+ 16
- 0
SECURITY.md View File

@@ -0,0 +1,16 @@
# Security Policy

## Supported Versions

For Kosmorrolib, the library that actually makes the calculations, the last patch of the two last minor versions are supported.
Therefore, once a new minor version of Kosmorrolib is released, you have some time to upgrade before it comes to End-of-Life.

Currently supported versions of Kosmorrolib are listed at [kosmorro.space](https://kosmorro.space/support/versions/).

## Reporting a Vulnerability

If you find any vulnerability, please don't open an issue directly, and send me an email to [jerome+kosmorrolib@deuchnord.fr](mailto:jerome+kosmorrolib@deuchnord.fr?subject=Vulnerability+in+Kosmorrolib) with the subject: _"Vulnerability in Kosmorrolib"_ to describe the exact nature of the vulnerability.
If the vulnerability can be reproduced on my side, then a patch will be made along with a security advisory.
If I cannot reproduce the vulnerability, then I will send you an email to ask for more information.

Thank you!

+ 0
- 26
kosmorrolib/__version__.py View File

@@ -1,26 +0,0 @@
#!/usr/bin/env python3

# Kosmorrolib - The Library To Compute Your Ephemerides
# Copyright (C) 2021 Jérôme Deuchnord <jerome@deuchnord.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

__title__ = "kosmorrolib"
__description__ = "A library to compute your ephemerides"
__url__ = "http://kosmorro.space/lib"
__version__ = "1.0.1"
__author__ = "Jérôme Deuchnord"
__author_email__ = "jerome@deuchnord.fr"
__license__ = "AGPL-v3"
__copyright__ = "2021 - Jérôme Deuchnord"

+ 37
- 0
pyproject.toml View File

@@ -0,0 +1,37 @@
[tool.poetry]
name = "kosmorrolib"
version = "1.0.1"
authors = ["Jérôme Deuchnord <jerome@deuchnord.fr>"]
homepage = "https://kosmorro.space/lib"
repository = "https://github.com/Kosmorro/lib"
documentation = "https://kosmorro.space/lib/doc"
keywords = ["kosmorro", "astronomy", "ephemerides", "ephemeris"]
license = "AGPL-3.0-or-later"
description = "A library to computes the ephemerides."
readme = "README.md"
include = ["CHANGELOG.md"]

classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers",
"Intended Audience :: Education",
]

[tool.poetry.dependencies]
python = "^3.7"
skyfield = "^1.21"
skyfield-data = "^3.0"
numpy = "^1.17"
python-dateutil = "^2.8"

[tool.poetry.dev-dependencies]
black = "^21.11b1"
parameterized = "^0.8.1"
coverage = "^6.1.2"
coveralls = "^3.3.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

+ 0
- 57
setup.py View File

@@ -1,57 +0,0 @@
#!/usr/bin/env python3

# Kosmorrolib - The Library To Compute Your Ephemerides
# Copyright (C) 2021 Jérôme Deuchnord <jerome@deuchnord.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import pathlib
from setuptools import setup, find_packages

from kosmorrolib.__version__ import __version__

HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()

setup(
name="kosmorrolib",
version=__version__,
author="Jérôme Deuchnord",
author_email="jerome@deuchnord.fr",
url="http://kosmorro.space/lib",
license="AGPL-v3",
description="A library to computes the ephemerides.",
long_description=README,
long_description_content_type="text/markdown",
keywords=["kosmorro", "astronomy", "ephemerides", "ephemeris"],
packages=["kosmorrolib"],
install_requires=[
"skyfield>=1.21.0,<2.0.0",
"skyfield-data>=3.0.0,<4.0.0",
"numpy>=1.17.0,<2.0.0",
"python-dateutil",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering :: Astronomy",
],
python_requires=">=3.7",
)

Loading…
Cancel
Save