I have a requirement where any file should be put in the artifact using python language. I tried to search all over internet but I couldn't find any help.
Please share code snippet or something which can help me to achieve this.
Any help is greatly appreciated here.
Artifactory python module can be used to upload artifacts into artifactory.
https://pypi.python.org/pypi/artifactory/0.1.17
Here is an example from the website used to upload a file into artifactory:
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshotlocal/myapp/1.0")
path.mkdir()
path.deploy_file('./myapp-1.0.tar.gz')
The defend against fruit project provides the integration with Artifactory and Python you are looking for.
http://teamfruit.github.io/defend_against_fruit/
Artifactory exposes a REST API. Here's a link to the documentation. See the section on "Deploy Artifact".
Basically you will need to build a REST client. There might already exist one for Artifactory? If you need to write it yourself there is a WADL file that might make things easier (see also wadllib).
Related
I'm trying to use OpenAPI for a Python project.
I've previously used OpenAPI with Java and it was really easy as you could configure it into pom.xml so that you would write a yaml file and then you would get an interface that you could implement into your controller.
I'm now working in Python and I'm trying to do a similar thing where you write an yaml file and get an interface or something similar that you can use.
I've tried openapi-generator-cli generate but it seems like it creates a lot of bloat files as it creates the whole server but I only need a single file that I can use further.
Is there something similar for Python as it is for Java?
Thanks in advance
You may want to try import flask_restx.
Then visit top-level URL of your flask app to see the swagger details.
https://flask-restx.readthedocs.io/en/latest/swagger.html#swaggerui
EDIT
Consider using apispec.
$ pip install -U 'apispec[yaml]'
can try flask-toolkits link very easy to setup as it will generate your openapi/swagger spec. Once you already done your code can try with app.run() then access http://localhost:5000/openapi.yaml
I have a python project with a lot of dependencies (around 30 or so python packages) that i want to deploy on aws using lambda function. Right now i have about 30 custom python packages in my VS solution that i import into the main function - there is a lot of code. What is the best way to build a deployment package and how would i go about doing this?
I watched a few tutorials but i am new to this, so im not sure exactly what concrete steps to take. If i use something like zappa and create a virtual environment how would i then get my project there and install all the dependencies and then zip the file?
Thanks so much, sorry for the stupid questions, i couldn't find a stackoverflow post that covered this
Just go to your python environment folder and found site-package folder (usually in /lib), choose all the dependencies you need and zip them with your code.
I guess it's the easiest way.
For example, I may need beautifulsoup and urllib for dependencies, just zip them (and their dependencies, if needed) with my code, then upload to AWS Lambda, that's all.
BTW, you can also see this gist to know whether the module you need can be directly import to AWS Lambda or not.
I am trying to add BigQuery to a Django-AppEngine project and I am finding a lot of problems in doing that since the google library for BigQuery use a package named google and this folder is already in use for AppEngine purposes. What I find now is that, if I install BigQuery, it will overwrite this package and then nothing works!
Is there maybe someone who faced this problem before and has any idea how to solve this?
It is some way to combine existing folders using pip or something else?
Thanks!!
Possible Solution:
For those who are facing the same problem, I was able to find a solution which was not too bad. Just creating an appengine_config.py file and adding them there:
from google.appengine.ext import vendor
vendor.add('sitepackages/prod')
...but still looking for a better solution.
*note: all my third party libraries are placed there instead of in a lib folder like Google says.
I could solved the problem I was facing by adding an extra appengine_config.py file containing this two lines:
from google.appengine.ext import vendor
vendor.add('sitepackages/prod')
This file is going to be automatically called by google appengine adding the libs on sitepackages/prod(in this case) to the libs on our virtualenv.
Thanks to #snakecharmerb for showing me the way to do this.
I am thinking about doing some test on app engine. And I have read about the library google has originally provided. I wonder what should I do if I want to use some external libraries that were installed before as part of Python2.7 such as Pyaudio and wx..
I was aware of that I should claim the library in the yaml file but what else do I need to do? Will naming and assigning a new environment variable help? If it does help, what paths should I include here? Thanks.
You should read up on the python sandbox and runtime restrictions, https://developers.google.com/appengine/docs/python/#Python_The_sandbox
This tells you how to use other libraries.
The libraries you list can not be used in appengine.
Also read up on 3rd party libraries that are directly supported https://developers.google.com/appengine/docs/python/tools/libraries27
I just documented loads of my code and learnt how to use sphinx to generate the documentation. I want to include that into my GitHub project page but I do not know how to. Does anyone know existing tutorial or simple step to do so?
github will serve static content for you using their github pages feature. Essentially, you create a branch called gh-pages, into which you commit your static pages. The pages are then served at you.github.com/yourproject.
See the instructions at http://pages.github.com/.
You will likely run into an issue using Sphinx on github, because Sphinx uses directories with leading underscores. You can fix this by adding a file called .nojekyll in the the directory with the generated sphinx html.
John Paulett's answer is obviously correct and likely sufficient for most users already (+1).
Alternatively you might want to check out Ben Welsh's thorough tutorial Sphinx documentation on GitHub, which provides step by step instructions as well as a convenient Fabric based script/task tying those together to get you started to Quickly publish documentation alongside your code [...] via a single command.
github-tools has a feature doing exactly what you are asking for:
paver gh_pages_create gh_pages_build
Refer to the excellent documentation (of course using itself) for how to set it up for your project.