Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix github actions and update to 2.0.0 synapser to use 4.0.0 python client #328

Merged
merged 16 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ jobs:

strategy:
matrix:
# os: [ubuntu-22.04, macos-12, macos-13, windows-2022]
os: [ubuntu-22.04, macos-13, windows-2022]
r: [4.1.3, 4.2.3, 4.3.1]

steps:
- name: checkout
uses: actions/checkout@v4

- name: Set up Python Version
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: setup-r
uses: r-lib/actions/setup-r@v2
with:
Expand Down Expand Up @@ -92,8 +96,8 @@ jobs:
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo "r_minor_version=$R_MINOR_VERSION" >> $GITHUB_OUTPUT

- name: setup-r-mac-12
if: ${{matrix.os == 'macos-12'}}
- name: setup-r-mac-13
if: ${{matrix.os == 'macos-13'}}
run: |
R_LIBS_USER=${GITHUB_WORKSPACE}/R_LIBS
rm -rf R_LIBS_USER
Expand All @@ -102,6 +106,7 @@ jobs:

echo "R=R" >> $GITHUB_ENV


- name: install-test-config
shell: bash
run: |
Expand Down Expand Up @@ -140,6 +145,10 @@ jobs:
- name: mac-build-package
if: ${{runner.os == 'macOS'}}
run: |
Rscript -e "install.packages(c('remotes', 'reticulate'))"
Rscript -e "reticulate::install_miniconda()"
echo "options(reticulate.conda_binary = reticulate:::miniconda_conda())" >> .Rprofile
Rscript -e "reticulate::conda_create('r-reticulate', packages = c('python==3.10'))"
R CMD build ./
R CMD INSTALL --build ${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.gz --library=$R_LIBS_USER --no-test-load

Expand Down
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Package: synapser
Type: Package
Title: R Language Bindings for Synapse API
Version: 1.3.0
Version: 2.0.0
Date: 2022-01-18
Authors@R: c(
person("Bruce", "Hoff", role = c("aut", "cre"), email = "[email protected]"),
person("Tom", "Yu", role = c("cre"), email = "[email protected]"),
person("Bruce", "Hoff", role = c("aut"), email = "[email protected]"),
person("Sage Bionetworks", role = c("cph"))
)
Maintainer: Bruce Hoff <[email protected]>
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## synapser 2.0.0

### Improvements

* Python synapsePythonClient dependency updated to 4.0.0
* You can only login via a Synapse Personal Access token now. All other forms of authentication have been disabled for security purposes.
* `synSetAnnotations` removed as it is not working as expected due to implementation in the Python API.
* For more changes, please view the 3.2.0 and 4.0.0 changes on the [Python client documentation](https://python-docs.synapse.org/news/).

## synapser 1.3.0

### Improvements
Expand Down
1 change: 0 additions & 1 deletion R/PythonPkgWrapperUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ getFunctionInfo <- function(pyPkg,
}
# scrub the nulls
functionInfo <- removeNulls(functionInfo)

functionContainerName <- module
if (!is.null(pySingletonName)) {
functionContainerName <- pySingletonName
Expand Down
3 changes: 1 addition & 2 deletions R/shared.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"putACLURI",
"keys",
"has_key",
"set_annotations",
"get_annotations"
"set_annotations"
)

.synapseClientClassFilter <- function(x) {
Expand Down
9 changes: 5 additions & 4 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
# Ideally we would source tools/installPythonClient.R to not
# have to duplicate the synapseclient install code
# system2(paste("Rscript ", getwd(), "/tools/installPythonClient.R ", getwd(), sep=""))
PYTHON_CLIENT_VERSION <- '3.1.1'
reticulate::virtualenv_create('r-reticulate')
reticulate::use_virtualenv('r-reticulate')
PYTHON_CLIENT_VERSION <- '4.0.0'
# reticulate::virtualenv_create('r-reticulate')
# reticulate::use_virtualenv('r-reticulate')
reticulate::py_install(c("requests<3", "pandas~=2.0.0", "pysftp", "jinja2", "markupsafe"))
reticulate::py_install(c(paste("synapseclient==", PYTHON_CLIENT_VERSION, sep="")), pip=T)
reticulate::py_run_string("import synapseclient")
}
)

reticulate::py_run_string(sprintf("synapserVersion = 'synapser/%s' ", utils::packageVersion("synapser")))
reticulate::py_run_string("synapseclient.USER_AGENT['User-Agent'] = synapserVersion + synapseclient.USER_AGENT['User-Agent']")
reticulate::py_run_string("synapseclient.USER_AGENT['User-Agent'] = synapserVersion + ' '+ synapseclient.USER_AGENT['User-Agent']")
reticulate::py_run_string("synapseclient.core.config.single_threaded = True")
reticulate::py_run_string("syn=synapseclient.Synapse(skip_checks=True)")
# make syn available in the global environment
Expand Down
23 changes: 18 additions & 5 deletions auto-man/Activity-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ Activity
\format{An R6 class object.}
\description{
Represents the provenance of a Synapse Entity.

Parameters:
name: Name of the Activity
description: A short text description of the Activity
used: Either a list of:

- [reference objects](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Reference.html) (e.g. [{'targetId':'syn123456', 'targetVersionNumber':1}])
- a list of Synapse Entities or Entity IDs
- a list of URL's
executed: A code resource that was executed to generate the Entity.
data: A dictionary representation of an Activity, with fields 'name', 'description' and 'used' (a list of reference objects)

See also: The [W3C's provenance ontology](http://www.w3.org/TR/prov-o/)
}
\section{Methods}{
\itemize{
\item \code{Activity(name=NULL, description=NULL, used=NULL, executed=NULL, data=list())}: Constructor for \code{\link{Activity}}
\item \code{executed(target=NULL, targetVersion=NULL, url=NULL, name=NULL)}: Add a code resource that was executed during the activity.\cr
See synapseclient.activity.Activity.used
See [synapseclient.activity.Activity.used][]
\item \code{used(target=NULL, targetVersion=NULL, wasExecuted=NULL, url=NULL, name=NULL)}: Add a resource used by the activity.\cr
\cr
This method tries to be as permissive as possible. It accepts a string which might be a synapse ID or a URL,\cr
Expand All @@ -31,26 +44,26 @@ It is an error to specify both target/targetVersion parameters and url/name para
To add multiple UsedEntities and UsedURLs, make a separate call for each or pass in a list.\cr
\cr
In case of conflicting settings for wasExecuted both inside an object and with a parameter, the parameter wins.\cr
For example, this UsedURL will have wasExecuted set to False::\cr
For example, this UsedURL will have wasExecuted set to False:\cr
\cr
activity.used({'url':'http://google.com', 'name':'Goog', 'wasExecuted':True}, wasExecuted=False)\cr
\cr
Entity examples::\cr
Entity examples:\cr
\cr
activity.used('syn12345')\cr
activity.used(entity)\cr
activity.used(target=entity, targetVersion=2)\cr
activity.used(codeEntity, wasExecuted=True)\cr
activity.used({'reference':{'target':'syn12345', 'targetVersion':1}, 'wasExecuted':False})\cr
\cr
URL examples::\cr
URL examples:\cr
\cr
activity.used('http://mydomain.com/my/awesome/data.RData')\cr
activity.used(url='http://mydomain.com/my/awesome/data.RData', name='Awesome Data')\cr
activity.used(url='https://github.com/joe_hacker/code_repo', name='Gnarly hacks', wasExecuted=True)\cr
activity.used({'url':'https://github.com/joe_hacker/code_repo', 'name':'Gnarly hacks'}, wasExecuted=True)\cr
\cr
List example::\cr
List example:\cr
\cr
activity.used(['syn12345', 'syn23456', entity, {'reference':{'target':'syn100009', 'targetVersion':2}, 'wasExecuted':True}, 'http://mydomain.com/my/awesome/data.RData'])
}
Expand Down
27 changes: 18 additions & 9 deletions auto-man/Activity.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ Constructor for objects of type Activity
}
\description{
Represents the provenance of a Synapse Entity.

Parameters:
name: Name of the Activity
description: A short text description of the Activity
used: Either a list of:

- [reference objects](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Reference.html) (e.g. [{'targetId':'syn123456', 'targetVersionNumber':1}])
- a list of Synapse Entities or Entity IDs
- a list of URL's
executed: A code resource that was executed to generate the Entity.
data: A dictionary representation of an Activity, with fields 'name', 'description' and 'used' (a list of reference objects)

See also: The [W3C's provenance ontology](http://www.w3.org/TR/prov-o/)
}
\usage{
Activity(name=NULL, description=NULL, used=NULL, executed=NULL, data=list())
}
\arguments{
\item{name}{ name of the Activity\cr
}
\item{description}{ a short text description of the Activity\cr
}
\item{used}{ Either a list of:}
\item{executed}{ A code resource that was executed to generate the Entity.\cr
}
\item{data}{ A dictionary representation of an Activity, with fields 'name', 'description' and 'used'\cr
(a list of reference objects)}
\item{name}{}
\item{description}{}
\item{used}{}
\item{executed}{}
\item{data}{}
}
\value{
An object of type Activity
Expand Down
34 changes: 31 additions & 3 deletions auto-man/Column-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,40 @@ Column
}
\format{An R6 class object.}
\description{
Defines a column to be used in a table Schema
EntityViewSchema.
Defines a column to be used in a table [Schema][synapseclient.table.Schema]
[EntityViewSchema][synapseclient.table.EntityViewSchema].

Attributes:
id: An immutable ID issued by the platform
columnType: The column type determines the type of data that can be stored in a column. It can be any
of:

- `STRING`
- `DOUBLE`
- `INTEGER`
- `BOOLEAN`
- `DATE`
- `FILEHANDLEID`
- `ENTITYID`
- `LINK`
- `LARGETEXT`
- `USERID`

For more information, please see:
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/ColumnType.html>
maximumSize: A parameter for columnTypes with a maximum size. For example, ColumnType.STRINGs have a
default maximum size of 50 characters, but can be set to a `maximumSize` of 1 to 1000
characters.
maximumListLength: Required if using a columnType with a "_LIST" suffix. Describes the maximum number of
values that will appear in that list. Value range 1-100 inclusive. Default 100
name: The display name of the column
enumValues: Columns type of STRING can be constrained to an enumeration values set on this list.
defaultValue: The default value for this column. Columns of type FILEHANDLEID and ENTITYID are not
allowed to have default values.
}
\section{Methods}{
\itemize{
\item \code{Column(id=NULL, columnType=NULL, maximumSize=NULL, maximumListLength=NULL, name=NULL, enumValues=NULL, defaultValue=NULL)}: Constructor for \code{\link{Column}}
\item \code{Column()}: Constructor for \code{\link{Column}}
}
}

55 changes: 32 additions & 23 deletions auto-man/Column.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,42 @@
Constructor for objects of type Column
}
\description{
Defines a column to be used in a table Schema
EntityViewSchema.
Defines a column to be used in a table [Schema][synapseclient.table.Schema]
[EntityViewSchema][synapseclient.table.EntityViewSchema].

Attributes:
id: An immutable ID issued by the platform
columnType: The column type determines the type of data that can be stored in a column. It can be any
of:

- `STRING`
- `DOUBLE`
- `INTEGER`
- `BOOLEAN`
- `DATE`
- `FILEHANDLEID`
- `ENTITYID`
- `LINK`
- `LARGETEXT`
- `USERID`

For more information, please see:
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/ColumnType.html>
maximumSize: A parameter for columnTypes with a maximum size. For example, ColumnType.STRINGs have a
default maximum size of 50 characters, but can be set to a `maximumSize` of 1 to 1000
characters.
maximumListLength: Required if using a columnType with a "_LIST" suffix. Describes the maximum number of
values that will appear in that list. Value range 1-100 inclusive. Default 100
name: The display name of the column
enumValues: Columns type of STRING can be constrained to an enumeration values set on this list.
defaultValue: The default value for this column. Columns of type FILEHANDLEID and ENTITYID are not
allowed to have default values.
}
\usage{
Column(id=NULL, columnType=NULL, maximumSize=NULL, maximumListLength=NULL, name=NULL, enumValues=NULL, defaultValue=NULL)
Column()
}
\arguments{
\item{id}{optional named parameter: An immutable ID issued by the platform\cr
}
\item{columnType}{optional named parameter: The column type determines the type of data that can be stored in a column. It can be any\cr
of: "STRING", "DOUBLE", "INTEGER", "BOOLEAN", "DATE", "FILEHANDLEID", "ENTITYID", "LINK",\cr
"LARGETEXT", "USERID". For more information, please see:\cr
https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/ColumnType.html\cr
}
\item{maximumSize}{optional named parameter: A parameter for columnTypes with a maximum size. For example, ColumnType.STRINGs have a\cr
default maximum size of 50 characters, but can be set to a maximumSize of 1 to 1000\cr
characters.\cr
}
\item{maximumListLength}{optional named parameter: Required if using a columnType with a "_LIST" suffix. Describes the maximum number of\cr
values that will appear in that list. Value range 1-100 inclusive. Default 100\cr
}
\item{name}{optional named parameter: The display name of the column\cr
}
\item{enumValues}{optional named parameter: Columns type of STRING can be constrained to an enumeration values set on this list.\cr
}
\item{defaultValue}{optional named parameter: The default value for this column. Columns of type FILEHANDLEID and ENTITYID are not\cr
allowed to have default values.}

}
\value{
An object of type Column
Expand Down
Loading
Loading