Skip to content

Commit

Permalink
Merge pull request #112 from ritchie46/moveMatplotlibExtrasRequirement
Browse files Browse the repository at this point in the history
Move matplotlib to extras_require, to make headless installs possible
  • Loading branch information
smith120bh authored Jan 11, 2023
2 parents f31fc3d + 897e851 commit 3605348
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r plot_requirements.txt
pip install -r test_requirements.txt
- name: Run linting check with pylint
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r plot_requirements.txt
pip install -r test_requirements.txt
- name: Run linting check with pylint
run: |
Expand Down
5 changes: 4 additions & 1 deletion anastruct/fem/plotter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from .mpl import Plotter
try:
from .mpl import Plotter
except ImportError:
from .null import Plotter # type: ignore
from .values import PlottingValues
10 changes: 10 additions & 0 deletions anastruct/fem/plotter/null.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from anastruct.fem.plotter.values import PlottingValues


class Plotter(PlottingValues):
def __init__(self, system, mesh):
super(Plotter, self).__init__(system, mesh)
self.system = system
self.one_fig = None
self.max_q = 0
self.max_system_point_load = 0
8 changes: 6 additions & 2 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ You can install anaStruct with pip!

::

$ pip install anastruct[plot]

Or if you would like a headless version of anaStruct (with no plotting abilities), you can do that too.

::
$ pip install anastruct

It takes a while before new features are added in the official PyPI index. So if you want the latest features,
install from github.
Finally, while updates are made regularly on PyPI, if you'd like the bleeding edge newest features and fixes, or if you'd like to contribute to the development of anaStruct, then install from github.

::

Expand Down
3 changes: 2 additions & 1 deletion doc/source/plotting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Plotting
The SystemElements object implements several plotting methods for retrieving standard plotting results. Every plotting
method has got the same parameters. The plotter is based on a Matplotlib backend and it is possible to get the figure
and do modifications of your own. The x and y coordinates of the model should all be positive value for the plotter
to work properly.
to work properly.

Note that plotting capabilities do require that anaStruct be installed with the "plot" sub-module (e.g. `pip install anastruct[plot]` )

Structure
#########
Expand Down
1 change: 1 addition & 0 deletions plot_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
matplotlib==3.5.3
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
matplotlib==3.5.3
numpy>=1.15
scipy>=1.1.0

3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def read_file(file):

long_description = read_file("README.md")
requirements = read_requirements("requirements.txt")
plot_requirements = read_requirements("plot_requirements.txt")
test_requirements = read_requirements("test_requirements.txt")
__version__ = "0"
exec(read_file("anastruct/_version.py")) # pylint: disable=exec-used

Expand Down Expand Up @@ -51,5 +53,6 @@ def read_file(file):
],
package_data={"anastruct.sectionbase": ["data/*.xml"]},
install_requires=requirements,
extras_require={"plot": plot_requirements, "test": test_requirements},
ext_modules=em,
)

0 comments on commit 3605348

Please sign in to comment.