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

add API endpoint to create TS repository #2

Merged
merged 1 commit into from
Feb 25, 2015

Conversation

martenson
Copy link
Member

This PR introduces new endpoint at the Tool Shed
you can POST {toolshed_url}/api/repository

{
"name": "new_repo_17",
"synopsis": "new_synopsis",
"description": "this is some repository",
"type": "unrestricted",
"remote_repository_url": "https://github.com/galaxyproject/tools-devteam",
"homepage_url": "https://github.com/galaxyproject/",
"category_ids[]": [ "adb5f5c93f827949", "529fd61ab1c6cc36" ]
}

and you will receive:

{
"deleted": false,
"deprecated": false,
"description": "new_synopsis",
"homepage_url": "https://github.com/galaxyproject/",
"id": "8cf91205f2f737f4",
"long_description": "this is some repository",
"model_class": "Repository",
"name": "new_repo_17",
"owner": "qqqqqq",
"private": false,
"remote_repository_url": "https://github.com/galaxyproject/tools-devteam",
"times_downloaded": 0,
"type": "unrestricted",
"user_id": "adb5f5c93f827949"
}

jmchilton added a commit that referenced this pull request Feb 25, 2015
add API endpoint to create TS repository
@jmchilton jmchilton merged commit e75ad46 into galaxyproject:dev Feb 25, 2015
@dannon
Copy link
Member

dannon commented Feb 26, 2015

This is an automated message. Thanks for your contribution, a Trello card to track this issue has been created. Apply this patch for testing.

@hexylena
Copy link
Member

Thanks @martenson. @jmchilton I'm assuming code for this will need to be added to bioblend for it can be used in planemo?

@jmchilton
Copy link
Member

Good plan! I don't know if I can get to it before the release (there are a lot of bugs left) - but ping after please if I forget - or PR's to bioblend welcome :).

@hexylena
Copy link
Member

Ok, I'll have some time tomorrow for making those PRs, I'll see what I can get done. It's significantly of interest to me to automate that portion.

@bgruening
Copy link
Member

How should we handle this in shed.yml? Simply adding

  • synopsis
  • description
  • type: one out of three?
  • remote_repository_url
  • homepage_url
  • category_ids []

Category list will fail silently if the category does not exists?

@hexylena
Copy link
Member

I was going to use category titles rather than IDs and yes, print a warning
if the category doesn't exist.

Will need to add code to handle updating that information if it gets
changed over time

fre. 27. feb. 2015, 07.43 skrev Björn Grüning [email protected]:

How should we handle this in shed.yml? Simply adding

  • synopsis
  • description
  • type: one out of three?
  • remote_repository_url
  • homepage_url
  • category_ids []

Category list will fail silently if the category does not exists?


Reply to this email directly or view it on GitHub
#2 (comment).

@hexylena
Copy link
Member

hexylena commented Mar 2, 2015

@martenson which parameters are required? name/synopsis/description?

@bgruening
Copy link
Member

afaik, description is not required ...

@hexylena
Copy link
Member

hexylena commented Mar 2, 2015

@martenson @bgruening never mind...it's documented in the docstring. Thanks @martenson!

@martenson martenson deleted the ts-api-create-repo branch March 5, 2015 21:38
hexylena referenced this pull request in hexylena/galaxy May 6, 2015
jmchilton referenced this pull request in jmchilton/galaxy May 11, 2015
Updates to take advantage of galaxyproject#229 infrastructure
guerler added a commit that referenced this pull request May 13, 2015
Add a library_data input test case and small fix.
natefoo referenced this pull request in natefoo/galaxy May 13, 2015
add some trello card links to release notes
jmchilton pushed a commit that referenced this pull request Jul 2, 2015
carlfeberhard added a commit that referenced this pull request Jul 23, 2015
Tweak a few indentations to avoid kicking toplevel parameters into se…
dannon referenced this pull request in dannon/galaxy Jul 29, 2015
Merge Reports_homepage against latest dev.
blankenberg added a commit that referenced this pull request Aug 25, 2015
Collect error messages (which fixes the current travis build), some other cleanup for sanity.
hexylena pushed a commit that referenced this pull request Oct 14, 2015
jmchilton pushed a commit that referenced this pull request Dec 3, 2015
Remove deprecated datatype stuff
nsoranzo added a commit that referenced this pull request Dec 10, 2015
Adjustments to sanitize_whitelist reloading.
dannon pushed a commit that referenced this pull request Oct 26, 2017
A few more tweaks to tours
dannon pushed a commit that referenced this pull request Dec 22, 2017
A first pass on the "admin" UI related section
dannon pushed a commit that referenced this pull request Feb 7, 2018
Minor tweaks to i18n work
martenson pushed a commit that referenced this pull request Mar 2, 2018
More general safe_walk function, handles symlinks loops
jmchilton pushed a commit that referenced this pull request Jan 18, 2019
ThanKarab referenced this pull request in madgik/galaxy Mar 6, 2019
martenson pushed a commit that referenced this pull request Mar 7, 2019
Fix test tool label and tool xsd
afgane pushed a commit that referenced this pull request Apr 8, 2019
Use a base URI set in config for Custos Authnz backend.
dannon pushed a commit that referenced this pull request May 14, 2019
almahmoud referenced this pull request in almahmoud/galaxy Oct 10, 2019
mvdbeek pushed a commit that referenced this pull request Sep 22, 2020
fix crash when no input selected
jdavcs referenced this pull request in jdavcs/galaxy Jun 15, 2021
1. Remove `item` instance attribute: it's not used and is meaningless.
2. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
3. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
4. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jun 15, 2021
1. Remove `item` instance attribute: it's not used and is meaningless.
2. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
3. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
4. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jun 16, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jun 16, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jun 16, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jun 23, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jul 1, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jul 2, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Jul 6, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Aug 12, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Sep 1, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Sep 7, 2021
1. Remove id parameter from constructor (this is created by the db).
2. Remove `item` instance attribute: it's not used and is meaningless.
3. Make user and item parameters in the constructor required: a rating
   cannot exist without a rater or the item being rated.
4. For the same reason as in #2, make the `set_item()` method private
   and only call it from the constructor.
5. Simplify mapping test: just use the constructor.
jdavcs referenced this pull request in jdavcs/galaxy Feb 8, 2024
Reason: late evaluation of arguments causes errors in mypy;
also this seems to be the more common (as per SA docs) and more readable
method compared to lambdas.

Downside #1: a typo in the string value won't be caught by lint tools.
Downside #2: if there's a sufficiently complex statement, it will be
hard to read if it's all on one line;

primaryjoin = "and_(HistoryDatasetAssociation.history_id == History.id, not_(HistoryDatasetAssociation.deleted), HistoryDatasetAssociation.visible)"

splitting across lines will require surrounding each line with quotes:

primaryjoin = (
   "and_("
   "HistoryDatasetAssociation.history_id == History.id,"
   "not_(HistoryDatasetAssociation.deleted),"
   "HistoryDatasetAssociation.visible,"
    ")"
)

Still, I think it's better than the alternative (lambda + multiple type-ignores
after each line:

primaryjoin = lambda(
   and_(
        HistoryDatasetAssociation.history_id == History.id,  # type:ignore[has-type, arg-type]
        not_(HistoryDatasetAssociation.deleted),  # type:ignore[has-type, arg-type]
        HistoryDatasetAssociation.visible,  # type:ignore[has-type, arg-type]
    )
)
mvdbeek pushed a commit that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants