Skip to content

Commit 21ca441

Browse files
committed
Merge branch 'main' of https://github.com/ebresie/python4nb
2 parents 188f3fb + 10f334b commit 21ca441

Some content is hidden

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

51 files changed

+7420
-60
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ on:
1919
branches: [ main ]
2020
schedule:
2121
- cron: '38 13 * * 3'
22-
22+
workflow_dispatch:
23+
# To allow manual workflow execution
24+
branches: [ main ]
25+
2326
jobs:
2427
analyze:
2528
name: Analyze
@@ -42,7 +45,7 @@ jobs:
4245

4346
# Initializes the CodeQL tools for scanning.
4447
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v1
48+
uses: github/codeql-action/init@v2
4649
with:
4750
languages: ${{ matrix.language }}
4851
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -53,7 +56,7 @@ jobs:
5356
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5457
# If this step fails, then you should remove it and run the build manually (see below)
5558
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v1
59+
uses: github/codeql-action/autobuild@v2
5760

5861
# ℹ️ Command-line programs to run using the OS shell.
5962
# 📚 https://git.io/JvXDl
@@ -67,4 +70,4 @@ jobs:
6770
# make release
6871

6972
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v1
73+
uses: github/codeql-action/analyze@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target/
2+
/nbproject/

README.md

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,62 @@
11
# python4nb
2-
This is Python Plugin for Netbeans which leverages textmate grammar and LSP based functionality.
32

