Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmmnbuild-dep-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scripting-tools
cmmnbuild-dep-manager
Commits
0b92ed73
Commit
0b92ed73
authored
5 years ago
by
Michi Hostettler
Browse files
Options
Downloads
Patches
Plain Diff
review comments; remove >>> prompts from examples
parent
80d42d49
No related branches found
No related tags found
1 merge request
!32
provide import system access through context manager
Pipeline
#1653679
passed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+18
-19
18 additions, 19 deletions
README.md
with
18 additions
and
19 deletions
README.md
+
18
−
19
View file @
0b92ed73
...
...
@@ -58,8 +58,8 @@ Finally, from your code, you can start a JVM with the complete list of jars
using:
```
python
>>>
mgr
=
cmmnbuild_dep_manager
.
Manager
()
>>>
jpype
=
mgr
.
start_jpype_jvm
()
mgr
=
cmmnbuild_dep_manager
.
Manager
()
jpype
=
mgr
.
start_jpype_jvm
()
```
At this stage, JPype is ready to use.
...
...
@@ -67,7 +67,6 @@ At this stage, JPype is ready to use.
To enable the JPype (>= 0.7) import system, you can use the
`imports()`
context manager:
```
python
mgr
=
cmmnbuild_dep_manager
.
Manager
()
mgr
.
start_jpype_jvm
()
with
mgr
.
imports
():
from
cern.some.service
import
Service
# ...
...
...
@@ -94,8 +93,8 @@ Helper functions are provided to inspect the classes in the downloaded jars.
Provides a listing of all classes contained within the jars:
```
python
>>>
mgr
=
cmmnbuild_dep_manager
.
Manager
()
>>>
mgr
.
class_list
()
mgr
=
cmmnbuild_dep_manager
.
Manager
()
mgr
.
class_list
()
[
'
cern.accsoft.cals.extr.client.commandline.CommandLineException
'
,
'
cern.accsoft.cals.extr.client.commandline.CommandLineServiceBuilder
'
,
'
cern.accsoft.cals.extr.client.commandline.CommandMethod
'
,
...
...
@@ -108,8 +107,8 @@ Provides a listing of all classes contained within the jars:
Search for any class by name:
```
python
>>>
mgr
=
cmmnbuild_dep_manager
.
Manager
()
>>>
mgr
.
class_search
(
'
ServiceBuilder
'
)
mgr
=
cmmnbuild_dep_manager
.
Manager
()
mgr
.
class_search
(
'
ServiceBuilder
'
)
[
'
cern.accsoft.cals.extr.client.commandline.CommandLineServiceBuilder
'
,
'
cern.accsoft.cals.extr.client.service.ServiceBuilder
'
,
'
cern.cmw.rda3.client.service.ClientServiceBuilder
'
,
...
...
@@ -121,15 +120,15 @@ Search for any class by name:
Provide a pasteable example of how to use a specific class from Python:
```
python
>>>
mgr
=
cmmnbuild_dep_manager
.
Manager
()
>>>
mgr
.
class_hints
(
'
cern.accsoft.cals.extr.client.service.ServiceBuilder
'
)
mgr
=
cmmnbuild_dep_manager
.
Manager
()
mgr
.
class_hints
(
'
cern.accsoft.cals.extr.client.service.ServiceBuilder
'
)
cern
=
jpype
.
JPackage
(
'
cern
'
)
ServiceBuilder
=
cern
.
accsoft
.
cals
.
extr
.
client
.
service
.
ServiceBuilder
>>>
jpype
=
mgr
.
start_jpype_jvm
()
>>>
cern
=
jpype
.
JPackage
(
'
cern
'
)
>>>
ServiceBuilder
=
cern
.
accsoft
.
cals
.
extr
.
client
.
service
.
ServiceBuilder
>>>
ServiceBuilder
jpype
=
mgr
.
start_jpype_jvm
()
cern
=
jpype
.
JPackage
(
'
cern
'
)
ServiceBuilder
=
cern
.
accsoft
.
cals
.
extr
.
client
.
service
.
ServiceBuilder
ServiceBuilder
jpype
.
_jclass
.
cern
.
accsoft
.
cals
.
extr
.
client
.
service
.
ServiceBuilder
```
...
...
@@ -153,8 +152,8 @@ pyjapc
Which is equivalent to the following Python code:
```
python
>>>
mgr
=
cmmnbuild_dep_manager
.
Manager
()
>>>
mgr
.
register
(
'
pytimber
'
,
'
pyjapc
'
)
mgr
=
cmmnbuild_dep_manager
.
Manager
()
mgr
.
register
(
'
pytimber
'
,
'
pyjapc
'
)
(
'
pytimber
'
,
'
pyjapc
'
)
```
...
...
@@ -168,8 +167,8 @@ cmmnbuild_dep_manager manager directly. For example, manual installation of
a package can be achieved with:
```
python
>>>
mgr
=
cmmnbuild_dep_manager
.
Manager
()
>>>
mgr
.
install
(
'
pyjapc
'
)
mgr
=
cmmnbuild_dep_manager
.
Manager
()
mgr
.
install
(
'
pyjapc
'
)
```
The
`install()`
function registers the package and resolves the dependencies
...
...
@@ -203,8 +202,8 @@ class PyJapc:
Then the user executing:
```
python
>>>
import
pyjapc
>>>
japc
=
pyjapc
.
PyJapc
()
import
pyjapc
japc
=
pyjapc
.
PyJapc
()
```
will cause the jars to be downloaded if they aren't already existing on disk
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment