Skip to content

Commit 3d9e037

Browse files
committed
Merge branch 'main' into release/0.64
2 parents 1fefb56 + e395fbc commit 3d9e037

File tree

135 files changed

+4116
-1624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+4116
-1624
lines changed

.devcontainer/README.rst

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
3+
======================
4+
Develop on a container
5+
======================
6+
7+
This guide guides you on how to develop PyMAPDL features or fix bugs using
8+
a `remote container <https://code.visualstudio.com/docs/devcontainers/containers>`_
9+
or `Codespaces <https://github.com/features/codespaces>`_.
10+
The files for setting up the container can be found in the
11+
`.devcontainer directory <https://github.com/pyansys/pymapdl/tree/main/.devcontainer>`_.
12+
13+
About the MAPDL container
14+
=========================
15+
16+
Because MAPDL software is not open source, the GPL license does not allow to
17+
distribute a docker container to users.
18+
Having a docker container with MAPDL installed is a requirement to use
19+
any of the development methods mentioned on this section.
20+
If you want to build your own docker image, visit the following link
21+
:ref:`ref_make_container`.
22+
23+
24+
Develop on a remote container
25+
=============================
26+
27+
.. note:: If you are an Ansys employee or collaborator and want to use this development method, please email [email protected].
28+
29+
To use a `remote container <https://code.visualstudio.com/docs/devcontainers/containers>`_, you must install:
30+
31+
* `VS Code <https://code.visualstudio.com>`_
32+
* `Docker software <https://www.docker.com>`_ or equivalent.
33+
It is recommended to use Windows Subsystem Linux (WSL) backend to run Linux docker containers.
34+
See `Developing inside a Container Getting started <https://code.visualstudio.com/docs/devcontainers/containers#_getting-started>`_
35+
for more information.
36+
* `Remove Development VS Code extension pack <https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack>`_
37+
38+
As mentioned before, you must have your own Docker image with MAPDL installed locally available or hosted in an
39+
online registry, i.e. GitHub `ghcr.io <https://github.com/features/packages>`_.
40+
For the purpose of this document, assume your image is hosted at ``ghcr.io/myaccount/mapdlimage:mytag``.
41+
42+
You must then modify the file `docker-compose.yml <https://github.com/pyansys/pymapdl/tree/main/.devcontainer/docker-compose.yml>`_
43+
with your custom image:
44+
45+
.. code-block:: yaml
46+
:emphasize-lines: 4
47+
48+
ports:
49+
- '50052:50052'
50+
- '50055:50055'
51+
image: 'ghcr.io/myaccount/mapdlimage:mytag'
52+
user: "0:0"
53+
volumes:
54+
55+
56+
.. warning:: Also you might need to change some environment variables or Docker options to adjust to your image configuration.
57+
Be careful to not commit those changes in your PRs.
58+
59+
You can now open the current folder (or PyMAPDL repository) using
60+
``ctr/cmd`` + ``shift`` + ``p`` to open the VSCode *Command palette*.
61+
Then select ``Dev Containers: Open Folder in Container``.
62+
Because the configuration is available in ``.devcontainer`` directory, VS Code will automatically
63+
launch the MAPDL container with the desired configuration.
64+
65+
You can now work normally, but you will be, in fact, working from inside the container.
66+
Because VSCode mount the local directory into the docker container, you don't lose your changes if accidentally
67+
delete your container.
68+
However, this mounting process might have a significant impact on the container performance, especially noticeable
69+
if you are using MacOS.
70+
You can avoid that by cloning the repository inside the container.
71+
Visit `Quick start: Open a Git repository or GitHub PR in an isolated container volume <https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume>`_
72+
for more information.
73+
74+
75+
License
76+
-------
77+
78+
As mentioned before, you must have a valid license to run MAPDL.
79+
When you launch the container, the file ``script.sh`` automatically checks if the environment
80+
variable ``ANSYSLMD_LICENSE_FILE`` exists.
81+
This environment variable sets the port and IP address of the license server.
82+
83+
If you do not have set this environment variable before launching the container, you are prompt to enter
84+
your license server port and address.
85+
86+
You can set your license using the environment variable ``ANSYSLMD_LICENSE_FILE`` from the terminal before launching
87+
VS Code. This is recommended if you are using Windows OS.
88+
For example, if you have a license server at the address ``123.45.67.89``, you can set the license using:
89+
90+
.. code:: pwsh
91+
92+
$env:ANSYSLMD_LICENSE_FILE = '[email protected]'
93+
code . # launch VS Code
94+
95+
And then open the folder in the container using the *Command palette*.
96+
97+
98+
Develop on Codespaces
99+
=====================
100+
101+
Codespaces is a virtual delopment environment provided by GitHub.
102+
You can launch a container which all the required tools and start to work in couple of minutes.
103+
This is an easy way to get started with PyMAPDL development.
104+
105+
.. warning:: This method is only applicable and allowed to Ansys employees or collaborators.
106+
If you are an Ansys employee and wants use this development method, please email [email protected].

