Saravanan666/pypi-org huggingface dataset:
Package: simple-gcp-project-switcher
Simple GCP Project Project SwitcherHave you ever struggled to switch between GCP projects locally ?
Here is a simple CLI to switch between GCP projects easily.RequirementsGCLOUD SDK has to be installed on your machine and you have to be logged inUsageIf you want to list all projects before choosing onepswitchIf you want to search for a specific term in the project name or project idpswitch searchTermYou will see the following output to choose your project rom:$ pswitch mycompanyName
[0] : mycompany-380102 (mycompany)
[1] : mycompany-airbyte (mycompany-airbyte)
[2] : mycompany-chatbot (mycompany-chatbot)
[3] : mycompany-etl (mycompany-etl)
[4] : mycompany-ga4-lehoublon-flo (mycompany-ga4-lehoublon-flo)
[5] : mycompany-guillaume-pde (mycompany-guillaume-pde)
[6] : mycompany-n8n (mycompany-n8n)
[7] : mycompany-terraform (mycompany-terraform)
Enter project number to switch to:If you prefer ordering by name than ordering by idpswitch --nameIf you want to automatically switch to the first found projectpswitch searchTerm -a
Package: simple-gdrive
simple-gdrive: A simple command to help download and upload big files to Google Drive (using their official APIs)SetupBefore using the command, you must open Google Cloud Platform and create credentials for oauth:cloud.google.com> APIs & Services > Credentials. Note that if your project hasn't enabled Drive APIs, go to APIs & Services > Enabled APIs & Services and add Drive APIs.
Then, download the JSON file and put it in the AuthDir (default at~/.simple_gdrive) with the namecredentials.json. When you run the script for the first time, it will redirect to your browser so you can authenicate and give permission to YOUR application (created in the previous step) to access to your drive. Then, you will obtain an access token saving to the same drive with nametokens.json. Keeping the two files safe (or deletetokens.jsonafter usage) and nobody else will have access to your data.Installationpipinstallsimple-gdriveUsageInvoke the command by runninggdriveorpython -m simple_gdrive.Download a file:gdrivedownload-s<pathindisk>-d<pathindrive>Upload a filegdriveupload-s<filepathindisk>-d<pathindrive>For example:gdrivedownload-s//KGData/Wikipedia/20220420/enwiki-NS0-20220420-ENTERPRISE-HTML.json.tar.gz-denwiki.json.tar.gzgdriveupload-s./enwiki-NS0-20220420-ENTERPRISE-HTML.json.tar.gz-d//KGData/Wikipedia/20220420/enwiki-NS0-20220420-ENTERPRISE-HTML.json.tar.gzIf the path in Google drive startswith/, the top folder/file will be in your drive (e.g.,/abcpoints to the folderabcin your drive). If it starts with//, the first level will be the name of the shared drive and the second level will be the folder/file in the shared drive (e.g.,//KGData/abcpoints to the folderabcin KGData shared drive).
Package: simple-geocoding
Simple geocodingInstall & SettingDownload latest.csv fromhttps://geolonia.github.io/japanese-addresses/.pip install simple-geocoding
python -c '__import__("simple_geocoding").Geocoding("/path/to/latest.csv")'Usage$ simple-geocoding 東京都千代田区丸の内一丁目
(35.68156, 139.767201)

