Skip to content

Commit

Permalink
Added pre-commit, reformatted all code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Knucklessg1 committed May 9, 2024
1 parent 97d1b16 commit 83f6bfe
Show file tree
Hide file tree
Showing 9 changed files with 788 additions and 264 deletions.
69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
default_language_version:
python: python3
exclude: 'dotnet'
ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_schedule: 'monthly'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-byte-order-marker
exclude: .gitignore
- id: check-merge-conflict
- id: detect-private-key
- id: trailing-whitespace
- id: end-of-file-fixer
- id: no-commit-to-branch
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args: ["--fix", "--ignore=E402"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["-L", "ans,linar,nam,tread,ot,"]
exclude: |
(?x)^(
pyproject.toml |
website/static/img/ag.svg |
website/yarn.lock |
website/docs/tutorial/code-executors.ipynb |
website/docs/topics/code-execution/custom-executor.ipynb |
website/docs/topics/non-openai-models/cloud-gemini.ipynb |
notebook/.*
)$
# See https://jaredkhan.com/blog/mypy-pre-commit
- repo: local
hooks:
- id: mypy
name: mypy
entry: "./scripts/pre-commit-mypy-run.sh"
language: python
# use your preferred Python version
# language_version: python3.8
additional_dependencies: []
types: [python]
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as a sanity-check
verbose: true
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: nbqa-black
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ 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.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ This repository is actively maintained - Contributions are welcome!

| Short Flag | Long Flag | Description |
|------------|-------------------|-----------------------------------------------|
| -h | --help | See usage for script |
| -c | --clean | Clean Recycle/Trash bin |
| -e | --enable-features | Enable Window Features |
| -f | --font | Install Hack NF Font |
| -i | --install | Install applications |
| -p | --python | Install Python Modules |
| -s | --silent | Don't print to stdout |
| -u | --update | Update your applications and Operating System |
| -t | --theme | Apply Takuyuma Terminal Theme |
| -h | --help | See usage for script |
| -c | --clean | Clean Recycle/Trash bin |
| -e | --enable-features | Enable Window Features |
| -f | --font | Install Hack NF Font |
| -i | --install | Install applications |
| -p | --python | Install Python Modules |
| -s | --silent | Don't print to stdout |
| -u | --update | Update your applications and Operating System |
| -t | --theme | Apply Takuyuma Terminal Theme |

</details>

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests>=2.28.1
requests>=2.28.1
15 changes: 15 additions & 0 deletions scripts/pre-commit-mypy-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# taken from: https://jaredkhan.com/blog/mypy-pre-commit

# A script for running mypy,
# with all its dependencies installed.

set -o errexit

# Change directory to the project root directory.
cd "$(dirname "$0")"/..

pip install -q -e .[types]

mypy
50 changes: 28 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,45 @@
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements

readme = Path('README.md').read_text()
readme = Path("README.md").read_text()
version = __version__
requirements = parse_requirements(os.path.join(os.path.dirname(__file__), 'requirements.txt'), session=PipSession())
requirements = parse_requirements(
os.path.join(os.path.dirname(__file__), "requirements.txt"), session=PipSession()
)
readme = re.sub(r"Version: [0-9]*\.[0-9]*\.[0-9][0-9]*", f"Version: {version}", readme)
with open("README.md", "w") as readme_file:
readme_file.write(readme)
description = 'Systems-Manager will update your system and install/upgrade applications.'
description = (
"Systems-Manager will update your system and install/upgrade applications."
)

setup(
name='systems-manager',
name="systems-manager",
version=f"{version}",
description=description,
long_description=f'{readme}',
long_description_content_type='text/markdown',
url='https://github.com/Knuckles-Team/systems-manager',
long_description=f"{readme}",
long_description_content_type="text/markdown",
url="https://github.com/Knuckles-Team/systems-manager",
author=__author__,
author_email='knucklessg1@gmail.com',
license='MIT',
packages=['systems_manager'],
author_email="knucklessg1@gmail.com",
license="MIT",
packages=["systems_manager"],
include_package_data=True,
install_requires=[str(requirement.requirement) for requirement in requirements],
py_modules=['systems_manager'],
package_data={'systems_manager': ['systems_manager']},
py_modules=["systems_manager"],
package_data={"systems_manager": ["systems_manager"]},
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: Public Domain',
'Environment :: Console',
'Operating System :: POSIX :: Linux',
'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',
"Development Status :: 5 - Production/Stable",
"License :: Public Domain",
"Environment :: Console",
"Operating System :: POSIX :: Linux",
"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",
],
entry_points={'console_scripts': ['systems-manager = systems_manager.systems_manager:main']},
entry_points={
"console_scripts": ["systems-manager = systems_manager.systems_manager:main"]
},
)
3 changes: 3 additions & 0 deletions systems_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# coding: utf-8
from systems_manager.version import __version__, __author__, __credits__
from systems_manager.systems_manager import SystemsManager, main, systems_manager

"""
system-manager
Expand All @@ -11,3 +12,5 @@
__version__ = __version__
__author__ = __author__
__credits__ = __credits__

__all__ = ['SystemsManager', 'main', 'systems_manager']
Loading

0 comments on commit 83f6bfe

Please sign in to comment.