Skip to content

Commit c0bc329

Browse files
authored
Merge pull request #144 from plotly/fix-module-name-check
Allow numbers in project_shortname
2 parents 6dfd190 + b60fe1e commit c0bc329

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

.circleci/config.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ jobs:
4545
pytest
4646
when: always
4747

48-
python-2.7:
49-
<<: *test-template
50-
docker:
51-
- image: circleci/python:2.7-stretch-node-browsers
52-
auth:
53-
username: dashautomation
54-
password: $DASH_PAT_DOCKERHUB
55-
5648
python-3.7-install-test:
5749
docker:
5850
- image: circleci/python:3.7-stretch-node-browsers
@@ -112,7 +104,5 @@ workflows:
112104
jobs:
113105
- python-3.6:
114106
context: dash-docker-hub
115-
- python-2.7:
116-
context: dash-docker-hub
117107
- python-3.7-install-test:
118108
context: dash-docker-hub

hooks/pre_gen_project.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import print_function
22
import sys
3+
import re
34

45
full_name = '{{cookiecutter.author_name}}'
56
email = '{{cookiecutter.author_email}}'
@@ -9,7 +10,7 @@
910
project_shortname_message = '''
1011
({variable}={value}) should be a valid Python package name.
1112
12-
Only lowercase letters and `_` are allowed.
13+
Only lowercase letters, numbers, and `_` are allowed, and the name must start with a non-numeric character.
1314
'''
1415

1516

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

26-
27-
def _check_specials_characters(s):
28-
i = ord(s)
29-
if i == 95:
30-
# Allow for `_`
31-
return False
32-
return not 96 < i < 123
33-
34-
3527
def check_specials_characters(s):
36-
return any(_check_specials_characters(x) for x in s)
37-
28+
pattern = re.compile("^[a-z_][a-z_0-9]*")
29+
return not pattern.fullmatch(s)
3830

3931
for values in (
4032
(package_check, 'author_name', full_name, invalid_package_message),

tests/test_install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_install(cookies, dash_duo):
5959
['Project.toml'],
6060
['deps', 'test_component.min.js'],
6161
['deps', 'test_component.min.js.map'],
62-
['src', 'dash_testcomponent.jl'],
62+
['src', 'jl', 'dash_testcomponent.jl'],
6363
['src', 'TestComponent.jl'],
6464
]
6565

0 commit comments

Comments
 (0)