$ simple-geocoding 35.68156 139.7672
東京都千代田区丸の内一丁目
Package: simplegeoip
Dead simple geoip package. Pretty much just a wrapper aroundmaxminddbthat automatically downloads the geolite database for you. You can either do this manually using the ‘download_latest_database’ function
or let the script do it automatically when it detects no database is installed.Can be used as a package or standalone script.InstallpipinstallsimplegeoipUsageAs a python package.importsimplegeoip# Gets a dict with country/city information, if there is no database it will be downloaded automaticallysimplegeoip.lookup('127.0.0.1')# Downloads an updated database into simplegeoip's application directorysimplegeoip.download_latest_database()# Tells you when the database was last updated by maxmindsimplegeoip.last_updated()# Returns a maxminddb reader object, if there is no database it will be downloaded automaticallysimplegeoip.reader()The same as above but as a standalone scriptsimplegeoip8.8.8.8simplegeoipupdatesimplegeoipinfo
Package: simple-geoip
The simplest possible way to get IP geolocation information in Python.MetaAuthor: Randall DeggesEmail:r@rdegges.comTwitter:https://twitter.com/rdeggesSite:http://www.rdegges.comStatus: production readyPrerequisitesTo use this library, you’ll need to create a free GeoIPify account:https://geoipify.whoisxmlapi.com/If you haven’t done this yet, please do so now.InstallationTo installsimple-geoipusingpypi, simply run:$pipinstallsimple-geoipIn the root of your project directory.UsageOnce you havesimple-geoipinstalled, you can use it to easily find the
physical location of a given IP address.This library gives you access to all sorts of geographical location data that
you can use in your application in any number of ways.fromsimple_geoipimportGeoIPgeoip=GeoIP("your-api-key");try:data=geoip.lookup("8.8.8.8")exceptConnectionError:# If you get here, it means you were unable to reach the geoipify# service, most likely because of a network error on your end.exceptServiceError:# If you get here, it means geoipify is having issues, so the request# couldn't be completed :(except:# Something else happened (non-geoipify) related. Maybe you hit CTRL-C# while the program was running, the kernel is killing your process, or# something else all together.print(data)Here’s the sort of data you might get back when performing a geoip lookup
request:{"ip":"8.8.8.8","location":{"country":"US","region":"California","city":"Mountain View","lat":37.40599,"lng":-122.078514,"postalCode":"94043","timezone":"-08:00"}}By default, this library handles retrying failed HTTP requests for you. For
instance: if the GeoIPify API service is currently down or having issues,
your request will be retried up to three consecutive times before failing.ChangelogAll library changes in descending order.Version 0.1.1August 4, 2020WhoisXML API Tech Support has fixed issues due to obsolete
commands. It is now Python 3.8 compatible, and has been also tested
with Python 3.6 and 2.7.Version 0.1.0Released April 26, 2018.First release!
Package: simplegeoip2
A Python module and CLI tool that returns IP address ownership and location information based on MaxMind’s GeoLite2
databasesusage: geoip          [-h] [-d DATABASE_DIRECTORY] [-v]
                      ip_address [ip_address ...]

positional arguments:
  ip_address            One or more IP addresses to look up

optional arguments:
  -h, --help            show this help message and exit
  -d DATABASE_DIRECTORY, --database-directory DATABASE_DIRECTORY
                        Overrides the path to the directory containing MaxMind
                        databases
  -v, --version         show program's version number and exitPrerequisitesIn order to usesimplegeoip2, you must have the MaxMind GeoLite2 databases on your system. This simplest way to do
