moremoban / pypi-mobans

general python package templates using moban
Other
6 stars 7 forks source link

update the naughty in setup.py.jj2 #110

Closed chfw closed 5 years ago

chfw commented 5 years ago

so that it will pass flake8 all the time.

jayvdb commented 5 years ago

Regarding "update changelog to be yaml lint friendly" , if you are removing the backtick at the beginning of the line, you can usually also remove the quotes around the line.

chfw commented 5 years ago

If we take a step back, this PR did not bring any harm to setup.py but shrink its longest line within a limit. So would you agree to merge it?

jayvdb commented 5 years ago

I believe it will break the mobans repo, because black will try to rewrite this line again to be longer.

chfw commented 5 years ago

current modification is black-compatible.

jayvdb commented 5 years ago

https://github.com/peterjc/flake8-black might also help

jayvdb commented 5 years ago

It looks like it is, however the output still isnt. Why fix just one line when the rest of the file is still incompatible? And it is pointless to fix it once; there needs to be a CI test to ensure it stays compatible. Otherwise the generated output still must be excluded from various linting rules to avoid constant breakages.

> python3 -m black  tests/fixtures/setup.py.output
reformatted tests/fixtures/setup.py.output
All done! ✨ 🍰 ✨
1 file reformatted.
> GIT_PAGER=cat git diff
diff --git a/tests/fixtures/setup.py.output b/tests/fixtures/setup.py.output
index 75b982f..b0e03e9 100644
--- a/tests/fixtures/setup.py.output
+++ b/tests/fixtures/setup.py.output
@@ -32,15 +32,11 @@ AUTHOR = "C.W."
 VERSION = ""
 EMAIL = "wangc_2011@hotmail.com"
 LICENSE = "NEW BSD"
-DESCRIPTION = (
-    "Scaffolding templates for your Python project."
-)
+DESCRIPTION = "Scaffolding templates for your Python project."
 URL = "https://github.com/moremoban/pypi-mobans"
 DOWNLOAD_URL = "%s/archive/0.0.0.tar.gz" % URL
 FILES = ["README.rst", "CHANGELOG.rst"]
-KEYWORDS = [
-    "python",
-]
+KEYWORDS = ["python"]

 CLASSIFIERS = [
     "Topic :: Software Development :: Libraries",
@@ -52,15 +48,11 @@ CLASSIFIERS = [
     "Programming Language :: Python :: 3.4",
     "Programming Language :: Python :: 3.5",
     "Programming Language :: Python :: 3.6",
-
     "Programming Language :: Python :: 3.7",
-
     "Programming Language :: Python :: 3.8",
-
 ]

-INSTALL_REQUIRES = [
-]
+INSTALL_REQUIRES = []
 SETUP_COMMANDS = {}

@@ -70,12 +62,11 @@ EXTRAS_REQUIRE = {}
 PUBLISH_COMMAND = "{python} setup.py sdist bdist_wheel upload -r pypi".format(
     python=sys.executable
 )
-GS_COMMAND = ("gs pypi-mobans v0.0.0 " +
-              "Find 0.0.0 in changelog for more details")
-NO_GS_MESSAGE = ("Automatic github release is disabled. " +
-                 "Please install gease to enable it.")
-UPLOAD_FAILED_MSG = (
-    'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND)
+GS_COMMAND = "gs pypi-mobans v0.0.0 " + "Find 0.0.0 in changelog for more details"
+NO_GS_MESSAGE = (
+    "Automatic github release is disabled. " + "Please install gease to enable it."
+)
+UPLOAD_FAILED_MSG = 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND
 HERE = os.path.abspath(os.path.dirname(__file__))

@@ -118,9 +109,7 @@ class PublishCommand(Command):
         sys.exit()

-SETUP_COMMANDS.update({
-    "publish": PublishCommand
-})
+SETUP_COMMANDS.update({"publish": PublishCommand})

 def has_gease():
@@ -131,6 +120,7 @@ def has_gease():
     """
     try:
         import gease  # noqa
+
         return True
     except ImportError:
         return False
@@ -198,5 +188,5 @@ if __name__ == "__main__":
         include_package_data=True,
         zip_safe=False,
         classifiers=CLASSIFIERS,
-        cmdclass=SETUP_COMMANDS
+        cmdclass=SETUP_COMMANDS,
     )
chfw commented 5 years ago

OK. I accept your point. Yes, it is quite clear now that black will do more formatting.