Skip to content

Commit 4b3e42a

Browse files
authored
Merge pull request #119 from EricCousineau-TRI/feature-venv
install: Expose test + docs requirements, encourage use of virtualenv
2 parents 486bc4d + 62d6d13 commit 4b3e42a

File tree

7 files changed

+42
-11
lines changed

7 files changed

+42
-11
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,12 @@ jobs:
8383
- name: Setup castxml config
8484
if: matrix.compiler == 'gcc' && matrix.version == '7'
8585
run: mv unittests/configs/gcc7.cfg unittests/xml_generator.cfg;
86-
- name: Setup Python test libs
86+
- name: Install Python lib and test libs
8787
run: |
88-
pip install coveralls
89-
pip install coverage
90-
pip install pycodestyle
88+
pip install .[test]
9189
- name: Run tests
9290
run: |
9391
export PATH=~/castxml/bin:$PATH
94-
python setup.py install
9592
coverage run -m unittests.test_all
9693
coverage combine
9794
- name: Upload coverage to Codecov

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ docs/examples/caching/example.hpp.xml
1616
test_cost.log
1717
docs/apidocs
1818
htmlcov
19+
/venv/

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# documentation root, use os.path.abspath to make it absolute, like shown here.
2323
sys.path.insert(0, os.path.abspath('.') + "/../")
2424

25-
from ..release_utils import utils # nopep8
25+
from release_utils import utils # nopep8
2626

2727
# -- General configuration ------------------------------------------------
2828

docs/documentation.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ Building the documentation locally
77
You can build the documentation yourself. In order for this to work you need
88
sphinx doc (http://sphinx-doc.org) and the readthedocs theme:
99

10-
pip install sphinx
10+
.. code-block:: shell
1111
12-
pip install sphinx_rtd_theme
12+
pip install .[docs]
1313
1414
Then just run the following command in the root folder:
1515

16+
.. code-block:: shell
17+
1618
make html
1719
18-
This will build the documentation locally in the `docs/_build/html` folder.
20+
This will build the documentation locally in the ``docs/_build/html`` folder.
1921

2022
For each commit on the master and develop branches, the documentation is
2123
automatically built and can be found here: https://readthedocs.org/projects/pygccxml/

docs/install.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,28 @@ Installation of pygccxml
1818

1919
You can use pip to install pygccxml:
2020

21-
pip install pygccxml
21+
.. code-block:: shell
22+
23+
pip install pygccxml
2224
2325
To install from source, you can use the usual procedure:
2426

27+
.. code-block:: shell
28+
2529
python setup.py install
2630
31+
For development
32+
%%%%%%%%%%%%%%%
33+
34+
You should use a ``virtualenv`` when possible. Example recipe:
35+
36+
.. code-block:: shell
37+
38+
cd pygccxml # git root
39+
python -m virtualenv ./venv
40+
source ./venv/bin/activate
41+
pip install --editable .[test]
42+
2743
GCC-XML (Legacy)
2844
----------------
2945

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99

1010
version = utils.find_version("../pygccxml/__init__.py")
1111

12+
requirements_test = {
13+
"coverage",
14+
"coveralls",
15+
"pycodestyle",
16+
}
17+
requirements_docs = {
18+
"sphinx",
19+
"sphinx_rtd_theme",
20+
}
21+
1222
setup(name="pygccxml",
1323
version=version,
1424
author="Roman Yakovenko",
@@ -25,6 +35,10 @@
2535
"pygccxml.declarations",
2636
"pygccxml.parser",
2737
"pygccxml.utils"],
38+
extras_require={
39+
"test": list(requirements_test),
40+
"docs": list(requirements_docs),
41+
},
2842
classifiers=[
2943
"Development Status :: 5 - Production/Stable",
3044
"Environment :: Console",

unittests/pep8_tester.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
# See http://www.boost.org/LICENSE_1_0.txt
55

66
import os
7-
import pycodestyle
87
import unittest
98
import fnmatch
109

10+
import pycodestyle
11+
1112

1213
class Test(unittest.TestCase):
1314

0 commit comments

Comments
 (0)