-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] Supported Interpreters Selection
- Loading branch information
Showing
31 changed files
with
975 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ build-backend = "poetry.core.masonry.api" | |
## Also renders on pypi as 'subtitle' | ||
[tool.poetry] | ||
name = "cookiecutter_python" | ||
version = "1.2.1" | ||
version = "1.3.0" | ||
description = "Yet another modern Python Package (pypi) with emphasis in CI/CD and automation." | ||
authors = ["Konstantinos Lampridis <[email protected]>"] | ||
maintainers = ["Konstantinos Lampridis <[email protected]>"] | ||
|
@@ -95,7 +95,8 @@ click = "^8" | |
cookiecutter = "^1.7.3" | ||
software-patterns = "^1.2.1" | ||
requests-futures = "^1.0.0" | ||
|
||
PyInquirer = "^1.0.3" | ||
prompt-toolkit = "==1.0.14" | ||
|
||
# A list of all of the optional dependencies, some of which are included in the | ||
# below `extras`. They can be opted into by apps. | ||
|
@@ -106,6 +107,7 @@ pytest-click = { version = "~= 1.1.0", optional = true } | |
pytest-cov = { version = ">= 2.12", optional = true } | ||
pytest-explicit = { version = "~= 1.0.1", optional = true } | ||
pytest-xdist = { version = ">= 1.34", optional = true } | ||
attrs = { version = "^21.4.0", optional = true } | ||
|
||
# Docs: development and build dependencies | ||
sphinx = { version = "~= 4.0", optional = true } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '1.2.1' | ||
__version__ = '1.3.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import typing as t | ||
|
||
InterpretersSequence = t.Sequence[str] | ||
|
||
|
||
# TODO Improvement: use an Enum | ||
# SUPPORTED = { | ||
# 'py35', | ||
# 'py36', | ||
# 'py37', | ||
# 'py38', | ||
# 'py39', | ||
# 'py310', | ||
# 'py311', | ||
# } | ||
|
||
SUPPORTED = { | ||
'3.5', | ||
'3.6', | ||
'3.7', | ||
'3.8', | ||
'3.9', | ||
'3.10', | ||
'3.11', | ||
} | ||
|
||
|
||
def verify_input_interpreters(interpreters: InterpretersSequence) -> None: | ||
user_interpreters_set = set(interpreters) | ||
if len(user_interpreters_set) != len(interpreters): | ||
raise InvalidInterpretersError("Found duplicate interpreters!") | ||
|
||
if not user_interpreters_set.issubset(SUPPORTED): | ||
# not all user requested interpreters are included in the supported ones | ||
raise InvalidInterpretersError( | ||
"Unsupported interpreter given Error!\n" | ||
+ "Given interpreters: [{given}]\n".format(given=', '.join(interpreters)) | ||
+ "Supported interpreters: [{supported}]\n".format(supported=', '.join(SUPPORTED)) | ||
+ "Unsupported interpreters: [{unsupported}]".format( | ||
unsupported=', '.join(iter(unsupported_interpreters(interpreters))) | ||
) | ||
) | ||
|
||
|
||
def unsupported_interpreters(interpreters: InterpretersSequence) -> t.Iterator[str]: | ||
for interpreter in interpreters: | ||
if interpreter not in SUPPORTED: | ||
yield interpreter | ||
|
||
|
||
class InvalidInterpretersError(Exception): | ||
pass |
Oops, something went wrong.