this is to use thegeoipupdatetool from MaxMind.https://github.com/maxmind/geoipupdateInstallationWhile this script should work under Python 2 and 3, using Python 3 for your OS is strongly recommended.On Debian or Ubuntu systems, run:$ sudo apt-get install python3-pipPython 3 installers for Windows and macOS can be found athttps://www.python.org/downloads/To install or upgrade to the latest stable release of checkdmarc on macOS or Linux, run$ sudo pip3 -U install simplegeoip2Or, install the latest development release directly from GitHub:$ sudo pip3 -U install git+https://github.com/domainaware/simplegeoip2.gitNote to Windows usersOn Windows,pip3ispip, regardless if you installed Python 2 or 3. So on Windows, simply
substitutepipas an administrator in place ofsudo pip3, in the above commands.Bug reportsPlease report bugs on the GitHub issue trackerhttps://github.com/domainaware/simplegeoip/issues
Package: simplegeomap
SimpleGeoMapGiven a center latitude, longitude and a zoom level simply plot all
country boundaries, rivers, lakes, elevation contour lines that fit on
the map, using offline data. This package is self-contained, it does
not need net connectivity to get its data.Each land feature can be enabled through its API call.Installationpip install simplegeomapHow To Useimportmatplotlib.pyplotaspltimportsimplegeomapclat,clon=41,14;zoom=1.0simplegeomap.plot_countries(clat,clon,zoom)simplegeomap.plot_water(clat,clon,zoom)simplegeomap.plot_elevation(clat,clon,zoom)plt.savefig('map.jpg',quality=30)Regions can be plotted by passing polygon points in an N x 2 numpy array to theplot_regioncall. This call assumes the last point connects to the first point,
hence creating a closed region. If we want the points to represent a curve/line,
without the end connecting to its beginning, thenplot_linecan be used.Datafiles, PreprocessingPreprocessing when necessary has already been executed, their result
are already placed inside the package. Listed below are sources, steps
just in case, if one wants to preprocess with different parameters, so on.Country Border Datafile comes fromhereFor water regions the lake/river data fromNOAAwas used.In order to regenerate the water file from its raw sources, seeutil.preprocess_GSHHS, assuming the data is unzipped under/tmpit
will recreate the datafile.Cities.
The only addition here was a new column for asciified city names usingimport unidecode; unidecode.unidecode(..).Elevation Data is taken from NOAA, datafile is fromheredownload "all files in on zip", extract zip under /tmp, then runutil.preprocess_GLOBE.
GLOBE means Global Land One-kilometer Base Elevation, meaning the resolution of
each grid is 1 km square.LinksProgramming Articles on Python, ITLinear Algebra, Calculus
Package: simple-geometry
Python GeometryInstallpipinstallsimple-geometryFeaturesCreate simple shapesaxis-aligned rectanglesaxis-aligned path segmentsgroups containing other shapesManipulate shapesstretch aligntranslation alignVisualize shapesRead more in thefull documentation.Example# Create some shapesfromgeometryimportRectbig=Rect[100,100,'blue']small=Rect[50,50,'red']# Translate relativelysmall.translate(center=big.top_right)# Some topologytiny=big.intersection(small).copy('green')# Visualize themfromgeometryimportCanvasc=Canvas(width=200,height=200)c.append(big)c.append(small)c.append(tiny)# This draws the shapes in jupyter notebookc
Package: simplegexf
# Simple GEXFA simple `.gexf` parser / writer for python**Notice:** This is currently work in progress, and I hope to be able to create documentation in the future when I've settled on the overall structure.## Motivation:The official [`pygexf`](https://github.com/paulgirard/pygexf) is poorly maintained and almost not documented at all. I needed a simple abstraction layer for the `XML` format for my project.This project uses [`xmltodict`](https://github.com/martinblech/xmltodict), which means it's much easier to understand and debug than `pygexf` which uses `lxml`.This is a tool for those who'd rather spend their time learning about something more interesting and worthwhile than `XML`.## Usage:~~~pythonfrom simplegexf import Gexf, Edgegexf = Gexf('tags.gexf')try:graph = gexf.graphs[0]except IndexError:graph = gexf.add_graph(defaultedgetype="directed")# Define Graph attributesgraph.define_attributes([('description', 'string'),('count', 'integer'),])# Define Edge attributes for Graphgraph.define_attributes([('relation_type', 'string'),], _class='edge')nodes = {node.id: node for node in graph.nodes}tags = [{id: 0,name: 'Test tag 1',description: 'This is a test tag',},{id: 1,name: 'Test tag 2',description: 'This is a test tag',parents: [0],},{id: 2,name: 'Test tag 3',description: 'This is a test tag',parents: [0, 1],}]# Create nodes for tags:for tag in tags:try:# See if node exists:node = nodes[str(tag['id'])]except KeyError:# Create a new node:node = self.graph.add_node(id=str(tag['id']), label=tag['name'])# Update node:node.set('viz:size', value=10.0)node.set('viz:color', r=130, g=130, b=130)# Update node attributes:for attr in self.graph.node_attributes.keys():try:node.attributes[attr] = tag[attr]except KeyError:try:del node.attributes[attr]except IndexError:passnodes = {node.id: node for node in graph.nodes}# Create edges for tags:for tag in tags:try:for parent_id in tag['parents']:edge = Edge(parent_id, tag['id'])graph.edges.append(edge)# Attributes are not available before adding edge to graphedge.attributes['relation_type'] = 'parents'except KeyError:passgraph.sort_nodes(attr='count', reverse=True)gexf.write()~~~
Package: simplegist
Python wrapper forGitHub's Gist API.FeaturesCreate Gists and get url, script and clone link on success (can be used for copy-paste purpose too)View one’s Gist(s) - name, description and it’s contentEdit and Delete a gistSearch Gist(s) of any user; fork, star and unstar themList all comments on any Gist, put/edit/delete a comment on a GistInstallation$pipinstallsimplegistDownloadhereand runpython setup.py installafter changing directory to/simplegistGenerating Github API Access TokenGo to Github’s Account settings > ApplicationsCreate a new tokenand use it for making API requests instead of passwordExample UsagefromsimplegistimportSimplegistghGist=Simplegist(username='USERNAME',api_token='API_TOKEN')# or provide USERNAME and API_TOKEN in config.py file, so just, ghGist = Gist()# creating gist and getting url, script and clone linkghGist.create(name='_GISTNAME',description='_ANY_DESCRIPTION',public=1,content='_CONTENT_GOES_HERE')# List down all the names of authenticated user's GistsghGist.profile().listall()# List down only the names of recent two Gists of user '_USERNAME'ghGist.search('_USERNAME').list(2)# List down all the comments on gist named '_GISTNAME' of user 'USERNAME'ghGist.comments().listall(user='_USERNAME',name='_GISTNAME')# ...and many more...Full Usage and DocumentationVisit hereREADTHEDOCSorPYTHONHOSTEDPatches and suggestions are welcome$gitclonehttps://github.com/softvar/simplegist.git$cdsimplegist
Package: simplegit
# simplegit
A python module for simple interaction with git via subprocess.### How?` # pip install simplegit `(note: this doesn’t work via pip yet. Working on that.)`python from simplegit import Git git = Git() output_lines, returncode, error_lines = git.status() `### Why?
In personal projects, I always find myself writing scripts to automate parts of the development process. One example is checking out agh-pagesbranch for a Github Pages website, pushing togh-pages, then checking outmasteragain - usually I have a script calledpush.pywhich automates this. If you’re conditionally ignoring files based on the branch, you have even more processing to do (including extra commits). It’s kind of clumsy to execute these git commands using python’ssubprocess, so simplegit provides a nice wrapper.### How does it work?
TheGitclass form simplegit simply takes a call to it (for exampleGit().status(“-s”)), builds a subprocess command, executes it, and returns the relevant information. Any git command (e.g. status, commit, push, pull) is available, since the python object blindly proxies the function name to build the command (e.g.git.add(“-A”)->git add -A). Some examples:`python lines, rtncode, err_lines =git.status("-s")lines, rtncode, err_lines =git.commit("-m'A funmessage'")`If you need to call a git command that would produce a python syntax error, like ls-files, you can useGit().call:`pythongit.call("ls-files","--others--exclude-standard")`### Contributing
Right now, this is just a one-off side project that I started. If you’d like to contribute or have ideas, pull requests are welcome!
Package: simple-git-changelog
simple-git-changelogsimple-git-changelogis a command-line tool for creating and updating a git project's changelog
file.LinksSource codeCreate the Changelog FileTo create your project's changelog file, run simple-git-changelog in your project's root directory:$simple-git-changelogBy default, the "CHANGELOG.md" file is created with your project's changes. For example:# Changelog## 2021-04-30-[abcdf0](https://github.com/username/project-name/commit/abcdf0) most recent change-[abcdef](https://github.com/username/project-name/commit/abcdef) previous changeEdit "CHANGELOG.md" as appropriate and commit. Changes to the changelog title are maintained across
updates.Update the Changelog FileTo update your changelog file, simply run simple-git-changelog again. Change items for new git
changes are added to the top of the changelog:# MyProject Changelog## 2021-05-01-[abcdf1](https://github.com/username/project-name/commit/abcdf1) one more thing## 2021-04-30-[abcdf0](https://github.com/username/project-name/commit/abcdf0) most recent change-[abcdef](https://github.com/username/project-name/commit/abcdef) previous changeUsageusage: simple-git-changelog [-h] [-o FILE]