.devcontainer/devcontainer.json

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,53 @@
33
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
44
{
55
"name": "PyMAPDL Dev Container",
6-
76
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
87
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
98
"dockerComposeFile": [
109
"docker-compose.yml"
1110
],
12-
1311
// The 'service' property is the name of the service for the container that VS Code should
1412
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
1513
"service": "mapdldev",
16-
1714
// The optional 'workspaceFolder' property is the path VS Code should open by default when
1815
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
19-
"workspaceFolder": "/local"
20-
16+
"workspaceFolder": "/local",
2117
// Use 'forwardPorts' to make a list of ports inside the container available locally.
2218
// "forwardPorts": [],
23-
2419
// Uncomment the next line if you want start specific services in your Docker Compose config.
2520
// For example the license server service.
2621
// "runServices": ["license_server"],
27-
2822
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
2923
// "shutdownAction": "none",
30-
3124
// Uncomment the next line to run commands after the container is created - for example installing curl.
32-
// "postCreateCommand": "apt-get update && apt install git"
25+
"postCreateCommand": "/bin/bash ./.devcontainer/script.sh", //"'pkill -9 -f ansys_inc/v222/ansys'",
3326

3427
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
35-
// "remoteUser": "vscode"
28+
"remoteUser": "root",
29+
"updateRemoteUserUID": true,
30+
"customizations": {
31+
// Configure properties specific to Codespaces.
32+
"codespaces": {
33+
"openFiles": [
34+
".devcontainer/README.rst"
35+
]
36+
},
37+
"vscode": {
38+
"extensions": [
39+
"hbenl.vscode-test-explorer",
40+
"LittleFoxTeam.vscode-python-test-adapter",
41+
"ms-azuretools.vscode-docker",
42+
"ms-python.python",
43+
"ms-vscode-remote.remote-containers",
44+
"ms-vscode-remote.remote-ssh-edit",
45+
"ms-vscode-remote.remote-ssh",
46+
"ms-vscode-remote.remote-wsl",
47+
"ms-vscode-remote.vscode-remote-extensionpack",
48+
"ms-vscode.remote-explorer",
49+
"njpwerner.autodocstring",
50+
"VisualStudioExptTeam.vscodeintellicode",
51+
"yzhang.markdown-all-in-one",
52+
]
53+
}
54+
}
3655
}

.devcontainer/docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ services:
2727
- ANSYS_LOCK=OFF
2828
- AWP_ROOT222=/ansys_inc
2929
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}
30+
- PYANSYS_OFF_SCREEN=true
3031
ports:
3132
- '50052:50052'
3233
- '50055:50055'
3334
image: 'ghcr.io/pyansys/mapdl:v22.2-ubuntu'
35+
user: "0:0"
3436
volumes:
3537
# Update this to wherever you want VS Code to mount the folder of your project
36-
- ../:/local
38+
- ../:/local:cached
3739

3840
# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
3941
# - /var/run/docker.sock:/var/run/docker.sock
@@ -45,5 +47,5 @@ services:
4547
# - seccomp:unconfined
4648

4749
# Overrides default command so things don't shut down after the process ends.
48-
entrypoint: /bin/sh -c "echo 'Container is ready. You can now attach to it.'; while sleep 1000; do :; done"
49-
50+
entrypoint: /bin/bash -c "echo 'Container is ready. You can now attach to it.'; while sleep 10000; do :; done"
51+

