Browse Source

chore: migrate from Pipenv to Poetry (#35)

tags/v1.0.2
J茅r么me Deuchnord 1 year ago
committed by GitHub
parent
commit
ff8f3a7cba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 67 additions and 206 deletions
  1. +11
    -47
      .github/workflows/release.yml
  2. +10
    -26
      .github/workflows/tests.yml
  3. +1
    -0
      .gitignore
  4. +2
    -2
      .gitpod.yml
  5. +4
    -27
      Makefile
  6. +0
    -19
      Pipfile
  7. +2
    -2
      README.md
  8. +0
    -26
      kosmorrolib/__version__.py
  9. +37
    -0
      pyproject.toml
  10. +0
    -57
      setup.py

+ 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

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

@@ -14,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'
@@ -34,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

@@ -72,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"

+ 2
- 2
README.md View File

@@ -18,9 +18,9 @@ Kosmorrolib is available [on PyPI](https://pypi.org/project/kosmorrolib/). To us

### 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! 馃憦

## Documentation


+ 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