options:
  -h, --help  show this help message and exit
  -o FILE     specify the change log file (default is "CHANGELOG.md")DevelopmentThis package is developed usingpython-build.
It was started usingpython-templateas follows:template-specialize python-template/template/ simple-git-changelog/ -k package simple-git-changelog -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapi 1
Package: simple-github
simple-githubA simple Python Github client that handles auth and provides easy access to the
REST and GraphQL APIs.Why use simple-github?You might consider simple-github if..You don't want to write your own auth (especially app auth) but also don't
want to be stuck with an object oriented wrapper.You want to use both the REST and GraphQL endpoints.FeaturesAuthenticate with a personal access token, as a Github App or a Github App
installation.Automatic refreshing of app tokens on expiry.Query both the REST and GraphQL endpoints.Sharedaiohttpsession across both endpoints.InstallationInstall withpip:pipinstallsimple-githubExample UsageAuthenticate with an access tokenIn the simplest case, you can provide an access token to use:fromsimple_githubimportTokenClienttoken="<access token>"asyncwithTokenClient(token)assession:awaitsession.get("/octocat")If calling synchronously, simply remove theasync/awaitfrom the
examples:fromsimple_githubimportTokenClienttoken="<access token>"withTokenClient(token)assession:session.get("/octocat")Authenticate as a Github App installationTo authenticate as an app installation you'll need:The Github app id for your app.A private key associated with your app. This can be generated from your
app's settings page.The organization or user where the app is installed.Optionally a list of repositories to limit access to.fromsimple_githubimportAppClientapp_id=123privkey="<private key>"owner="mozilla-releng"asyncwithAppClient(app_id,privkey,owner=owner)assession:awaitsession.get("/octocat")You can also specify repositories if you want to restrict access.asyncwithAppClient(app_id,privkey,owner=owner,repositories=["simple-github"])assession:awaitsession.get("/octocat")Authenticate as a Github AppYou can also authenticate as the app itself. This is mainly only useful for
administering the app. To do this, simply omit theownerargument.asyncwithAppClient(app_id,privkey)assession:awaitsession.get("/octocat")Query the REST APIsimple-github provides only a very basic wrapper around Github's REST API. You can
query it by passing in the path fragment tosession.getorsession.post.For example, you can list pull requests with aGETrequest:pulls=awaitsession.get("/repos/mozilla-releng/simple-github/pulls")open_pulls=[pforpinpullsifp["state"]=="open"]Or you can create a pull request with aPOSTrequest:data={"title":"Add feature X","body":"This adds new feature X","head":"simple-github:featureX","base":"main",}awaitsession.post("/repos/mozilla-releng/simple-github/pulls",data=data)Query the GraphQL APIsimple-github also supports the GraphQL API. In this example we get the contents
of a file:query="""query getFileContents {repository(owner: "mozilla-releng", name: "simple-github") {object(expression: "HEAD:README.md") {... on Blob {text}}}}"""contents=awaitsession.execute(query)You can use GraphQL variables via thevariablesargument tosession.execute.
Package: simple-git-infos
Git infosLightful Git infos library without pretentionIt uses shell commands to get git infos.Installationpip install simple-git-infosUsageImportgitinfosmoduleCurrent functions are simple and easy to understandget_current_git_branch()get_full_commit()get_short_commit_id()get_tag()Samplefromsimple_git_infosimportgitinfosprint(f"BRANCH:{gitinfos.get_current_git_branch()}")print(f"COMMIT:{gitinfos.get_full_commit()}")print(f"ID:{gitinfos.get_short_commit_id()}")print(f"TAG:{gitinfos.get_tag()}")will outputBRANCH: main
COMMIT: commit b78468a45489eec3ea6b816f5b28f7093d9bac4b
Author: marc dexet <marc.dexet@ias.u-psud.fr>
Date:   Fri Feb 3 08:41:52 2023 +0000

    Initial commit
