kezhenxu94 commented on a change in pull request #38:
URL: https://github.com/apache/skywalking-python/pull/38#discussion_r455779544



##########
File path: scripts/setup_linux.sh
##########
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#!/bin/sh
+
+echo "Creating virtual environment"
+python -m venv '../venv'
+echo "Virtual env created"
+
+../venv/Scripts/python.exe -m pip install --upgrade pip

Review comment:
       ditto, and `.exe` suffix should be removed

##########
File path: README.md
##########
@@ -127,5 +127,22 @@ with 
context.new_entry_span(op=str('https://github.com/apache/skywalking')) as s
 
 Check [the FAQ page](docs/FAQ.md) or add the FAQs there.
 
+## For Developers
+
+### Steps to get an operational virtual environment:
+
+1. `git clone https://github.com/apache/skywalking-python.git`
+2. `cd skywalking-python/scripts` (*make sure you actually go into the 
directory since the scripts use relative paths*)

Review comment:
       nit: I hope the script itself can tackle the paths by some extra work, 
that would be more friendly to the developers

##########
File path: README.md
##########
@@ -127,5 +127,22 @@ with 
context.new_entry_span(op=str('https://github.com/apache/skywalking')) as s
 
 Check [the FAQ page](docs/FAQ.md) or add the FAQs there.
 
+## For Developers
+
+### Steps to get an operational virtual environment:
+
+1. `git clone https://github.com/apache/skywalking-python.git`
+2. `cd skywalking-python/scripts` (*make sure you actually go into the 
directory since the scripts use relative paths*)
+3. Run the script for your relevant OS to create a virtual environment folder 
in the project root (*skywalking-python/venv*) and install all the necessary 
requirements
+
+**Make sure that when the `python` command is executed on your workstation, 
the binary it references is python 3.5 or newer!**

Review comment:
       IIRC this can be automatically determined right?

##########
File path: scripts/setup_linux.sh
##########
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#!/bin/sh
+
+echo "Creating virtual environment"
+python -m venv '../venv'
+echo "Virtual env created"
+
+../venv/Scripts/python.exe -m pip install --upgrade pip
+echo "Pip upgrade complete. Installing packages from requirements.txt"
+
+while read requirement; do
+  ../venv/Scripts/python.exe -m pip install $requirement
+done < ../requirements.txt

Review comment:
       Can be replaced by `xxx install -r ../requirements.txt`, and no `.exe` 
suffix

##########
File path: scripts/setup_windows.ps1
##########
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+Write-Output "Creating virtual environment"
+
+& python -m venv '..\venv'
+
+Write-Output "Virtual env created"
+
+$PYEXE= Join-Path -Path $PSScriptRoot -ChildPath '..\venv\Scripts\python.exe'
+& $PYEXE -m pip install --upgrade pip
+
+Write-Output "Pip upgrade complete. Installing packages from requirements.txt"
+
+foreach($package in Get-Content ..\requirements.txt) {
+    & $PYEXE -m pip install $package
+}

Review comment:
       ditto

##########
File path: scripts/build_requirements_linux.sh
##########
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#!/bin/sh
+
+echo "Building requirements.txt"
+
+../venv/Scripts/python -m pip freeze > ../requirements.txt

Review comment:
       The path under Mac OS is `../venv/bin/python` instead of 
`../venv/Scripts/python`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to