Skip to content

Commit

Permalink
Merge pull request #144 from plotly/fix-module-name-check
Browse files Browse the repository at this point in the history
Allow numbers in project_shortname
  • Loading branch information
LiamConnors authored May 26, 2022
2 parents 6dfd190 + b60fe1e commit c0bc329
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
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

0 comments on commit c0bc329

Please sign in to comment.