Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ibLeDy committed Oct 26, 2023
2 parents bb9ad38 + aa0d71f commit f46622a
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 110 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.git
.github
.mypy_cache
.pre-commit-config.yaml
.pytest_cache
.venv
.tox
*.egg-info
build
dist
requirements-dev.txt
test
27 changes: 27 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,30 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: bledy/timezone-converter
tags: type=semver,pattern={{version}}

- name: Login to Docker Hub
id: login-dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand All @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand All @@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand Down
33 changes: 20 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,40 @@ repos:
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: ["--remove"]
args:
- "--remove"
- id: mixed-line-ending
- id: name-tests-test
- id: pretty-format-json
args: ["--autofix"]
args:
- "--autofix"
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.3.0
rev: v3.9.0
hooks:
- id: reorder-python-imports

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.3
rev: v2.3.0
hooks:
- id: add-trailing-comma
args: ["--py36-plus"]
args:
- "--py36-plus"

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.2.0
rev: v1.3.1
hooks:
- id: remove-crlf
- id: remove-tabs

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.1
rev: v2.2.0
hooks:
- id: setup-cfg-fmt
args:
- "--include-version-classifiers"

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
Expand All @@ -72,24 +77,26 @@ repos:
- id: text-unicode-replacement-char

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.10.0
hooks:
- id: black
args: ["--skip-string-normalization"]
args:
- "--skip-string-normalization"

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
args: ["--max-line-length=88"]
args:
- "--max-line-length=88"

- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.4.0
hooks:
- id: yesqa

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
rev: v0.982
hooks:
- id: mypy
additional_dependencies:
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.12-slim-bullseye

ENV PYTHONUNBUFFERED 1

LABEL maintainer="deejaynof@gmail.com"

RUN : \
&& groupadd --gid 1001 timezone-converter \
&& useradd --uid 1001 --gid timezone-converter --system --create-home --home-dir /home/timezone-converter timezone-converter \
&& :
USER timezone-converter

WORKDIR /opt
COPY --chown=timezone-converter:timezone-converter . .

ENV PATH="/home/timezone-converter/.local/bin:$PATH"
RUN : \
&& python3 -m pip --no-cache-dir install . \
&& :

ENTRYPOINT [ "timezone-converter" ]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ pip install -U timezone-converter
timezone-converter <timezone> [<timezone> ...]
```

### Docker

```bash
docker run --rm -t bledy/timezone-converter <timezone> [<timezone> ...]
```

## Features

### Comparison between multiple timezones
Expand Down
106 changes: 106 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[build-system]
requires = [
"hatchling>=1.10.0",
]
build-backend = "hatchling.build"

[project]
name = "timezone-converter"
version = "0.12.1"
description = "Compare your local timezone with foreign ones."
license = "MIT"
license-files = { paths = ["LICENSE"] }
readme = "README.md"
authors = [
{ name = "Iago Alonso", email = "deejaynof@gmail.com" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Terminals",
"Topic :: Utilities",
"Typing :: Typed",
]
requires-python = ">=3.8"
dependencies = [
"importlib-metadata",
"pytz>=2022.6",
"rich>=12.6.0",
]

[project.scripts]
timezone-converter = "timezone_converter.main:main"

[project.urls]
Homepage = "https://github.com/ibLeDy/timezone-converter"

[tool.hatch.build.targets.sdist]
include = [
"timezone_converter",
]
exclude = [
"tests*",
]

[tool.hatch.build.targets.wheel]
packages = [
"timezone_converter",
]

[tool.mypy]
check_untyped_defs = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
no_implicit_reexport = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false

[tool.coverage.run]
plugins = "covdefaults"

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py38, py39, py310, py311, py312
isolated_build = True
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
[testenv]
commands =
timezone-converter
timezone-converter --help
timezone-converter tijuana
timezone-converter tijuana --single
timezone-converter tijuana --single 14
timezone-converter tijuana new_york
timezone-converter tijuana new_york --single
timezone-converter tijuana --zone
timezone-converter tijuana --list
timezone-converter tijuana --list tbd
"""
85 changes: 0 additions & 85 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

7 changes: 1 addition & 6 deletions timezone_converter/constants.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import sys

if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata
from importlib import metadata

VERSION = metadata.version('timezone-converter')

0 comments on commit f46622a

Please sign in to comment.