ID: b78468a
TAG: 0.0.1All functions could be pointed to any locationfull_commit=gitinfos.get_full_commit(cwd='/home/user/somewhere/')
Package: simplegitweb
simplegitwebA Python git web server that base on dulwich lib.installpython setup.py install
or pip install simplegitweb
then find and run bash script "simplegitweb/systemd/install_service.sh" install systemd serviceusegitwebserver.pyfromsimplegitwebimportgitwebserverasgitwebif__name__=='__main__':gitweb.main()simplegitweb.conf[DEFAULT]scanpath=/opt/simplegitweb/listen_address=127.0.0.5port=3000python gitwebserver.py --config simplegitweb.confUse browser to browse thisdefault addressyou can add your project.caddy proxy examplehttps://example.com{proxy/http://127.0.0.5:3000basicauth/'your name''password'tlsexample@example.com}
Package: simple-glogging
Simple Loggingsimple-logging is a Python package that contains methods for interacting with logging package.Installation and updatingUse the package managerpipto install simplelogging like below.
Rerun this command to check for and install  updates .pipinstallsimpleloggingUsageOn the host or client code please add a directory at the root level, name it resources.
Create a ymal file for log configuration
below are the simple configuration templatehandelers:file:filepath:'logs/appLog_{:%Y-%m-%d}.json'formate:'%(asctime)s %(levelname)s %(name)s %(module)s %(funcName)s %(filename)s %(lineno)s %(message)s'loglevel:DEBUGconsole:formate:'%(asctime)s %(levelname)s %(name)s %(module)s %(funcName)s %(filename)s %(lineno)s %(message)s'loglevel:DEBUGdefault_loglevel:ERRORdefault_formate:'%(asctime)s %(levelname)s %(name)s %(module)s %(funcName)s %(filename)s %(lineno)s %(message)s'How to create distributionDelete existing dist folder on project root directoryExecute below command on project root directory
** python3 setup.py sdistHow to upload distribution to pypi
python3 -m twine upload --repository pypi dist/*Usage:root_log_name = 'ROOT_LOGGER'
sl = SimpleLogging(root_log_name)
sl.logger.info("This is from root logging")
sl.getLogger("Child logger").info("This is child logger")
sl.initializeLogger()
print("==================After Initializing =========================")
log = sl.getLogger("Child1")
log.info("This is info in child 1 logger")
log.error("This is error in child 1 logger")print("=================== After Updating ============================")
change_settings = {'level':'DEBUG'}
sl.updateLogger(**change_settings)log = sl.getLogger("Child2")
log.info("This is info in child 2 logger")
log.debug("This is debug in child 2 logger")
log.error("This is error in child 2 logger")