From c864942778137e2286224cc6be743c4734003076 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Sat, 13 Nov 2021 02:28:30 +0100 Subject: [PATCH] Misc. cleanup for project setup (#1) * ci: fix branch configuration * readme: add initial content * add .gitignore * add code quality checks managed by pre-commit --- .flake8 | 3 + .github/workflows/code-quality.yaml | 15 ++ .github/workflows/installer.yml | 2 +- .gitignore | 373 ++++++++++++++++++++++++++++ .pre-commit-config.yaml | 28 +++ README.md | 80 ++++++ pyproject.toml | 14 ++ vercel.json | 10 +- 8 files changed, 520 insertions(+), 5 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/code-quality.yaml create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 README.md create mode 100644 pyproject.toml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..1ad81e7 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 88 +ignore = E501, E203, W503 diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml new file mode 100644 index 0000000..e1bbef2 --- /dev/null +++ b/.github/workflows/code-quality.yaml @@ -0,0 +1,15 @@ +name: Code Quality + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + name: Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index 3d76779..d11ae78 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -6,7 +6,7 @@ on: - 'install-poetry.py' - '.github/workflows/installer.yml' branches: - - master + - main pull_request: paths: - 'install-poetry.py' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b9df39 --- /dev/null +++ b/.gitignore @@ -0,0 +1,373 @@ +### VisualStudioCode template +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### VirtualEnv template +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +.venv +pip-selfcheck.json + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Emacs template +# -*- mode: gitignore; -*- +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +### Vim template +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +build/ +develop-eggs/ +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 + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +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/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..786cf39 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +repos: + - repo: https://github.com/psf/black + rev: 21.10b0 + hooks: + - id: black + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + additional_dependencies: [flake8-bugbear] + + - repo: https://github.com/timothycrosley/isort + rev: 5.10.1 + hooks: + - id: isort + additional_dependencies: [toml] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: debug-statements + - id: pretty-format-json + args: + - --autofix + - id: check-json diff --git a/README.md b/README.md new file mode 100644 index 0000000..e9601e2 --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +# Python Poetry Installer +This repository contains Poetry's official installation script, installer source and +related hosting configuration. + +The script is hosted on [Vercel](https://vercel.com/) and made available at +https://install.python-poetry.org/. + +## Usage + +Poetry provides a custom installer that will install `poetry` isolated +from the rest of your system. + +### osx / linux / bashonwindows install instructions +```bash +curl -sSL https://install.python-poetry.org | python - +``` +### windows powershell install instructions +```powershell +(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - +``` + +**Warning**: The previous `get-poetry.py` installer is now deprecated, if you are currently using it +you should migrate to the new, supported, `install-poetry.py` installer. + +The installer installs the `poetry` tool to Poetry's `bin` directory. This location depends on your system: + +- `$HOME/.local/bin` for Unix +- `%APPDATA%\Python\Scripts` on Windows + +If this directory is not on your `PATH`, you will need to add it manually +if you want to invoke Poetry with simply `poetry`. + +Alternatively, you can use the full path to `poetry` to use it. + +Once Poetry is installed you can execute the following: + +```bash +poetry --version +``` + +If you see something like `Poetry (version 1.2.0)` then you are ready to use Poetry. +If you decide Poetry isn't your thing, you can completely remove it from your system +by running the installer again with the `--uninstall` option or by setting +the `POETRY_UNINSTALL` environment variable before executing the installer. + +```bash +python install-poetry.py --uninstall +POETRY_UNINSTALL=1 python install-poetry.py +``` + +By default, Poetry is installed into the user's platform-specific home directory. +If you wish to change this, you may define the `POETRY_HOME` environment variable: + +```bash +POETRY_HOME=/etc/poetry python install-poetry.py +``` + +If you want to install prerelease versions, you can do so by passing `--preview` option to `install-poetry.py` +or by using the `POETRY_PREVIEW` environment variable: + +```bash +python install-poetry.py --preview +POETRY_PREVIEW=1 python install-poetry.py +``` + +Similarly, if you want to install a specific version, you can use `--version` option or the `POETRY_VERSION` +environment variable: + +```bash +python install-poetry.py --version 1.2.0 +POETRY_VERSION=1.2.0 python install-poetry.py +``` + +You can also install Poetry for a `git` repository by using the `--git` option: + +```bash +python install-poetry.py --git https://github.com/python-poetry/poetry.git@master +```` + +**Note**: Note that the installer does not support Python < 3.6. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..db0e70e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[tool.isort] +profile = "black" +force_single_line = true +atomic = true +include_trailing_comma = true +lines_after_imports = 2 +lines_between_types = 1 +use_parentheses = true +filter_files = true + + +[tool.black] +line-length = 88 +include = '\.pyi?$' diff --git a/vercel.json b/vercel.json index aa70976..78ae0b3 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,8 @@ { - "rewrites": [ - { "source": "/", "destination": "/install-poetry.py" } - ] + "rewrites": [ + { + "destination": "/install-poetry.py", + "source": "/" + } + ] } -