Skip to content

Commit

Permalink
chore(*): set formatter to black
Browse files Browse the repository at this point in the history
The flake8 vscode extension is not listed as a supported Python formatter.
  • Loading branch information
clabe45 committed May 3, 2024
1 parent df6bdf9 commit b441a9e
Show file tree
Hide file tree
Showing 54 changed files with 3,071 additions and 3,120 deletions.
17 changes: 14 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
[flake8]
exclude = shulkr/DecompilerMC
extend-ignore =
# Indentation — black handles
E1
W1
# Whitespace — black handles
E2
W2
# Blank lines — black handles
E3
W3
# Line length — black handles
E5
W5
per-file-ignores =
# line too long
tests/*: E501

use-flake8-tabs = true
indent-style = tab
max-line-length = 88
# continuation-style = hanging
INDENT-TABS-DEF = 1
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"ms-python.flake8"
"ms-python.flake8",
"ms-python.black-formatter"
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.defaultFormatter": "ms-python.flake8",
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.insertSpaces": false
}
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ pytest = "*"
pytest-mock = "*"
twine = "*"
flake8 = "*"
flake8-tabs = "*"
bump2version = "*"
keepachangelog = "*"
python-lsp-server = "*"
pyls-mypy = {git = "https://github.com/tomv564/pyls-mypy.git"}
# Needed to run tests on windows
atomicwrites = "*"
black = "*"

[requires]
python_version = "3.9"
Expand All @@ -36,6 +36,7 @@ test-unit = "python -m pytest tests/command/unit tests/gradle/unit tests/mint/un
test-smoke = "python -m pytest tests/command/smoke tests/gradle/smoke tests/mint/smoke tests/shulkr/smoke"
test-func = "python -m pytest tests/java/functional tests/shulkr/functional"
lint = "python -m flake8 src"
format = "black ."
profile = "python -m tests.profile"
bump = "python -m scripts.bump"
build = "python setup.py clean --all sdist bdist_wheel"
Expand Down
1,007 changes: 493 additions & 514 deletions Pipfile.lock

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions scripts/bump/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@
import keepachangelog


CHANGELOG_PATH = 'docs/changelog.md'
CHANGELOG_PATH = "docs/changelog.md"


def current_version():
changes = keepachangelog.to_dict(CHANGELOG_PATH)
return sorted(changes.keys())[-1]
changes = keepachangelog.to_dict(CHANGELOG_PATH)
return sorted(changes.keys())[-1]


def main():
repo = Repo('.')
repo = Repo(".")

old_version = current_version()
old_version = current_version()

# Release to get predicted version
keepachangelog.release(CHANGELOG_PATH)
predicted_version = current_version()
# Release to get predicted version
keepachangelog.release(CHANGELOG_PATH)
predicted_version = current_version()

# Confirm version
user_input = input('New version [{}]: '.format(predicted_version))
new_version = user_input or predicted_version
# Confirm version
user_input = input("New version [{}]: ".format(predicted_version))
new_version = user_input or predicted_version

# Undo temporary release
repo.git.restore(CHANGELOG_PATH)
# Undo temporary release
repo.git.restore(CHANGELOG_PATH)

# Release with confirmed version
keepachangelog.release(CHANGELOG_PATH, new_version)
# Release with confirmed version
keepachangelog.release(CHANGELOG_PATH, new_version)

# Update setup.py
with open('setup.py', 'r') as setuppy:
setuppy_code = setuppy.read()
new_setuppy_code = setuppy_code.replace(old_version, new_version)
with open('setup.py', 'w') as setuppy:
setuppy.write(new_setuppy_code)
# Update setup.py
with open("setup.py", "r") as setuppy:
setuppy_code = setuppy.read()
new_setuppy_code = setuppy_code.replace(old_version, new_version)
with open("setup.py", "w") as setuppy:
setuppy.write(new_setuppy_code)

# Commit to git
commit_message = f'chore(*): release version {new_version}\n\nBump version {old_version}{new_version}'
repo.git.commit(CHANGELOG_PATH, 'setup.py', message=commit_message)
repo.git.tag(f'v{new_version}', annotate=True, message=f'version {new_version}')
# Commit to git
commit_message = f"chore(*): release version {new_version}\n\nBump version {old_version}{new_version}"
repo.git.commit(CHANGELOG_PATH, "setup.py", message=commit_message)
repo.git.tag(f"v{new_version}", annotate=True, message=f"version {new_version}")

print(f'Bumped version {old_version}{new_version}')
print(f"Bumped version {old_version}{new_version}")


if __name__ == '__main__':
main()
if __name__ == "__main__":
main()
62 changes: 30 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,38 @@


script_dir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(script_dir, 'README.md'), 'r') as f:
README = f.read()
with open(os.path.join(script_dir, "README.md"), "r") as f:
README = f.read()

classifiers = [
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Games/Entertainment',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Version Control :: Git',
'Topic :: Utilities'
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Games/Entertainment",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Version Control :: Git",
"Topic :: Utilities",
]

setup(
name='shulkr',
version='0.7.1',
description='Diff decompiled versions of Minecraft',
long_description=README,
long_description_content_type='text/markdown',
url='https://github.com/clabe45/shulkr',
author='Caleb Sacks',
license='GPLv3',
classifiers=classifiers,
keywords=['minecraft', 'git', 'decompile', 'game'],
package_dir={'': 'src'},
packages=find_packages(where='src'),
py_modules=['colorama', 'java', 'minecraft', 'mint', 'shulkr'],
install_requires=['gitpython', 'javalang', 'unidiff', 'requests', 'toml', 'click'],
entry_points={
'console_scripts': ['shulkr=shulkr.__main__:main']
}
)
name="shulkr",
version="0.7.1",
description="Diff decompiled versions of Minecraft",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/clabe45/shulkr",
author="Caleb Sacks",
license="GPLv3",
classifiers=classifiers,
keywords=["minecraft", "git", "decompile", "game"],
package_dir={"": "src"},
packages=find_packages(where="src"),
py_modules=["colorama", "java", "minecraft", "mint", "shulkr"],
install_requires=["gitpython", "javalang", "unidiff", "requests", "toml", "click"],
entry_points={"console_scripts": ["shulkr=shulkr.__main__:main"]},
)
Loading

0 comments on commit b441a9e

Please sign in to comment.