Skip to content

Commit

Permalink
Initial commit after norwegianblue fork
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Mar 18, 2022
1 parent 09c121d commit 08fe89e
Show file tree
Hide file tree
Showing 29 changed files with 224 additions and 1,386 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ exclude_lines =

[run]
omit =
src/norwegianblue/__main__.py
src/norwegianblue/cli.py
*/pepotron/__main__.py
*/pepotron/cli.py
16 changes: 5 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,19 @@ on:
jobs:
deploy:
if: github.repository_owner == 'hugovk'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: deploy-${{ hashFiles('**/setup.py') }}
restore-keys: |
deploy-
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: pip
cache-dependency-path: "setup.py"

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: micnncim/action-label-syncer@v1
with:
prune: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
3 changes: 2 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ on:
# branches to consider in the event; optional, defaults to all
branches:
- main
workflow_dispatch:

jobs:
update_release_draft:
if: github.repository == 'hugovk/norwegianblue'
if: github.repository_owner == 'hugovk'
runs-on: ubuntu-latest
steps:
# Drafts your next release notes as pull requests are merged into "main"
Expand Down
29 changes: 5 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["pypy-3.7", "3.7", "3.8", "3.9", "3.10"]
python-version: ["pypy-3.8", "3.7", "3.8", "3.9", "3.10", "3.11-dev"]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
# Include new variables for Codecov
Expand All @@ -20,27 +20,14 @@ jobs:
- { codecov-flag: GHA_Windows, os: windows-latest }

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.os }}-${{ matrix.python-version }}-v1-${{
hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-v1-
cache: pip
cache-dependency-path: "setup.py"

- name: Install dependencies
run: |
Expand All @@ -52,12 +39,6 @@ jobs:
run: |
tox -e py
- name: Tox tests (pins)
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
shell: bash
run: |
tox -e pins
- name: Upload coverage
uses: codecov/[email protected]
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,3 @@ venv.bak/
.mypy_cache/
.dmypy.json
dmypy.json

# Version number generated by setuptools_scm
_version.py
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v2.31.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.1.0
hooks:
- id: black
args: [--target-version=py37]
Expand Down Expand Up @@ -39,9 +39,15 @@ repos:
rev: v1.20.0
hooks:
- id: setup-cfg-fmt
args: [--max-py-version=3.11]

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "0.5.2"
hooks:
- id: tox-ini-fmt

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v2.6.0
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2021 Hugo van Kemenade
Copyright (c) 2018-2022 Hugo van Kemenade

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
175 changes: 28 additions & 147 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,186 +1,67 @@
# norwegianblue

[![PyPI version](https://img.shields.io/pypi/v/norwegianblue.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/norwegianblue/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/norwegianblue.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/norwegianblue/)
[![PyPI downloads](https://img.shields.io/pypi/dm/norwegianblue.svg)](https://pypistats.org/packages/norwegianblue)
[![Test](https://github.com/hugovk/norwegianblue/actions/workflows/test.yml/badge.svg)](https://github.com/hugovk/norwegianblue/actions)
[![codecov](https://codecov.io/gh/hugovk/norwegianblue/branch/main/graph/badge.svg)](https://codecov.io/gh/hugovk/norwegianblue)
[![GitHub](https://img.shields.io/github/license/hugovk/norwegianblue.svg)](LICENSE.txt)
# pepotron

[![PyPI version](https://img.shields.io/pypi/v/pepotron.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/pepotron/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/pepotron.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/pepotron/)
[![PyPI downloads](https://img.shields.io/pypi/dm/pepotron.svg)](https://pypistats.org/packages/pepotron)
[![Test](https://github.com/hugovk/pepotron/actions/workflows/test.yml/badge.svg)](https://github.com/hugovk/pepotron/actions)
[![codecov](https://codecov.io/gh/hugovk/pepotron/branch/main/graph/badge.svg)](https://codecov.io/gh/hugovk/pepotron)
[![GitHub](https://img.shields.io/github/license/hugovk/pepotron.svg)](LICENSE.txt)
[![Code style: Black](https://img.shields.io/badge/code%20style-Black-000000.svg)](https://github.com/psf/black)

<p align="center"><img src="https://raw.githubusercontent.com/hugovk/norwegianblue/main/img/eol-python.png" width="319" height="197"></p>

Python interface to [endoflife.date](https://endoflife.date/docs/api/) to show
end-of-life dates for a number of products.
CLI to open PEPs in your browser.

## Installation

### From PyPI

```bash
python -m pip install --upgrade norwegianblue
python3 -m pip install --upgrade pepotron
```

### From source

```bash
git clone https://github.com/hugovk/norwegianblue
cd norwegianblue
git clone https://github.com/hugovk/pepotron
cd pepotron
pip install .
```

## Example command-line use

Run `norwegianblue` or `eol`, they do the same thing.
## Usage

Top-level help:
### Help

<!-- [[[cog
from scripts.run_command import run
run("eol --help")
run("pep --help")
]]] -->

```console
$ eol --help
usage: eol [-h] [-f {html,json,markdown,rst,tsv}] [-c {yes,no,auto}]
[--clear-cache] [-v] [-V]
[product]

CLI to show end-of-life dates for a number of products, from https://endoflife.date
$ pep --help
usage: pep [-h] [-u URL] [-V] search

For example:

* `eol python` to see Python EOLs
* `eol ubuntu` to see Ubuntu EOLs
* `eol all` to list all available products

Something missing? Please contribute! https://endoflife.date/contribute
CLI to open PEPs in your browser

positional arguments:
product Product to check, or 'all' to list all available
(default: all)
search PEP number, or Python version for its schedule

options:
-h, --help show this help message and exit
-f {html,json,markdown,rst,tsv}, --format {html,json,markdown,rst,tsv}
The format of output (default: markdown)
-c {yes,no,auto}, --color {yes,no,auto}
color terminal output (default: auto)
--clear-cache Clear cache before running (default: False)
-v, --verbose Print debug messages to stderr (default: False)
-V, --version show program's version number and exit
-h, --help show this help message and exit
-u URL, --url URL Base URL for PEPs (default: https://peps.python.org)
-V, --version show program's version number and exit
```

<!-- [[[end]]] -->

List all available products with end-of-life dates:
### Open a PEP

```console
$ # eol all
$ # or:
$ pep 8
https://peps.python.org/pep-0008/
```

<!-- [[[cog
from scripts.run_command import run
run("eol", line_limit=5)
]]] -->
### Open release schedule PEP for a Python version

```console
$ eol
alpine
amazon-eks
amazon-linux
android
angular
...
$ pep 3.11
https://peps.python.org/pep-0664/
```

<!-- [[[end]]] -->

Show end-of-life dates:

<!-- [[[cog
from scripts.run_command import run
run("norwegianblue python")
]]] -->

```console
$ norwegianblue python
| cycle | latest | release | eol |
|:------|:-------|:----------:|:----------:|
| 3.10 | 3.10.0 | 2021-10-04 | 2026-10-04 |
| 3.9 | 3.9.9 | 2020-10-05 | 2025-10-05 |
| 3.8 | 3.8.12 | 2019-10-14 | 2024-10-14 |
| 3.7 | 3.7.12 | 2018-06-27 | 2023-06-27 |
| 3.6 | 3.6.15 | 2016-12-23 | 2021-12-23 |
| 3.5 | 3.5.10 | 2015-09-30 | 2020-09-13 |
| 3.4 | 3.4.10 | 2014-03-16 | 2019-03-18 |
| 3.3 | 3.3.7 | 2012-09-29 | 2017-09-29 |
| 2.7 | 2.7.18 | 2010-07-03 | 2020-01-01 |
```

<!-- [[[end]]] -->

The table is Markdown, ready for pasting in GitHub issues and PRs:

<!-- [[[cog
from scripts.run_command import run
run("norwegianblue python", with_console=False)
]]] -->

| cycle | latest | release | eol |
| :---- | :----- | :--------: | :--------: |
| 3.10 | 3.10.0 | 2021-10-04 | 2026-10-04 |
| 3.9 | 3.9.9 | 2020-10-05 | 2025-10-05 |
| 3.8 | 3.8.12 | 2019-10-14 | 2024-10-14 |
| 3.7 | 3.7.12 | 2018-06-27 | 2023-06-27 |
| 3.6 | 3.6.15 | 2016-12-23 | 2021-12-23 |
| 3.5 | 3.5.10 | 2015-09-30 | 2020-09-13 |
| 3.4 | 3.4.10 | 2014-03-16 | 2019-03-18 |
| 3.3 | 3.3.7 | 2012-09-29 | 2017-09-29 |
| 2.7 | 2.7.18 | 2010-07-03 | 2020-01-01 |

<!-- [[[end]]] -->

With options:

<!-- [[[cog
from scripts.run_command import run
run("eol nodejs --format rst")
]]] -->

```console
$ eol nodejs --format rst
.. table::

======== ========= ============ ============ ============
cycle latest release support eol
======== ========= ============ ============ ============
17 17.1.0 2021-10-19 2022-04-01 2022-06-01
16 LTS 16.13.0 2021-04-20 2022-10-18 2024-04-30
15 15.14.0 2020-10-20 2021-04-01 2021-06-01
14 LTS 14.18.1 2020-04-21 2021-10-19 2023-04-30
12 LTS 12.22.7 2019-04-23 2020-10-20 2022-04-30
10 LTS 10.24.1 2018-04-24 2020-05-19 2021-04-30
======== ========= ============ ============ ============
```

<!-- [[[end]]] -->

## Example programmatic use

Return values are from the JSON responses documented in the API:
https://endoflife.date/docs/api/

```python
import norwegianblue

# Call the API
print(norwegianblue.norwegianblue())
print(norwegianblue.norwegianblue(product="ubuntu"))
print(norwegianblue.norwegianblue(format="json"))
```

## Why "Norwegian Blue"?

[The Norwegian Blue has reached end-of-life.](https://youtu.be/vnciwwsvNcc)
Loading

0 comments on commit 08fe89e

Please sign in to comment.