Lay groundwork for a real application
This commit is contained in:
parent
d44e92f679
commit
f03cb93641
|
@ -1,4 +1,4 @@
|
|||
|
||||
.envrc
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/python
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=python
|
||||
|
@ -309,3 +309,4 @@ fabric.properties
|
|||
!.idea/runConfigurations
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/jetbrains+all
|
||||
_version.py
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
fail_fast: false
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
exclude: .*\.(md|json)
|
||||
- id: end-of-file-fixer
|
||||
exclude: .*\.(json)
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
args: [--maxkb=5120] # 2 MB
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.12b0
|
||||
hooks:
|
||||
- id: black
|
||||
name: Formatting
|
||||
args: ["./pynoaa"]
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.10.1
|
||||
hooks:
|
||||
- id: isort
|
||||
name: Import order
|
||||
args: ["--profile=black", "./pynoaa"]
|
|
@ -0,0 +1,16 @@
|
|||
SHELL := /bin/bash
|
||||
.PHONY: venv
|
||||
|
||||
VENV_DIR=$$(pwd)/venv
|
||||
VENV_PYTHON=$(VENV_DIR)/bin/python
|
||||
VENV_BIN=$(VENV_DIR)/bin
|
||||
|
||||
install:
|
||||
@$(VENV_BIN)/pip install --upgrade -e '.[dev]'
|
||||
@$(VENV_BIN)/pre-commit install
|
||||
|
||||
using-q:
|
||||
@imported=$$(git grep -I "^import q " -- '*.py'| wc -l);used=$$(git grep -I "^\s*[^#]q(.*[^:]" -- '*.py'|wc -l); if (( $${used} + $${imported} > 0)); then exit -1; fi
|
||||
|
||||
regen-schema:
|
||||
@$(VENV_BIN)/datamodel-codegen --url https://api.weather.gov/openapi.yaml --input-file-type openapi --enable-faux-immutability --target-python-version 3.9 --wrap-string-literal --output ./pynoaa/models.py
|
|
@ -0,0 +1,3 @@
|
|||
from importlib.metadata import version
|
||||
|
||||
__version__ = version(__name__)
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Optional
|
||||
|
||||
import typer
|
||||
|
||||
from pynoaa import __version__
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
def version_callback(value: bool):
|
||||
if value:
|
||||
typer.echo(f"{__version__}")
|
||||
raise typer.Exit()
|
||||
|
||||
|
||||
@app.callback()
|
||||
def main(
|
||||
version: Optional[bool] = typer.Option(
|
||||
None, "--version", callback=version_callback, is_eager=True
|
||||
),
|
||||
):
|
||||
"""NOAA weather CLI utility"""
|
||||
...
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,39 @@
|
|||
[build-system]
|
||||
requires = ["setuptools", "wheel", "versioningit~=1.0.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.versioningit]
|
||||
default-version = "0+unknown"
|
||||
|
||||
[tool.versioningit.format]
|
||||
# Same format as versioneer
|
||||
distance = "{version}+{distance}.{vcs}{rev}"
|
||||
dirty = "{version}+{distance}.{vcs}{rev}.dirty"
|
||||
distance-dirty = "{version}+{distance}.{vcs}{rev}.dirty"
|
||||
|
||||
[tool.versioningit.write]
|
||||
file = "pynoaa/_version.py"
|
||||
|
||||
[tool.isort]
|
||||
skip='venv'
|
||||
profile='black'
|
||||
|
||||
[tool.black]
|
||||
target-version = ['py36','py37', 'py38']
|
||||
exclude = '''
|
||||
(
|
||||
/(
|
||||
\.eggs # exclude a few common directories in the
|
||||
| \.git # root of the project
|
||||
| \.mypy_cache
|
||||
| \.tox
|
||||
| \.venv
|
||||
| \.env
|
||||
| \venv
|
||||
| _build
|
||||
| buck-out
|
||||
| build
|
||||
| dist
|
||||
)/
|
||||
)
|
||||
'''
|
|
@ -0,0 +1,27 @@
|
|||
[metadata]
|
||||
name=pynoaa
|
||||
description="A python interface to weather.gov"
|
||||
author= "grym"
|
||||
author_email = "grym@ctrl-c.club"
|
||||
url="https://tildegit.org/grym/pynoaa"
|
||||
|
||||
[options]
|
||||
python_requires = >=3.9
|
||||
packages=find:
|
||||
install_requires=
|
||||
httpx>=0.16.1
|
||||
pydantic
|
||||
typer[all]
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
pynoaa = pynoaa.cli:app
|
||||
|
||||
[options.extras_require]
|
||||
dev =
|
||||
black>=20.8b1
|
||||
coverage>=4.5.4
|
||||
ipython
|
||||
isort>=4.3.21
|
||||
pre-commit
|
||||
datamodel-code-generator[http]
|
Loading…
Reference in New Issue