Import upstream version 2.10.0+git20190430.4c6f1ba, md5 bef3b56ebd88accbfad984dc06852a84
Debian Janitor
5 years ago
35 | 35 | Write Documentation |
36 | 36 | ~~~~~~~~~~~~~~~~~~~ |
37 | 37 | |
38 | Python Progressbar could always use more documentation, whether as part of the | |
39 | official Python Progressbar docs, in docstrings, or even on the web in blog posts, | |
38 | numpy-stl could always use more documentation, whether as part of the | |
39 | official numpy-stl docs, in docstrings, or even on the web in blog posts, | |
40 | 40 | articles, and such. |
41 | 41 | |
42 | 42 | Submit Feedback |
0 | 0 | numpy-stl |
1 | 1 | ============================================================================== |
2 | ||
3 | ||
4 | .. image:: https://travis-ci.org/WoLpH/numpy-stl.svg?branch=master | |
5 | :alt: numpy-stl test status | |
6 | :target: https://travis-ci.org/WoLpH/numpy-stl | |
7 | ||
8 | .. image:: https://badge.fury.io/py/mt-940.svg | |
9 | :alt: numpy-stl Pypi version | |
10 | :target: https://pypi.python.org/pypi/mt-940 | |
11 | ||
12 | .. image:: https://coveralls.io/repos/WoLpH/numpy-stl/badge.svg?branch=master | |
13 | :alt: numpy-stl code coverage | |
14 | :target: https://coveralls.io/r/WoLpH/numpy-stl?branch=master | |
15 | ||
16 | .. image:: https://img.shields.io/pypi/pyversions/mt-940.svg | |
2 | 17 | |
3 | 18 | Simple library to make working with STL files (and 3D objects in general) fast |
4 | 19 | and easy. |
115 | 130 | data['vectors'][1] = numpy.array([[1, 0, 1], |
116 | 131 | [0, 1, 1], |
117 | 132 | [1, 1, 1]]) |
118 | # Right face | |
133 | # Front face | |
119 | 134 | data['vectors'][2] = numpy.array([[1, 0, 0], |
120 | 135 | [1, 0, 1], |
121 | 136 | [1, 1, 0]]) |
194 | 209 | data['vectors'][1] = numpy.array([[1, 0, 1], |
195 | 210 | [0, 1, 1], |
196 | 211 | [1, 1, 1]]) |
197 | # Right face | |
212 | # Front face | |
198 | 213 | data['vectors'][2] = numpy.array([[1, 0, 0], |
199 | 214 | [1, 0, 1], |
200 | 215 | [1, 1, 0]]) |
4 | 4 | import warnings |
5 | 5 | from setuptools import setup, extension |
6 | 6 | from setuptools.command.build_ext import build_ext |
7 | from setuptools.command.test import test as TestCommand | |
7 | 8 | |
8 | 9 | setup_kwargs = {} |
9 | 10 | |
22 | 23 | sys.exit(1) |
23 | 24 | except ImportError: |
24 | 25 | pass |
26 | ||
27 | ||
28 | class PyTest(TestCommand): | |
29 | def finalize_options(self): | |
30 | TestCommand.finalize_options(self) | |
31 | self.test_args = [] | |
32 | self.test_suite = True | |
33 | ||
34 | def run_tests(self): | |
35 | # import here, cause outside the eggs aren't loaded | |
36 | import pytest | |
37 | errno = pytest.main(self.test_args) | |
38 | sys.exit(errno) | |
25 | 39 | |
26 | 40 | |
27 | 41 | if sys.version_info.major == 2 or sys.platform.lower() != 'win32': |
67 | 81 | install_requires.append('enum34') |
68 | 82 | |
69 | 83 | |
70 | if os.environ.get('PYTEST_RUNNER', '').lower() == 'false': | |
71 | tests_require = [] | |
72 | setup_requires = [] | |
73 | else: | |
74 | tests_require = ['pytest'] | |
75 | setup_requires = ['pytest-runner'] | |
84 | tests_require = ['pytest'] | |
76 | 85 | |
77 | 86 | |
78 | 87 | class BuildExt(build_ext): |
100 | 109 | packages=['stl'], |
101 | 110 | long_description=long_description, |
102 | 111 | tests_require=tests_require, |
103 | setup_requires=setup_requires, | |
104 | 112 | entry_points={ |
105 | 113 | 'console_scripts': [ |
106 | 114 | 'stl = %s.main:main' % about['__import_name__'], |
108 | 116 | 'stl2bin = %s.main:to_binary' % about['__import_name__'], |
109 | 117 | ], |
110 | 118 | }, |
111 | classifiers=['License :: OSI Approved :: BSD License'], | |
119 | classifiers=[ | |
120 | 'Development Status :: 6 - Mature', | |
121 | 'Intended Audience :: Developers', | |
122 | 'License :: OSI Approved :: BSD License', | |
123 | 'Operating System :: OS Independent', | |
124 | 'Natural Language :: English', | |
125 | 'Programming Language :: Python', | |
126 | 'Programming Language :: Python :: 2', | |
127 | 'Programming Language :: Python :: 2.7', | |
128 | 'Programming Language :: Python :: 3', | |
129 | 'Programming Language :: Python :: 3.4', | |
130 | 'Programming Language :: Python :: 3.5', | |
131 | 'Programming Language :: Python :: 3.6', | |
132 | 'Programming Language :: Python :: 3.7', | |
133 | 'Topic :: Software Development :: Libraries :: Python Modules', | |
134 | ], | |
112 | 135 | install_requires=install_requires, |
113 | 136 | cmdclass=dict( |
114 | 137 | build_ext=BuildExt, |
138 | test=PyTest, | |
115 | 139 | ), |
116 | 140 | **setup_kwargs |
117 | 141 | ) |
0 | 0 | __package_name__ = 'numpy-stl' |
1 | 1 | __import_name__ = 'stl' |
2 | __version__ = '2.8.0' | |
2 | __version__ = '2.10.1' | |
3 | 3 | __author__ = 'Rick van Hattem' |
4 | 4 | __author_email__ = 'Wolph@Wol.ph' |
5 | 5 | __description__ = ' '.join(''' |
326 | 326 | |
327 | 327 | @classmethod |
328 | 328 | def from_multi_file(cls, filename, calculate_normals=True, fh=None, |
329 | mode=ASCII, speedups=True, **kwargs): | |
329 | mode=Mode.ASCII, speedups=True, **kwargs): | |
330 | 330 | '''Load multiple meshes from a STL file |
331 | 331 | |
332 | 332 | Note: mode is hardcoded to ascii since binary stl files do not support |
356 | 356 | if close: |
357 | 357 | fh.close() |
358 | 358 | |
359 | @classmethod | |
360 | def from_files(cls, filenames, calculate_normals=True, mode=Mode.AUTOMATIC, | |
361 | speedups=True, **kwargs): | |
362 | '''Load multiple meshes from a STL file | |
363 | ||
364 | Note: mode is hardcoded to ascii since binary stl files do not support | |
365 | the multi format | |
366 | ||
367 | :param list(str) filenames: The files to load | |
368 | :param bool calculate_normals: Whether to update the normals | |
369 | :param file fh: The file handle to open | |
370 | :param dict kwargs: The same as for :py:class:`stl.mesh.Mesh` | |
371 | ''' | |
372 | meshes = [] | |
373 | for filename in filenames: | |
374 | meshes.append(cls.from_file( | |
375 | filename, | |
376 | calculate_normals=calculate_normals, | |
377 | mode=mode, | |
378 | speedups=speedups, | |
379 | **kwargs)) | |
380 | ||
381 | data = numpy.concatenate([mesh.data for mesh in meshes]) | |
382 | return cls(data, calculate_normals=calculate_normals, **kwargs) | |
383 | ||
359 | 384 | |
360 | 385 | StlMesh = BaseStl.from_file |
361 | 386 |
61 | 61 | if not speedups: |
62 | 62 | pytest.skip('Only makes sense with speedups') |
63 | 63 | |
64 | venv = os.environ.get('VIRTUAL_ENV', '') | |
65 | if (3, 6) == sys.version_info[:2] and venv.startswith('/home/travis/'): | |
66 | pytest.skip('PySide2/PyQt5 tests are broken on Travis Python 3.6') | |
67 | ||
64 | 68 | try: |
65 | 69 | from PySide2 import QtWidgets |
66 | 70 | except ImportError: |
60 | 60 | assert i == 9 |
61 | 61 | |
62 | 62 | |
63 | def test_multiple_stl_files(tmpdir, speedups): | |
64 | tmp_file = tmpdir.join('tmp.stl') | |
65 | with tmp_file.open('wb+') as fh: | |
66 | fh.write(_STL_FILE) | |
67 | fh.seek(0) | |
68 | ||
69 | filenames = [str(tmp_file)] * 10 | |
70 | ||
71 | m = mesh.Mesh.from_files(filenames, speedups=speedups) | |
72 | assert m.data.size == 10 | |
73 | ||
74 |