Codebase list numpy-stl / upstream/2.10.0+git20190430.4c6f1ba
Import upstream version 2.10.0+git20190430.4c6f1ba, md5 bef3b56ebd88accbfad984dc06852a84 Debian Janitor 5 years ago
7 changed file(s) with 94 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
3535 Write Documentation
3636 ~~~~~~~~~~~~~~~~~~~
3737
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,
4040 articles, and such.
4141
4242 Submit Feedback
00 numpy-stl
11 ==============================================================================
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
217
318 Simple library to make working with STL files (and 3D objects in general) fast
419 and easy.
115130 data['vectors'][1] = numpy.array([[1, 0, 1],
116131 [0, 1, 1],
117132 [1, 1, 1]])
118 # Right face
133 # Front face
119134 data['vectors'][2] = numpy.array([[1, 0, 0],
120135 [1, 0, 1],
121136 [1, 1, 0]])
194209 data['vectors'][1] = numpy.array([[1, 0, 1],
195210 [0, 1, 1],
196211 [1, 1, 1]])
197 # Right face
212 # Front face
198213 data['vectors'][2] = numpy.array([[1, 0, 0],
199214 [1, 0, 1],
200215 [1, 1, 0]])
44 import warnings
55 from setuptools import setup, extension
66 from setuptools.command.build_ext import build_ext
7 from setuptools.command.test import test as TestCommand
78
89 setup_kwargs = {}
910
2223 sys.exit(1)
2324 except ImportError:
2425 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)
2539
2640
2741 if sys.version_info.major == 2 or sys.platform.lower() != 'win32':
6781 install_requires.append('enum34')
6882
6983
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']
7685
7786
7887 class BuildExt(build_ext):
100109 packages=['stl'],
101110 long_description=long_description,
102111 tests_require=tests_require,
103 setup_requires=setup_requires,
104112 entry_points={
105113 'console_scripts': [
106114 'stl = %s.main:main' % about['__import_name__'],
108116 'stl2bin = %s.main:to_binary' % about['__import_name__'],
109117 ],
110118 },
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 ],
112135 install_requires=install_requires,
113136 cmdclass=dict(
114137 build_ext=BuildExt,
138 test=PyTest,
115139 ),
116140 **setup_kwargs
117141 )
00 __package_name__ = 'numpy-stl'
11 __import_name__ = 'stl'
2 __version__ = '2.8.0'
2 __version__ = '2.10.1'
33 __author__ = 'Rick van Hattem'
44 __author_email__ = 'Wolph@Wol.ph'
55 __description__ = ' '.join('''
326326
327327 @classmethod
328328 def from_multi_file(cls, filename, calculate_normals=True, fh=None,
329 mode=ASCII, speedups=True, **kwargs):
329 mode=Mode.ASCII, speedups=True, **kwargs):
330330 '''Load multiple meshes from a STL file
331331
332332 Note: mode is hardcoded to ascii since binary stl files do not support
356356 if close:
357357 fh.close()
358358
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
359384
360385 StlMesh = BaseStl.from_file
361386
6161 if not speedups:
6262 pytest.skip('Only makes sense with speedups')
6363
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
6468 try:
6569 from PySide2 import QtWidgets
6670 except ImportError:
6060 assert i == 9
6161
6262
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