diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..892da31 --- /dev/null +++ b/.gitignore @@ -0,0 +1,166 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +# Visual Studio Code related +.vscode + +# Generated by MacOS +.DS_Store diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..eb9b03b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,33 @@ +repos: + # https://github.com/pre-commit/pre-commit-hooks#pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-added-large-files + # https://pycqa.github.io/isort/docs/configuration/pre-commit.html + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + name: isort (python) + files: "\\.(py)$" + exclude: ^(\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|alembic)/ + args: [--settings-path=pyproject.toml] + - repo: https://github.com/psf/black + rev: 23.7.0 + hooks: + - id: black + language_version: python3.11 + exclude: ^(\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|alembic)/ + args: [--config=pyproject.toml] + # Check compliance with Ruff. + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.287 + hooks: + - id: ruff + name: ruff (python) + args : [--config=pyproject.toml] + exclude: ^(\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|alembic)/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..30635bd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Version 0.1.0 - 2023-09-08 + +### Added + +* Project Structure +* Hello World CLI Tool. +* Pre Commit Hooks +* `CHANGELOG.md` +* `README.md` +* `LICENSE` diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..53690cb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Hasan Sezer Taşan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/chrome_version/__main__.py b/chrome_version/__main__.py new file mode 100644 index 0000000..bbf131d --- /dev/null +++ b/chrome_version/__main__.py @@ -0,0 +1,21 @@ +import typer + +app = typer.Typer( + name="Chrome Version", +) + + +@app.callback( + name="Hello World", + help="Hello World.", + short_help="Hello World.", +) +def main(): + """ + Get the version of Chrome. + """ + typer.echo("Hello World.") + + +if __name__ == "__main__": + app() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..502738b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,121 @@ +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "chrome-version" +version = "0.1.0" +description = "Detect the version of Chrome installed on Windows, Linux, Mac. Cross-platform using Python, native OS detection." +authors = ["hasansezertasan "] +maintainers = ["hasansezertasan "] +readme = "README.md" +license = "MIT" +keywords = ["google chrome version", "chrome", "google", "version"] +classifiers = ["Topic :: Software Development :: Libraries :: Python Modules"] +packages = [{include = "chrome_version"}] +include = ["CHANGELOG.md"] + +[tool.ruff] +# Run `ruff linter` command to see all available linters and their descriptions +target-version = "py311" +line-length = 120 +select = [ + # "B", + # "C", + "E", + "F", + "W", + "I", + "B9", +] +ignore = [ + "B008", # do not perform function calls in argument defaults + "C901", # too complex + "E501", # line too long, handled by black + "F401", # imported but unused + "E402", # module level import not at top of file + "E712", # comparison to True should be 'if cond is True:' or 'if cond:' +] +exclude = [ + "alembic", + "migrations", +] +show-fixes = true + +[tool.isort] +profile = "black" +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +line_length = 120 +split_on_trailing_comma = true +skip_glob = ["**/alembic/**", "**/migrations/**"] + + +[tool.black] +line-length = 120 +target-version = ['py311'] +exclude = ''' +( + /( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.nox + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + | alembic + )/ +) +''' + +[tool.poetry.scripts] +chrome-version = "chrome_version.__main__:app" + +[tool.poe.tasks] +black = "black ." +flake8 = "flake8 ." +isort = "isort ." +bif = ["black", "isort", "flake8"] +test = "pytest -v -s" +makedocs = "pdoc --html -o docs --force -c show_source_code=False central_dispatch_client" +line-count = "pygount --format=summary" +clean = "frenchmaid clean" +requirements = "poetry export -f requirements.txt --output pyproject.txt --without-hashes" + + +[tool.poetry.dependencies] +python = "^3" +typer = "*" + +[tool.poetry.group.dev.dependencies] +ipykernel = "^6.25.1" +isort = "^5.12.0" +black = { extras = ["jupyter"], version = "^23.7.0" } +ruff = "^0.0.287" +pre-commit = "^3.4.0" +poethepoet = "^0.22.0" +frenchmaid = "^0.2.3" + +[tool.poetry.group.test.dependencies] +pytest = "^7.4.0" + +# poetry install --with docs +[tool.poetry.group.docs] +optional = true + +[tool.poetry.group.docs.dependencies] +pdoc3 = "0.10.0" + +[tool.poetry.group.analysis] +optional = true + +[tool.poetry.group.analysis.dependencies] +pygount = "1.6.1"