.devcontainer/script.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
echo "Checking if the ANSYSLMD_LICENSE_FILE variable is defined"
4+
5+
if [[ -z "${ANSYSLMD_LICENSE_FILE}" ]]; then
6+
echo "ANSYSLMD_LICENSE_FILE is not defined."
7+
8+
# Read port
9+
read -p "Enter port (default is 1055): " port
10+
port=${port:-1055}
11+
12+
# Read license server ip
13+
read -p "Enter server (i.e. XXX.XX.XX.XX): " server
14+
15+
# Set env var for this terminal
16+
export ANSYSLMD_LICENSE_FILE="${server}:${port}"
17+
18+
# Storing env var in .bashrc file so it is automatically loaded.
19+
printf "\n%s\n" "ANSYSLMD_LICENSE_FILE=${port}@${server}" >> ~/.bashrc
20+
21+
# Activating the new configuration
22+
source ~/.bashrc
23+
24+
else
25+
echo "ANSYSLMD_LICENSE_FILE was found."
26+
echo "It is defined as ${ANSYSLMD_LICENSE_FILE}"
27+
fi
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 📖 Documentation issue
2+
description: Modifications to the documentation only
3+
title: "Modify ..."
4+
labels: ["documentation"]
5+
assignees: [""]
6+
7+
body:
8+
9+
- type: markdown
10+
attributes:
11+
value: '# 📝 **Modifications**'
12+
13+
- type: textarea
14+
id: modifications
15+
attributes:
16+
label: Description of the modifications
17+
placeholder: Describe what modification you propose and why it is useful for the project
18+
validations:
19+
required: true
20+
21+
- type: markdown
22+
attributes:
23+
value: '# 🔗 **References**'
24+
25+
- type: textarea
26+
id: references
27+
attributes:
28+
label: Useful links and references
29+
placeholder: A list of links and references to help when modifying the documentation
30+
validations:
31+
required: false
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: 🎓 Adding an example
2+
description: Proposing a new example for the library
3+
title: "Example proposal: ..."
4+
labels: ["example"]
5+
assignees: [""]
6+
7+
body:
8+
9+
- type: textarea
10+
id: example-description
11+
attributes:
12+
label: '📝 Description of the example'
13+
placeholder: Describe what example you devised and why it is useful for the project.
14+
15+
validations:
16+
required: true
17+
18+
- type: textarea
19+
id: example-files
20+
attributes:
21+
label: '📁 Files needed for running the example'
22+
placeholder: >
23+
Drag and drop the files used in your example, together with the script employed.
24+
Make sure that it runs on your machine, at the very least.
25+
Add any additional comments/explanations that maintainers may need for running the example.
26+
If you have issues uploading your files because of the file extension/type, upload them
27+
as a .zip file.
28+
validations:
29+
required: true
30+
31+
- type: dropdown
32+
id: os-name
33+
attributes:
34+
label: '💻 Which operating system are you using?'
35+
multiple: false
36+
options:
37+
- 'Windows'
38+
- 'MacOS'
39+
- 'Linux'
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
id: ansys-version
45+
attributes:
46+
label: '📀 Which ANSYS version are you using?'
47+
placeholder: Indicate the ANSYS version of the products you are using.
48+
49+
validations:
50+
required: false
51+
52+
- type: dropdown
53+
id: python-version
54+
attributes:
55+
label: '🐍 Which Python version are you using?'
56+
description: Run `python --version` to verify your Python version
57+
multiple: false
58+
options:
59+
- '3.7'
60+
- '3.8'
61+
- '3.9'
62+
- '3.10'
63+
- '3.11'
64+
validations:
65+
required: true
66+
67+
- type: textarea
68+
id: installed-packages
69+
attributes:
70+
label: '📦 Installed packages'
71+
description: Run `python -m pip freeze` to list installed packages
72+
placeholder: Paste the output of `python -m pip freeze` here.
73+
render: shell
74+
validations:
75+
required: true

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
version: 2
22
updates:
3+
- package-ecosystem: "pip" # See documentation for possible values
4+
directory: "/" # Location of package manifests
5+
insecure-external-code-execution: allow
6+
schedule:
7+
interval: "weekly"
8+
day: "friday"
9+
time: "00:00"
10+
11+
labels:
12+
- "Maintenance"
13+
- "Dependencies"
14+
ignore:
15+
- dependency-name: "grpcio"
16+
- dependency-name: "sphinx"
317
- package-ecosystem: "github-actions"
418
directory: "/"
519
schedule:

0 commit comments

Comments
 (0)