Skip to content

Commit 7e19daa

Browse files
authored
move black dependency to an extra (#449)
1 parent 8b15f05 commit 7e19daa

File tree

7 files changed

+47
-28
lines changed

7 files changed

+47
-28
lines changed

.github/workflows/ci-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
source .env/bin/activate && \
8888
python -m pip install --upgrade pip wheel setuptools && \
8989
python -m pip install -r mypy-requirements.txt -r requirements.txt && \
90-
MYPYPATH=typeshed SCHEMA_SALAD_USE_MYPYC=1 pip install -e . && \
90+
MYPYPATH=typeshed SCHEMA_SALAD_USE_MYPYC=1 pip install -e .[pycodegen] && \
9191
deactivate'
9292
- name: Test with pytest
9393
run: |
@@ -96,7 +96,7 @@ jobs:
9696
bash -exc '\
9797
source .env/bin/activate && \
9898
pip install setuptools wheel -r test-requirements.txt && \
99-
make mypyc
99+
make test
100100
deactivate'
101101
102102
tox-style:

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
MODULE=schema_salad
2424
PACKAGE=schema-salad
25+
EXTRAS=[pycodegen]
2526

2627
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2728
# `[[` conditional expressions.
@@ -52,11 +53,11 @@ install-dependencies: FORCE
5253

5354
## install : install the ${MODULE} module and schema-salad-tool
5455
install: FORCE
55-
pip install .
56+
pip install .$(EXTRAS)
5657

5758
## dev : install the ${MODULE} module in dev mode
5859
dev: install-dep
59-
pip install -e .
60+
pip install -e .$(EXTRAS)
6061

6162
## dist : create a module package for distribution
6263
dist: dist/${MODULE}-$(VERSION).tar.gz

README.rst

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,42 @@ Web.
2222

2323
The Schema Salad library is Python 3.6+ only.
2424

25-
Usage
26-
-----
25+
Installation
26+
------------
2727

2828
::
2929

30-
$ pip install schema_salad
30+
pip3 install schema_salad
31+
32+
If you intend to use the `schema-salad-tool --codegen=python` feature, please
33+
include the `[pycodegen]` extra::
34+
35+
pip3 install schema_salad[pycodegen]
3136

3237
To install from source::
3338

34-
git clone https://github.com/common-workflow-language/schema_salad
35-
cd schema_salad
36-
python3 setup.py install
39+
git clone https://github.com/common-workflow-language/schema_salad
40+
cd schema_salad
41+
pip3 install .
42+
# or pip3 install .[pycodegen] if needed
3743

3844
Commands
3945
--------
4046

4147
Schema salad can be used as a command line tool or imported as a Python module::
4248

4349
$ schema-salad-tool
44-
usage: schema-salad-tool [-h] [--rdf-serializer RDF_SERIALIZER]
45-
[--print-jsonld-context | --print-rdfs | --print-avro
46-
| --print-rdf | --print-pre | --print-index
47-
| --print-metadata | --print-inheritance-dot
48-
| --print-fieldrefs-dot | --codegen language
49-
| --print-oneline]
50-
[--strict | --non-strict] [--verbose | --quiet
51-
| --debug]
52-
[--version]
50+
usage: schema-salad-tool [-h] [--rdf-serializer RDF_SERIALIZER] [--skip-schemas]
51+
[--strict-foreign-properties] [--print-jsonld-context]
52+
[--print-rdfs] [--print-avro] [--print-rdf] [--print-pre]
53+
[--print-index] [--print-metadata] [--print-inheritance-dot]
54+
[--print-fieldrefs-dot] [--codegen language] [--codegen-target CODEGEN_TARGET]
55+
[--codegen-examples directory] [--codegen-package dotted.package]
56+
[--codegen-copyright copyright_string] [--print-oneline]
57+
[--print-doc] [--strict | --non-strict]
58+
[--verbose | --quiet | --debug] [--only ONLY] [--redirect REDIRECT]
59+
[--brand BRAND] [--brandlink BRANDLINK] [--brandstyle BRANDSTYLE]
60+
[--brandinverse] [--primtype PRIMTYPE] [--version]
5361
[schema] [document]
5462

5563
$ python
@@ -75,7 +83,8 @@ Convert a document to JSON-LD::
7583

7684
$ schema-salad-tool --print-pre myschema.yml mydocument.yml > mydocument.jsonld
7785

78-
Generate Python classes for loading/generating documents described by the schema::
86+
Generate Python classes for loading/generating documents described by the schema
87+
(Requires the `[pycodegen]` extra)::
7988

8089
$ schema-salad-tool --codegen=python myschema.yml > myschema.py
8190

release-test.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export LC_ALL=C
77

88
package=schema-salad
99
module=schema_salad
10+
extras="[pycodegen]"
1011

1112
if [ "$GITHUB_ACTIONS" = "true" ]; then
1213
# We are running as a GH Action
@@ -34,7 +35,7 @@ then
3435
rm -f testenv1/lib/python-wheels/setuptools* \
3536
&& pip install --force-reinstall -U pip==${pipver} \
3637
&& pip install setuptools==${setuptoolsver} wheel
37-
pip install -rtest-requirements.txt .
38+
pip install -rtest-requirements.txt ".${extras}"
3839
make test
3940
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
4041
mkdir testenv1/not-${module}
@@ -60,7 +61,7 @@ rm -f lib/python-wheels/setuptools* \
6061
&& pip install --force-reinstall -U pip==${pipver} \
6162
&& pip install setuptools==${setuptoolsver} wheel
6263
# The following can fail if you haven't pushed your commits to ${repo}
63-
pip install -e "git+${repo}@${HEAD}#egg=${package}"
64+
pip install -e "git+${repo}@${HEAD}#egg=${package}${extras}"
6465
pushd src/${package}
6566
pip install -rtest-requirements.txt
6667
make dist
@@ -84,7 +85,7 @@ rm -f lib/python-wheels/setuptools* \
8485
&& pip install setuptools==${setuptoolsver} wheel
8586
package_tar=$(find . -name "${package}*tar.gz")
8687
pip install "-r${DIR}/test-requirements.txt"
87-
pip install "${package_tar}"
88+
pip install "${package_tar}${extras}"
8889
mkdir out
8990
tar --extract --directory=out -z -f ${package}*.tar.gz
9091
pushd out/${package}*
@@ -108,7 +109,7 @@ source bin/activate
108109
rm -f lib/python-wheels/setuptools* \
109110
&& pip install --force-reinstall -U pip==${pipver} \
110111
&& pip install setuptools==${setuptoolsver} wheel
111-
pip install ${module}*.whl
112+
pip install "$(ls ${module}*.whl)${extras}"
112113
pip install "-r${DIR}/test-requirements.txt"
113114
mkdir not-${module}
114115
pushd not-${module}

schema_salad/python_codegen_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Template code used by python_codgen.py."""
1+
"""Template code used by python_codegen.py."""
22
import copy
33
import os
44
import pathlib

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@
8282
"mistune >= 0.8.1, < 0.9",
8383
"CacheControl >= 0.11.7, < 0.13",
8484
"lockfile >= 0.9", # needed for CacheControl's FileCache
85-
"black",
8685
]
8786

8887
extras_require = {
8988
"docs": ["sphinx >= 2.2", "sphinx-rtd-theme", "pytest < 7"],
89+
"pycodegen": ["black"],
9090
}
9191

9292
setup(

tox.ini

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ envlist =
77
py39-lint-readme,
88
py39-pydocstyle
99

10-
skipsdist = True
1110
skip_missing_interpreters = True
1211

1312
[pytest]
@@ -35,7 +34,7 @@ passenv =
3534
CI
3635
GITHUB_*
3736
deps =
38-
py{36,37,38,39,310}-{unit,lint,bandit,mypy}: -rrequirements.txt
37+
py{36,37,38,39,310}-{unit,mypy}: -rrequirements.txt
3938
py{36,37,38,39,310}-{unit,mypy}: -rtest-requirements.txt
4039
py{36,37,38,39,310}-lint: flake8-bugbear
4140
py{36,37,38,39,310}-lint: black
@@ -59,12 +58,20 @@ whitelist_externals =
5958
py{36,37,38,39,310}-lint: black
6059
py{36,37,38,39,310}-{mypy,shellcheck,lint,unit}: make
6160

61+
skip_install =
62+
py{36,37,38,39,310}-lint: true
63+
py{36,37,38,39,310}-bandit: true
64+
65+
extras =
66+
py{36,37,38,39,310}-unit: pycodegen
67+
6268
[testenv:py39-pydocstyle]
6369
whitelist_externals = make
6470
commands = make diff_pydocstyle_report
6571
deps =
6672
pydocstyle
6773
diff-cover
74+
skip_install = true
6875

6976
[testenv:py39-lint-readme]
7077
commands =
@@ -75,3 +82,4 @@ deps =
7582
twine
7683
wheel
7784
readme_renderer[md]
85+
skip_install = true

0 commit comments

Comments
 (0)