4-
This is in early development with more work to follow. This is being published for further community support and development opportunities.
3+
This is Python Plugin for [Apache Netbeans](https://netbeans.apache.org/) which leverages textmate grammar and LSP based functionality.
54

6-
Available Features:
5+
The source is being published for further community support and development opportunities.
6+
7+
This is in early development with more work to follow.
8+
9+
Once more development is more mature, expectations is a release will be available here and/or be published to the [Netbeans Plugin Portal]( https://plugins.netbeans.apache.org/).
10+
11+
## Available Features:
12+
- Python Colorization (via textmate grammar)
13+
- Auto completion leveraging the Python LSP
14+
- Python Hints/Tips leveraging the Python LSP
15+
- Python Platform Configuration and Installation
16+
- Python Execution Functionality
17+
18+
# How to install it
19+
- Installation requires [Python](https://www.python.org/) to be installed
20+
- Installation of following python LSP related module to be installed in g
21+
-- python -m pip install python-language-server[all]
22+
--- For additional details on the [Python LSP server](https://pypi.org/project/python-language-server/)
23+
- Compile python4nb from source and install module within given Netbeans setup
24+
- Open Tools...Python Platform...select python instance where LSP server module installed
25+
26+
# Change process
27+
- Changes will be tracked using [project's github issues](https://github.com/ebresie/python4nb/issues).
28+
- Upon completion of updates for given issues, a pull request will be made, reviewed, and upon completion integrated into the master branch in github for coming release.
29+
30+
# Change log
31+
## Release 0.2
32+
- [Python Platform Configuration and Installation](https://github.com/ebresie/python4nb/issues/3)
33+
- [Python Execution Functionality](https://github.com/ebresie/python4nb/issues/4)
34+
35+
## Release 0.1
736
- Python Colorization (via textmate gramer)
837
- Auto completion leveraging the Python LSP
938
- Python Hints/Tips leveraging the Python LSP
1039

11-
TODO:
12-
- Complete Python Project functionality
13-
- Complete Python Platform Configuration and Installation
14-
- Complete Python Execution Functionality
15-
- Complete Python Debugging
16-
- Complete Python Module Management
40+
For version, will attempt to comply with major/minor/patch versioning as defined [here](https://semver.org/)
41+
42+
## TODO (For more specifics details, see [project issue area](https://github.com/ebresie/python4nb/issues):
43+
- [Complete Python Project functionality](https://github.com/ebresie/python4nb/issues/8)
44+
- [Complete Python Debugging](https://github.com/ebresie/python4nb/issues/5)
45+
- [Complete Python Module Management](https://github.com/ebresie/python4nb/issues/6)
46+
- [Complete Unit Test functionality](https://github.com/ebresie/python4nb/issues/7)
47+
- [Complete Implement CI build/packaging for release](https://github.com/ebresie/python4nb/issues/9)
48+
- [Complete Help and documentation for the python4nb plugin](https://github.com/ebresie/python4nb/issues/10)
49+
- [Complete Development "New Project" Templates](https://github.com/ebresie/python4nb/issues/11)
50+
51+
# License
52+
Project is being developed leveraging [Apache-2.0 license]( https://github.com/ebresie/python4nb/blob/main/LICENSE ) or applicable licenses.
53+
All due diligence has been made to attribute proper licensings where applicable.
1754

18-
Installation requires installation of following python module
19-
- python -m pip install python-language-server[all]
55+
Some functionality is based on or leverages functionality from other projects and attempts to comply as applicable.
56+
- http://nbpython.org
57+
- https://netbeans.apache.org/about/oracle-transition.html
58+
- https://pypi.org/project/python-language-server/
2059

21-
For additional details on the LSP server, see
22-
https://pypi.org/project/python-language-server/
60+
# Contributors
61+
- [Eric Bresie](https://github.com/ebresie)
2362

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Security Policy
22

33

4-
Python4NB is in early development so limited sercurity support is available at
4+
Python4NB is in early development so limited security support is available at
55
the moment.
66

77
The Python4NB project leverages github workflow dependabot checks

pom.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.apache.netbeans.modules.python4nb</groupId>
55
<artifactId>python</artifactId>
6-
<version>0.1-SNAPSHOT</version>
6+
<version>0.2-SNAPSHOT</version>
77
<packaging>nbm</packaging>
88
<build>
99
<plugins>
@@ -34,6 +34,11 @@
3434
</archive>
3535
</configuration>
3636
</plugin>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-surefire-plugin</artifactId>
40+
<version>2.15</version>
41+
</plugin>
3742
</plugins>
3843
</build>
3944
<dependencies>
@@ -82,7 +87,7 @@
8287
<groupId>org.netbeans.api</groupId>
8388
<artifactId>org-openide-windows</artifactId>
8489
<version>RELEASE126</version>
85-
<type>jar</type>
90+
<!--<type>jar</type>-->
8691
<scope>provided</scope>
8792
</dependency>
8893
<dependency>
@@ -304,6 +309,17 @@
304309
<version>3.0.2</version>
305310
<scope>provided</scope>
306311
</dependency>
312+
<dependency>
313+
<groupId>org.netbeans.api</groupId>
314+
<artifactId>org-netbeans-modules-nbjunit</artifactId>
315+
<version>RELEASE126</version>
316+
<scope>test</scope>
317+
</dependency>
318+
<dependency>
319+
<groupId>org.netbeans.api</groupId>
320+
<artifactId>org-netbeans-modules-project-ant</artifactId>
321+
<version>RELEASE126</version>
322+
</dependency>
307323
</dependencies>
308324
<properties>
309325
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2022 ebres.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.apache.netbeans.modules.python4nb.api;
17+
18+
/**
19+
*
20+
* @author ebres
21+
*/
22+
public class PythonException extends Exception {
23+
24+
public PythonException(Throwable arg0) {
25+
super(arg0);
26+
}
27+
28+
public PythonException(String arg0, Throwable arg1) {
29+
super(arg0, arg1);
30+
}
31+
32+
public PythonException(String arg0) {
33+
super(arg0);
34+
}
35+
36+
public PythonException() {
37+
}
38+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
6+
package org.apache.netbeans.modules.python4nb.api;
7+
8+
import java.io.IOException;
9+
//import org.netbeans.api.extexecution.input.InputProcessor;
10+
import org.netbeans.api.extexecution.base.input.InputProcessor;
11+
12+
/** TODO: This code is derived from nbPython codebase.
13+
* Need to consider proper handling of code.
14+
*/
15+
public class PythonOutputProcessor implements InputProcessor {
16+
StringBuilder builder = new StringBuilder();
17+
@Override
18+
public void processInput(char[] input) throws IOException {
19+
builder.append(input);
20+
}
21+
22+
@Override
23+
public void reset() throws IOException {
24+
//builder = new StringBuilder();
25+
}
26+
27+
@Override
28+
public void close() throws IOException {
29+
30+
}
31+
public String getData(){
32+
return builder.toString();
33+
}
34+
35+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
6+
/* TODO: This is based on nbPython code and needs to be reconciled as
7+
applicable.
8+
*/
9+
package org.apache.netbeans.modules.python4nb.api;
10+
11+
import java.util.List;
12+
import javax.swing.AbstractListModel;
13+
//import org.netbeans.modules.python.api.PythonPlatform;
14+
//import org.netbeans.modules.python.api.PythonPlatformManager;
15+
import org.apache.netbeans.modules.python4nb.platform.PythonPlatform;
16+
import org.apache.netbeans.modules.python4nb.platform.PythonPlatformManager;
17+
18+
public class PythonPlatformListModel extends AbstractListModel {
19+
private PythonPlatformManager manager = PythonPlatformManager.getInstance();
20+
private List<PythonPlatform> model = manager.getPlatforms();
21+
22+
@Override
23+
public int getSize() {
24+
return model.size();
25+
}
26+
27+
@Override
28+
public Object getElementAt(int index) {
29+
if (index >= 0 && index < model.size()) {
30+
return model.get(index);
31+
} else {
32+
return null;
33+
}
34+
}
35+
36+
public void refresh(){
37+
model = manager.getPlatforms();
38+
fireContentsChanged(this, 0, model.size() -1);
39+
}
40+
}

0 commit comments

Comments
 (0)