Skip to content

Commit ce38a5e

Browse files
committed
Add optional packages into setup.py extra_requires
In particular ujson. `pip install mathicsscript[full]` will include everything
1 parent 8f6742a commit ce38a5e

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

.github/workflows/osx.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25+
pip install -e .
2526
- name: Install Mathics Scanner
2627
run: |
2728
make
2829
- name: Test Mathics Scanner
2930
run: |
30-
pip install -r requirement-dev.txt
31+
pip install -r requirements-dev.txt
32+
pip install -r requirements-extra.txt
3133
python -m mathics_scanner.generate.build_tables
3234
make check

.github/workflows/ubuntu.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24+
pip install -e .
2425
- name: Install Mathics_Scanner
2526
run: |
2627
make
2728
- name: Test Mathics Scanner
2829
run: |
29-
pip install -r requirement-dev.txt
30+
pip install -r requirements-dev.txt
31+
pip install -r requirements-extra.txt
3032
python -m mathics_scanner.generate.build_tables
3133
make check

.github/workflows/windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25+
pip install -e .
2526
- name: Install Mathics_Scanner
2627
run: |
2728
python setup.py install
2829
- name: Test Mathics
2930
run: |
3031
pip install -r requirements-dev.txt
32+
pip install -r requirements-extra.txt
3133
python mathics_scanner/generate/build_tables.py
3234
py.test test

requirements-dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
pytest
2-
# ujson is optional
3-
ujson

requirements-extra.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Optional packages which add functionality or speed things up
2+
ujson

setup.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
[email protected] and ask for help.
2626
"""
2727

28+
import re
2829
import sys
2930
import os.path as osp
3031
import platform
31-
import subprocess
32-
from setuptools import setup, Command, Extension
32+
from setuptools import setup
3333

3434
# Ensure user has the correct Python version
3535
if sys.version_info < (3, 6):
@@ -62,11 +62,22 @@ def read(*rnames):
6262
# General Requirements
6363
INSTALL_REQUIRES = [
6464
"chardet", # Used in mathics_scanner.feed
65-
# "ujson", # Used in mathics_scanner.characters
65+
"PyYAML", # Used in mathics-generate-json-table
66+
# "ujson", # Optional Used in mathics_scanner.characters
6667
"click", # Usin in CLI: mathics-generate-json-table
6768
]
6869

6970

71+
extra_requires = []
72+
for line in open("requirements-extra.txt").read().split("\n"):
73+
if line and not line.startswith("#"):
74+
requires = re.sub(r"([^#]+)(\s*#.*$)?", r"\1", line)
75+
extra_requires.append(requires)
76+
77+
EXTRA_REQUIRES = {
78+
"full": extra_requires
79+
}
80+
7081
def subdirs(root, file="*.*", depth=10):
7182
for k in range(depth):
7283
yield root + "*/" * k + file
@@ -80,6 +91,7 @@ def subdirs(root, file="*.*", depth=10):
8091
"mathics_scanner.generate",
8192
],
8293
install_requires=INSTALL_REQUIRES,
94+
extra_requires=EXTRA_REQUIRES,
8395
entry_points={
8496
"console_scripts": [
8597
"mathics-generate-json-table=mathics_scanner.generate.build_tables:main"

0 commit comments

Comments
 (0)