Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 82ed7a2

Browse files
Naeemkhpdxjohnny
authored andcommitted
docs: contributing: editors: VSCode
Fixes: #494 Closes: #502 Signed-off-by: John Andersen <[email protected]>
1 parent 782eb33 commit 82ed7a2

File tree

5 files changed

+121
-8
lines changed

5 files changed

+121
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Support for operations without inputs.
2424
- Partial doctestable examples to `features.py`
2525
- Doctestable examples for `BaseSource`
26+
- Instructions for setting up debugging environment in VSCode
2627
### Fixed
2728
- New model tutorial mentions file paths that should be edited.
2829
- DataFlow is no longer a dataclass to prevent it from being exported
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Setting Up Your Editor
2+
======================
3+
4+
Maintaining proper execution of DFFML API both in development and deployment
5+
levels is the top priority of the development team. DFFML modules are tightly
6+
coupled; as a result, the debugging process can be complicated.
7+
After identifying the potential problems or encountering an error during
8+
execution time, developers need to reproduce the problem and also be able to
9+
acquire knowledge about the program and state of the variables, specifically
10+
a couple of steps before the problems. This requires setting up a debugging
11+
environment. In this section, setting up a debugger for DFFML in different
12+
editors is presented.
13+
14+
.. toctree::
15+
:glob:
16+
:maxdepth: 2
17+
18+
vscode
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Setting up debugging in Visual Studio Code (VSCode)
2+
===================================================
3+
4+
`VSCode <https://code.visualstudio.com/>`_ provides powerful tools for
5+
debugging support. For this project, we use a Python extension. For more
6+
details about debugging configurations for Python apps in VSCode, see this
7+
`link <https://code.visualstudio.com/docs/python/debugging>`_.
8+
9+
If you are planning on contributing to the project, or track your debugging
10+
process, it is a better idea to have your own copy of DFFML on your Github
11+
account. For more details about setting up your git repository,
12+
read :doc:`git` page.
13+
14+
After setting up the version controlling configurations, you need to install
15+
DFFML. See :doc:`dev_env` page for installing details in the development mode.
16+
17+
Open the VSCode app, on the menu bar, click on ``File`` then choose
18+
``Open Folder``. Locate DFFML folder and open it. Inside the folder in VSCode,
19+
select ``setup.py`` file. This helps VSCode to retrieve your Python environment
20+
(either base or any virtual environment) that you setup. You can close the
21+
``setup.py`` file.
22+
23+
Go to the menu bar and click on ``Run``, then select ``Add configuration``.
24+
Choose Python from the drop-down menu and then select ``module``. Inside the
25+
module text input field type ``dffml`` and press Enter. This will create a
26+
``launch.json`` file under the ``.vscode`` folder.
27+
28+
It should be similar to the following:
29+
30+
.. code-block:: console
31+
32+
{
33+
// Use IntelliSense to learn about possible attributes.
34+
// Hover to view descriptions of existing attributes.
35+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
36+
"version": "0.2.0",
37+
"configurations": [
38+
{
39+
"name": "Python: Module",
40+
"type": "python",
41+
"request": "launch",
42+
"module": "dffml"
43+
}
44+
]
45+
}
46+
47+
``dffml`` module needs arguments to run. Add arguments as a key-value pair into
48+
the embedded configurations container. Here is the example ``launch.json`` file
49+
for the :doc:`/quickstart/model` example.
50+
51+
.. code-block:: console
52+
53+
{
54+
// Use IntelliSense to learn about possible attributes.
55+
// Hover to view descriptions of existing attributes.
56+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
57+
"version": "0.2.0",
58+
"configurations": [
59+
{
60+
"name": "Python: Module",
61+
"type": "python",
62+
"request": "launch",
63+
"module": "dffml",
64+
"args": [
65+
"train",
66+
"-model", "scikitlr",
67+
"-model-features", "Years:int:1", "Expertise:int:1",
68+
"Trust:float:1",
69+
"-model-predict", "Salary:float:1",
70+
"-sources", "f=csv",
71+
"-source-filename", "training.csv"
72+
]
73+
}
74+
]
75+
}
76+
77+
Save the file and click on the ``Run`` at the menu bar, and then click on
78+
``Start Debugging``. The code should run successfully to the end. You can add
79+
``"stopOnEntry": true,`` in the configurations container to break immediately
80+
when the program launches or you can use break point to stop at any arbitrary
81+
point in the code. Read more about debugging a Python code in
82+
VSCode `here <https://code.visualstudio.com/docs/python/debugging>`_.

docs/contributing/git.rst

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
Git and GitHub
22
==============
33

4-
We encourage people to commit code and push it up to GitHub often. That way, if
5-
you're having trouble with something you can send others a link to your code
4+
We encourage people to commit code and push it up to GitHub often. That way,
5+
if you're having trouble with something you can send others a link to your code
66
where they can easily get an idea of what might be going wrong. Don't worry if
77
it's nowhere near complete! Asking each other for help just gets us to working
88
code faster!
99

10-
Working On A Branch
11-
-------------------
10+
In your local computer, create a new folder for the project, open terminal
11+
(Mac and Linux) or `Gitbash <https://gitforwindows.org/>`_ (Windows) and
12+
navigate to the folder. Using the following command, clone DFFML
13+
repository to this folder.
1214

13-
Be sure to checkout a new branch to do your work on.
15+
.. code-block:: console
16+
17+
$ git clone [email protected]:intel/dffml
18+
19+
Navigate inside the DFFML folder and run the following command to make sure
20+
that you have the latest version of the code. Be sure to checkout a new branch
21+
to do your work on.
1422

1523
.. code-block:: console
1624
1725
$ git fetch origin
1826
$ git checkout -b my_new_thing origin/master
1927
20-
You'll need to fork the repo on GitHub too. Then add that as a remote.
28+
You need to have your own version of DFFML to track your work. Log in to your
29+
Github account and go to `DFFML <https://github.com/intel/dffml>`_ repository.
30+
There is a ``Fork`` tab at the top right of the page. Click on the button to
31+
fork a copy into your Github account.
2132

2233
.. note::
2334

@@ -33,8 +44,8 @@ Once you've committed a change on that branch you can push it to your fork.
3344
3445
$ git push -u $USER my_new_thing
3546
36-
Then you can keep committing on this branch and just use ``git push`` to send your
37-
new commits to GitHub.
47+
Then you can keep committing on this branch and just use ``git push`` to send
48+
your new commits to GitHub.
3849

3950
Issue and Pull Request title formatting
4051
---------------------------------------

docs/contributing/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ or post in the `Gitter Chat <https://gitter.im/dffml/community>`_.
1919
testing
2020
docs
2121
debugging
22+
editors/index
2223
maintainers

0 commit comments

Comments
 (0)