Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow numbers in project_shortname #144

Merged
merged 4 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ jobs:
pytest
when: always

python-2.7:
<<: *test-template
docker:
- image: circleci/python:2.7-stretch-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB

python-3.7-install-test:
docker:
- image: circleci/python:3.7-stretch-node-browsers
Expand Down Expand Up @@ -112,7 +104,5 @@ workflows:
jobs:
- python-3.6:
context: dash-docker-hub
- python-2.7:
context: dash-docker-hub
- python-3.7-install-test:
context: dash-docker-hub
16 changes: 4 additions & 12 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function
import sys
import re

full_name = '{{cookiecutter.author_name}}'
email = '{{cookiecutter.author_email}}'
Expand All @@ -9,7 +10,7 @@
project_shortname_message = '''
({variable}={value}) should be a valid Python package name.

Only lowercase letters and `_` are allowed.
Only lowercase letters, numbers, and `_` are allowed, and the name must start with a non-numeric character.
'''


Expand All @@ -23,18 +24,9 @@ def verify(check, variable_name, value, message):
def package_check(s):
return '(For package.json)' in s


def _check_specials_characters(s):
i = ord(s)
if i == 95:
# Allow for `_`
return False
return not 96 < i < 123


def check_specials_characters(s):
return any(_check_specials_characters(x) for x in s)

pattern = re.compile("^[a-z_][a-z_0-9]*")
return not pattern.fullmatch(s)

for values in (
(package_check, 'author_name', full_name, invalid_package_message),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_install(cookies, dash_duo):
['Project.toml'],
['deps', 'test_component.min.js'],
['deps', 'test_component.min.js.map'],
['src', 'dash_testcomponent.jl'],
['src', 'jl', 'dash_testcomponent.jl'],
['src', 'TestComponent.jl'],
]

Expand Down