Skip to content

Commit af78423

Browse files
committed
cleanup
1 parent 3294c29 commit af78423

File tree

6 files changed

+29
-38
lines changed

6 files changed

+29
-38
lines changed

.codecov.yml

-2
This file was deleted.

.readthedocs.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ sphinx:
2727
python:
2828
install:
2929
- requirements: docs/requirements.txt
30-
- requirements: test/requirements.txt
3130
- method: pip
3231
path: .

.travis.yml

-17
This file was deleted.

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ You should check you haven't broken anything by running the test suite:
5656

5757
```shell
5858
pip install ".[test]" .
59-
pip install pytest coverage pycodestyle
6059
coverage run -m pytest --doctest-modules --pycodestyle
6160
coverage report -m discopy/*.py discopy/*/*.py
6261
```
@@ -66,7 +65,7 @@ The documentation is built using
6665
You can build it locally with:
6766

6867
```shell
69-
pip install -r docs/requirements.txt
68+
pip install ".[docs]" .
7069
sphinx-build docs docs/_build/html
7170
```
7271

setup.py

+25-16
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,28 @@
66
from re import search, M
77
from setuptools import setup, find_packages
88

9-
with open('discopy/__init__.py', 'r') as file:
10-
MATCH = search(r"^__version__ = ['\"]([^'\"]*)['\"]", file.read(), M)
11-
if MATCH:
12-
VERSION = MATCH.group(1)
13-
else:
14-
raise RuntimeError("Unable to find version string.")
9+
def get_version(filename="discopy/__init__.py",
10+
pattern=r"^__version__ = ['\"]([^'\"]*)['\"]"):
11+
with open(filename, 'r') as file:
12+
MATCH = search(pattern, file.read(), M)
13+
if MATCH:
14+
return MATCH.group(1)
15+
else:
16+
raise RuntimeError("Unable to find version string.")
1517

16-
try:
17-
with open('test/requirements.txt', 'r') as file:
18-
TEST_REQ = [line.strip() for line in file.readlines()]
19-
except FileNotFoundError:
20-
from warnings import warn
21-
warn("test/requirements.txt not found")
22-
TEST_REQ = []
18+
VERSION = get_version()
19+
20+
def get_reqs(filename):
21+
try:
22+
with open(filename, 'r') as file:
23+
return [line.strip() for line in file.readlines()]
24+
except FileNotFoundError:
25+
from warnings import warn
26+
warn("{} not found".format(filename))
27+
return []
28+
29+
TEST_REQS = get_reqs("test/requirements.txt")
30+
DOCS_REQS = get_reqs("docs/requirements.txt")
2331

2432
setup(name='discopy',
2533
version=VERSION,
@@ -36,8 +44,9 @@
3644
'{}.tar.gz'.format(VERSION),
3745
install_requires=[
3846
l.strip() for l in open('requirements.txt').readlines()],
39-
tests_require=TEST_REQ,
40-
extras_require={'test': TEST_REQ},
41-
data_file=[('test', ['test/requirements.txt'])],
47+
tests_require=TEST_REQS,
48+
extras_require={'test': TEST_REQS, 'docs': DOCS_REQS},
49+
data_file=[('test', ['test/requirements.txt']),
50+
('docs', ['docs/requirements.txt'])],
4251
python_requires='>=3',
4352
)

test/requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
pytest
2+
coverage
3+
pycodestyle
14
pytket==1.1.0
25
pyzx>=0.7.0
36
sympy==1.9

0 commit comments

Comments
 (0)