Skip to content

Commit 21a046b

Browse files
committed
chore(powershell): Added setup.ps1 to automate python installation on Windows
1 parent e3d504a commit 21a046b

File tree

4 files changed

+279
-67
lines changed

4 files changed

+279
-67
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"recommendations": [
33
"ms-python.vscode-pylance",
44
"ms-python.python",
5-
"be5invis.toml"
5+
"be5invis.toml",
6+
"ms-vscode.powershell"
67
]
78
}

.vscode/launch.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "PowerShell: Launch Current File",
9+
"type": "PowerShell",
10+
"request": "launch",
11+
"script": "${file}",
12+
"cwd": "${file}"
13+
},
14+
{
15+
"name": "PowerShell: Launch setup",
16+
"type": "PowerShell",
17+
"request": "launch",
18+
"script": ".\\setup.ps1",
19+
"args": [
20+
"-VirtualEnvFolder",
21+
"myenv"
22+
]
23+
}
24+
]
25+
}

README.md

Lines changed: 25 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Import a point cloud file and perform poisson 3D surface reconstruction algorithm,
44
integrated with third-party libraries like [open3d](http://www.open3d.org/docs/release/tutorial/geometry/surface_reconstruction.html?highlight=surface%20reconstruction#Poisson-surface-reconstruction) and [pymeshlab](https://github.com/cnr-isti-vclab/PyMeshLab)
55

6-
# Installation
76

87
## Dependencies
98

@@ -14,92 +13,52 @@ integrated with third-party libraries like [open3d](http://www.open3d.org/docs/r
1413
- [pymeshlab](https://github.com/cnr-isti-vclab/PyMeshLab) >= *0.2*
1514

1615

17-
### Development dependencies
16+
## Development dependencies
1817

1918
- [setuptools](https://pypi.org/project/setuptools): For installation via `setup.py`
2019
- [setuptools-scm](https://pypi.org/project/setuptools-scm): To generate version numbers from **git tags**
2120
- [wheel](https://pypi.org/project/wheel/): Built packages `.whl` to install packages with PIP
2221
- [twine](https://pypi.org/project/twine): Publish packages to https://pypi.org
2322
- [tqdm](https://pypi.org/project/tqdm): CLI progressbar when publish a package
2423

25-
# Getting Started
24+
## Development guide
25+
26+
For local installation and develop new features for this package, follow the steps below:
2627

27-
Install a Python <= 3.8.x version using [pyenv](https://github.com/pyenv/pyenv) (recommended)
2828

2929
### Windows
3030

31-
```bash
32-
# With Chocolatey
33-
choco install pyenv-win
34-
```
31+
> Run unassigned powershell scripts on Windows requires change your execution policy with `Set-ExecutionPolicy` to `AllSigned`, or `Bypass -Scope Process`.
3532
36-
### Linux
33+
>See: [Execution Policies](https://docs.microsoft.com/pt-br/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1)
3734
38-
```bash
39-
# With pyenv-installer
40-
curl https://pyenv.run | bash
41-
```
35+
Run the script `setup.ps1` with [powershell](https://docs.microsoft.com/pt-pt/powershell/scripting/overview?view=powershell-7.1)
4236

43-
### MacOS
37+
```powershell
38+
# Default virtualenv folder is "venv"
39+
.\setup.ps1
4440
45-
```bash
46-
# With homebrew
47-
brew update
48-
brew install pyenv
41+
# Optionally, pass a custom virtualenv folder
42+
.\setup.ps1 -VirtualEnvFolder myenv
4943
```
5044

51-
Check if pyenv was installed sucessfully, and if not got any error in this project
45+
If you wish run just an specific function from `setup.ps1` (e.g. `Install-Python`), execute:
5246

53-
```bash
54-
# Warning: Check if not got any error
55-
pyenv rehash
47+
```powershell
48+
powershell -command "& { . .\setup.ps1 'venv' -Execute 0; Install-Python }"
5649
```
5750

58-
Install same Python version inside of the file **[.python-version](.python-version)**
51+
### Unix systems (Comming soon)
5952

6053
```bash
61-
cd [project-folder]
62-
63-
# Loads local version from .python-version file
64-
pyenv local
65-
66-
# PS: The 3.8.2 Python version is latest available in Pyenv for Windows.
67-
# On Unix systems, is possible install 3.8.8, for example.
68-
pyenv install 3.8.2
54+
# Default virtualenv folder is "venv"
55+
./setup.sh
6956

70-
# Check the installed version
71-
python --version
57+
# Optionally, pass a custom virtual enviroment folder
58+
./setup.sh --virtual-env-folder myenv
7259
```
7360

74-
Create a **Virtual Environment** to store the packages dependencies, and activate it
75-
76-
```bash
77-
python -m venv venv
78-
79-
# Activate
80-
81-
# Windows
82-
.\venv\Scripts\activate.bat
83-
84-
# Unix systems
85-
./venv/Scripts/activate
86-
```
87-
88-
Install all dependencies
89-
90-
```bash
91-
pip install -r .\requirements-dev.txt
92-
```
93-
94-
# Configure Pycharm (Optional)
95-
96-
Define your interpreter in your preferable IDE (**Visual Studio, VSCode**...) from the virtual environment. In this case, we are using [Pycharm](https://www.jetbrains.com/pycharm) as example:
97-
98-
1. Click on `File` => `Settings` => `Python Interpeter`
99-
2. Add your interpreter from your virtual environment (**recommended**)
100-
3. If you prefer, download from the official python.org FTP clicking on `"New enviroment"`, as showed in the picture below
101-
102-
![pycharm-python-intepreter](./images/pycharm-venv-screenshot.png)
61+
For more detailed installation, see the Wiki pages in: [Installation Development](https://github.com/mfdeveloper/surface_reconstruction_python/wiki/Installation-Details)
10362

10463
## Install this package
10564

@@ -109,20 +68,20 @@ Quick way:
10968
pip install surface_reconstruction
11069
```
11170

112-
Or clone the repository and run from the project root:
71+
Or clone this repository and run from the project root:
11372

11473
```bash
11574
python setup.py install
11675
```
11776

118-
## Run the unit tests
77+
### Run the unit tests
11978

12079
```bash
12180
# Run all tests of the module "surface_reconstruction_test`
12281
python -m unittest tests/surface_reconstruction_test.py
12382
```
12483

125-
# Usage
84+
## Usage
12685

12786
Import a `.ply` file with point cloud vertices, and generate the mesh file
12887

@@ -172,7 +131,7 @@ class MyCustomSurface(SurfaceStrategy):
172131
"""
173132
Custom constructor with custom parameters
174133
"""
175-
super.__init__()
134+
super().__init__()
176135

177136
def load_file(self, file_path: str):
178137
"""

0 commit comments

Comments
 (0)