Saravanan666/pypi-org huggingface dataset:
Package: pgapi
pgAPICLI tool and Python library for manipulating Postgres databasesInspiration|Installation|Usage|RoadmapInspirationsqlite-utilsprovides a beautiful
PythonicAPIon
top ofSQLitedatabases.pgAPIis an attempt to lift-and-shift that API and replicate it on top of
Postgres instead.InstallationpipinstallpgAPIUsageDevelopmentpipinstall-e'.[test]'pytestRoadmapv0.1.0MVP aroundpgapi.Databaseto have basic interaction with Postgres,
and be able to run queries returned in Pythonic formats.Tests should pass even if that means minimal coverageCLI should be disableddocs should be disabled or
Package: pgark
pgarkPython library and CLI for archiving URLs on popular services like
Wayback MachineBasically a fork of the greatpastpages/savepagenowHow to useInstall with:$ pip install pgarkThe available subcommands are:check  Check if there is a snapshot of [URL] on the [-s/--service].
  save   Attempt to save a snapshot of [URL] using the [-s/--service].(for now, only the Wayback Machine service is implemented, so ignore-sflag)Saving a snapshot of a URL$ pgark save whitehouse.gov
http://web.archive.org/web/20200904230109/https://www.whitehouse.gov/To get the JSON response with pgark-snapshot metadata and the Wayback
Machine API job status response, pass in-j/--jsonflag:$ pgark -j save whitehouse.gov{"snapshot_url":"http://web.archive.org/web/20200904230109/https://www.whitehouse.gov/","...":"...","server_payload":{"status":"success","duration_sec":10.638,"job_id":"443e89c2-fd3e-4d01-bd35-abfccc3a124a","...":"..."}}See an example of the Wayback Machine's full JSON response in:examples/web.archive.org/job-save-success.jsonChecking if a URL is already snapshottedFor a given URL, to get the latest available snapshot for a URL:$ pgark check whitehouse.gov

http://web.archive.org/web/20200904180914/https://www.whitehouse.gov/To get the JSON response from the Wayback Machine API, pass in the-j/--jsonflag:$ pgark check -j whitehouse.gov{"snapshot_url":"http://web.archive.org/web/20200904180914/https://www.whitehouse.gov/","server_payload":{"archived_snapshots":{"closest":{"timestamp":"20200904180914","status":"200","available":true,"url":"http://web.archive.org/web/20200904180914/https://www.whitehouse.gov/"}},"url":"whitehouse.gov"}}Project statusJust spitballing. Will probably just return to forking savepagenow and
adding any changes/fixes.SeeCHANGELOGfor more detailsSimilar libraries, resources, and inspirationsWayback Machine official docs and stuff"https://archive.org/help/wayback_api.phphttps://github.com/ArchiveLabs/api.archivelab.orghttps://archive.org/services/docs/api/wayback-cdx-server.html?highlight=waybackOther libraries and utilities:https://github.com/pastpages/savepagenowhttps://github.com/jsvine/waybackpackhttps://www.vice.com/en_us/article/wj7mkb/mass-archive-tool-python-wayback-machine-perma-achiveishttps://github.com/motherboardgithub/mass_archivehttps://github.com/sangaline/wayback-machine-scraperOther stuff:https://notes.peter-baumgartner.net/2019/08/01/scraping-archived-data-with-the-wayback-machine/https://pywb.readthedocs.io/en/latest/index.htmlDevelopment notesTo get setup:$ make initTo run tests:$ make testTo freeze Pipfile.lock and resync with setup.py$ make freeze
Package: pg-atlas
Pygame image`s Atlas CreatorThis program makes it easy to create a Atlas using Sprite Sheets created byTexturePackerforPygame.Usage example:
Create Atlas Object from JSON file generated by TexturePackerfrompg_atlasimportPGAtlasatlas=PGAtlas(path='example.json')Then create pygame.Surface from atlas by calling create_image() method with the Frame`s name in JSON file.image=atlas.create_image('example_frame.png')You can also create a list of images by passing list of frame names to create_images() method.images=atlas.create_images(['example_image_1.png','example_image_2.png'])
Package: pgbackup
CLI for backing up remote PostgreSQL databases locally or to AWS S3Preparing the developmentEnsurepipandpipenvare installedClone repository:git clone git@github.com/iamkaushal/pgbackupcdinto repositoryFetch development dependenciesmake installActivate virtualenv:pipenv shellUsagePass in a full database URL, the storage driver, and destination.S3 Example with bucket name:$ pgbackup postgres://bob@example.com/5432/db_one --driver s3 backupsLocal example with local path$ pgbackup postgres://bob@example.com/5432/db_one --driver local /var/local/db_one/backupsRunning testsRun tests locally usingmakeif virtualenv is active:$makeIf virtualenv isn’t active then use:$pipenv run make
Package: pgbackups-py
# pybackups-pyA python port of [pgbackups-archive](https://github.com/kjohnston/pgbackups-archive)that helps in automating Heroku PGBackups and archiving them to Amazon S3.# OverviewThis package provides a python script `pgbackup` that will capture a HerokuPGBackup, wait for it to complete, and then store it within the Amazon S3 bucketyou specify. Best way to use this package is to use heroku scheduler to schedulethis python script at any required durations and get automated offsite backups.This project though can also be used as a library and can be used withinyour own code. The `pgbackup` script can also be runfrom command line to generate adhoc backupsThis package doesn't interfere with or utilze automated backups, so feel free toschedule those with the `pg:backups schedule` command as you desire.# Installationpip install -e pgbackups-py# UsageTo use it with heroku scheduler:#### Install Heroku Scheduler add-onheroku addons:create schedulerSetup an AWS IAM user, S3 bucket and policyA good security measure would be to use a dedicated set of AWS credentials witha security policy only allowing access to the bucket you're specifying. See thisPro Tip on Assigning an AWS IAM user access to a single S3 bucket.#### Configure BackupsThe backups can either be configured by setting environment variables or bypassing arguments to the provided `pgbackup` script. On heroku environemntvariables can be set as below# Requiredheroku config:add HEROKU_API_KEY="collaborator-api-key"heroku config:add PGBACKUPS_APP="myapp"heroku config:add PGBACKUPS_AWS_ACCESS_KEY_ID="XXX"heroku config:add PGBACKUPS_AWS_SECRET_ACCESS_KEY="YYY"heroku config:add PGBACKUPS_BUCKET="myapp-backups"# Optional: If you wish to backup a database other than the one that# DATABASE_URL points to, set this to the name of the variable for that# database (useful for follower databases).heroku config:add PGBACKUPS_DATABASE="HEROKU_POSTGRESQL_BLACK_URL"The `pgbackup` script takes following options-h, --help            show this help message and exit--app APP             Heroku App for which backup needs to be performed--api-key API_KEY     API key for heroku--db DB_NAME          Name of Heroku database--access-key ACCESS_KEYAWS Access Key--secret-key SECRET_KEYAWS SECRET Key--aws-bucket AWS_BUCKETAWS S3 Bucket--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}Log Level--disable-logging     Enable Logging--log-name LOG_NAME   Log Name--storage-opts [STORAGE_OPTIONS [STORAGE_OPTIONS ...]]set additional storage options as key=value--delete-after        Delete backups from heroku after storing to s3####Add the backup task to schedulerheroku addons:open schedulerThen specify `pgbackup` as a command you would like to run at any of the available intervals.## License* MIT license.
Package: pgbar
Easy progress reporting for PythonBarsThere are 7 progress bars to choose from:BarChargingBarFillingSquaresBarFillingCirclesBarIncrementalBarPixelBarShadyBarTo use them, just callnextto advance andfinishto finish:.. code-block:: pythonfrom pgbar.pgbar import Bar

bar = Bar('Processing', max=20)
for i in range(20):
    # Do some work
    bar.next()
bar.finish()or use any bar of this class as a context manager:.. code-block:: pythonfrom pgbar.pgbar import Bar

with Bar('Processing', max=20) as bar:
    for i in range(20):
        # Do some work
        bar.next()The result will be a bar like the following: ::Processing |#############                   | 42/100To simplify the common case where the work is done in an iterator, you can
use theitermethod:.. code-block:: pythonfor pgbar.pgbar in Bar('Processing').iter(it):
    # Do some workProgress bars are very customizable, you can change their width, their fill
character, their suffix and more:.. code-block:: pythonbar = Bar('Loading', fill='@', suffix='%(percent)d%%')This will produce a bar like the following: ::Loading |@@@@@@@@@@@@@                   | 42%You can use a number of template arguments inmessageandsuffix:==========  ================================
Name        Value
==========  ================================
index       current value
max         maximum value
remaining   max - index
progress    index / max
percent     progress * 100
avg         simple moving average time per item (in seconds)
elapsed     elapsed time in seconds
elapsed_td  elapsed as a timedelta (useful for printing as a string)
eta         avg * remaining
eta_td      eta as a timedelta (useful for printing as a string)
==========  ================================Instead of passing all configuration options on instatiation, you can create
your custom subclass:.. code-block:: pythonclass FancyBar(Bar):
    message = 'Loading'
    fill = '*'
    suffix = '%(percent).1f%% - %(eta)ds'You can also override any of the arguments or create your own:.. code-block:: pythonclass SlowBar(Bar):
    suffix = '%(remaining_hours)d hours remaining'
    @property
    def remaining_hours(self):
        return self.eta // 3600SpinnersFor actions with an unknown number of steps you can use a spinner:.. code-block:: pythonfrom pgbar.pgspinner import Spinner

spinner = Spinner('Loading ')
while state != 'FINISHED':
    # Do some work
    spinner.next()There are 5 predefined spinners:SpinnerPieSpinnerMoonSpinnerLineSpinnerPixelSpinnerInstallationDownload from PyPi.. code-block:: shellpip install pgbar
Package: pgbelt
PgbeltPgBelt is a CLI tool used to manage Postgres data migrations from beginning to end,
for a single database or a fleet, leveraging pglogical replication.It was built to assist in migrating data between postgres databases with as
little application downtime as possible. It works in databases running different versions
of postgres and makes it easy to run many migrations in parallel during a single downtime.:exclamation: This is very importantAs with all Data Migration tasks,there is a risk of data loss. Please ensure you have backed up your data before attempting any migrationsInstallationInstall From PyPiIt is recommended to install pgbelt inside a virtual environment:pyenvpyenv-virtualenvYou must also have:Postgres Client Tools (pg_dump, pg_restore). Mac:brew install libpq. Ubuntu:sudo apt-get install postgresql-clientInstall pgbelt locally:pip3 install pgbeltQuickstart with PgbeltSeethis doc!PlaybookThis playbook gets updated actively. If you have any issues, solutions could be found inthis playbook.ContributingWe welcome contributions! Seethis docon how to do so, including setting up your local development environment.
Package: pgbm
PGBMProbabilistic Gradient Boosting Machines(PGBM) is a probabilistic gradient boosting framework in Python based on PyTorch/Numba, developed by Airlab in Amsterdam. It provides the following advantages over existing frameworks:Probabilistic regression estimates instead of only point estimates. (example)Auto-differentiation of custom loss functions. (example,example)Native GPU-acceleration. (example)Distributed training for CPU and GPU, across multiple nodes. (examples)Ability to optimize probabilistic estimates after training for a set of common distributions, without retraining the model. (example)Full integration with scikit-learn through a fork of HistGradientBoostingRegressor (examples)It is aimed at users interested in solving large-scale tabular probabilistic regression problems, such as probabilistic time series forecasting.For more details,read the docsorour paperor check out theexamples.Below a simple example to generate 1000 estimates for each of our test points:frompgbm.sklearnimportHistGradientBoostingRegressorfromsklearn.model_selectionimporttrain_test_splitfromsklearn.datasetsimportfetch_california_housingX,y=fetch_california_housing(return_X_y=True)X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.1)model=HistGradientBoostingRegressor().fit(X_train,y_train)yhat_test,yhat_test_std=model.predict(X_test,return_std=True)yhat_dist=model.sample(yhat_test,yhat_test_std,n_estimates=1000)See alsothis examplewhere we compare PGBM to standard gradient boosting quantile regression methods, demonstrating that we can achieve comparable or better probabilistic performance whilst only training a single model.InstallationSeeInstallationsection in ourdocs.SupportIn general, PGBM works similar to existing gradient boosting packages such as LightGBM or xgboost (and it should be possible to more or less use it as a drop-in replacement).Read the docs for an overview ofhyperparametersand afunction reference.See theexamplesfolder for examples.In case further support is required,open an issue.ReferenceOlivier Sprangers, Sebastian Schelter, Maarten de Rijke.Probabilistic Gradient Boosting Machines for Large-Scale Probabilistic Regression. Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD 21), August 14–18, 2021, Virtual Event, Singapore.The experiments from our paper can be replicated by running the scripts in theexperimentsfolder. Datasets are downloaded when needed in the experiments except for higgs and m5, which should be pre-downloaded and saved to thedatasetsfolder (Higgs) and to datasets/m5 (m5).LicenseThis project is licensed under the terms of theApache 2.0 license.AcknowledgementsThis project was developed byAirlab Amsterdam.
Package: pgbouncer
Copyright (c) 2011, Canonical LtdThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.python-pgbouncer provides a python interface to setup and run a pgbouncer
instance.DependenciesPython 2.6+pgbouncerpython-fixtures (https://launchpad.net/python-fixturesorhttps://pypi.org/project/fixtures)testtools (https://pypi.org/project/testtools)Testing DependenciesIn addition to the above, the tests also depend on:postgresfixture (https://pypi.org/project/postgresfixture)psycopg2 (https://pypi.org/project/psycopg2)subunit (https://pypi.org/project/python-subunit) (optional)testscenarios (https://pypi.org/project/testscenarios)UsageCreate a PGBouncerFixture - a context manager with an extended protocol
supporting access to logs etc. Customise it with database definitions, user
credentials, and then when you enter the context it will create a transient
pgbouncer setup in a temporary directory and run it for the duration that the
context is open.For instance:>>> from pgbouncer import PGBouncerFixture
>>> bouncer = PGBouncerFixture()
>>> bouncer.databases['mydb'] = 'host=hostname dbname=foo'
>>> bouncer.users['user1'] = 'credentials'
>>> with bouncer:
...     # Can now connect to bouncer.host port=bouncer.port user=user1Any settings required for pgbouncer to work will be given sane defaults.InstallationEither run setup.py in an environment with all the dependencies available, or
add the working directory to your PYTHONPATH.DevelopmentUpstream development takes place athttps://launchpad.net/python-pgbouncer.To run the tests, run:$ tox
Package: pg-bulk-ingest
pg-bulk-ingestA Python utility function for ingesting data into SQLAlchemy-defined PostgreSQL tables, automatically migrating them as needed, allowing concurrent reads as much as possible.Allowing concurrent writes is not an aim of pg-bulk-ingest. It is designed for use in ETL pipelines where PostgreSQL is used as a data warehouse, and the only writes to the table are from pg-bulk-ingest. It is assumed that there is only one pg-bulk-ingest running against a given table at any one time.Featurespg-bulk-ingest exposes a single function as its API that:Creates the tables if necessaryMigrates any existing tables if necessary, minimising lockingIngests data in batches, where each batch is ingested in its own transactionHandles "high-watermarking" to carry on from where a previous ingest finished or erroredOptionally performs an "upsert", matching rows on primary keyOptionally deletes all existing rows before ingestionOptionally calls a callback just before each batch is visible to other database clientsVisit thepg-bulk-ingest documentationfor usage instructions.
Package: pgcaw
PGCAW: The Python Github Calendar API WrapperPGCAW is a very simple API wrapper for the github contributions calendar. The wrapper supports extracting data about any given users contribution history,
such as total contributions in the last year and daily contribution numbers.InstallationThe recommended way to install PGCAW is using pip.pip install pgcawUsageTo gather data about a specific Github user you first need to create aContributionsinstance, initialized with the given users username.>>>importpgcaw>>>contributions=pgcaw.Contributions("CGodiksen")Using this instance you can now get data related to the users Github calendar.>>>contributions.total()1758>>>contributions.daily()[(datetime.date(2020,12,20),1),(datetime.date(2020,12,21),1),(datetime.date(2020,12,22),16)]Notice thatdaily()returns a list of tuples with the format[(date, number_contributions_on_date)].The class also contains some utility methods used to extract further information from the contributions graph.>>>daily=contributions.daily()>>>contributions.current_streak(daily)(23,datetime.date(2020,1,12),datetime.date(2020,12,23))>>>contributions.longest_streak(daily)(105,datetime.date(2020,8,10),datetime.date(2020,11,23))Note here that bothcurrent_streak()andlongest_streak()returns a tuple with the format(streak_length, from_date, to_date).
Package: pg_check_and_report
Tool: 2_check_and_reportDescription:This program performs some checks and return a report in case some of these checks fail:
- The number of databases created is under a specific threshold parametrized through the -m argument.
- The disk used by postgresql is not over a percentage of the total disk. The specific percentage is parametrized through the -p argument.
- The number of connections stablished to the database is not over a percentage of the max connections value. The specific percentage is parametrized through the -c argument.How to:Note: The next commands are meant to be run in the same that directory in which this Readme.txt file is stored.Disable any previously activated virtualenv:$ deactivateSetup environment:$ ../../setup_env.shEnable virtualenv:$ source venvs/2_check_and_report/bin/activateGet the program help:$ ./run -vRun the tool (example):This command checks:
the amount of databases is less than 10,
the percentage of partition disk used by postgresql is less than 0.2%, and
the percentage of active connections to the postgresql service is less than 2.5%.$ ./run.py -m 10 -p 0.2 -c 2.5
Package: pgcolorbar
PgColorbar is a color bar (legend) for [PyQtGraph](http://www.pyqtgraph.org/) image plots. It can serve as a replacement for PyQtGraph’s HistogramLUTItem.For more info, see:https://github.com/titusjan/pgcolorbarHistory1.1.3 (2023-02-06)Removed deprecated numpy aliases so it works with numpy 1.24.1.1.2 (2022-11-13)Fix use of deprecated method that was removed from PyQtGraph 0.13.1.1.1 (2021-04-27)Fix setup.py install by adding HISTORY.rst to the source distribution1.1.0 (2021-02-07)Added ‘Drag Lines’ that can be used to change the color range at one side only.Set the histHeightPercentile parameter to 100 % by default.1.0.0 (2019-08-17)First release on PyPI.
Package: pgcom
pgcomCommunication manager for PostgreSQL database, provides a collection of convenience
wrappers over Psycopg adapter to simplify the usage of basic Psycopg methods in conjunction
with Pandas DataFrames.InstallationTo install the package, simply use pip:$ pip install pgcomKey featuresReading from database table to Pandas DataFrame.Writing from DataFrame to a table.Adaptation between DataFrames and COPY FROM.Methods to resolve conflicts in DataFrame before applying COPY FROM.Tools for setting asynchronous communication with database using LISTEN and NOTIFY commands.Read thedocumentationfor more.LicenseMIT License (seeLICENSE).
Package: pgconnstr
pgconnstrA Python module for parsing and manipulating PostgreSQL libpq style connection strings and URIs.LicenseLGPLv3. See the fileLICENSEfor details.class ConnectionStringpgconnstr.ConnectionString represents a libpq connection string.>>>frompgconnstrimportConnectionString>>>c=ConnectionString(host='1.2.3.4',dbname='mydb',port=5432,user='anon',...password="sec'ret",application_name='myapp')...>>>print(str(c))application_name=myappdbname=mydbhost=1.2.3.4password=sec\'ret port=5432 user=anon>>>print(str(ConnectionString(str(c),dbname='otherdb')))application_name=myappdbname=otherdbhost=1.2.3.4password=sec\'ret port=5432 user=anonComponents may be accessed as attributes.>>>c.dbname'mydb'>>>c.host'1.2.3.4'>>>c.port'5432'Standard components will default to None if not explicitly set. Seehttps://www.postgresql.org/docs/12/libpq-connect.html#LIBPQ-PARAMKEYWORDSfor the list of standard keywords.>>>c.connect_timeoutisNoneTrueThe standard URI format is also accessible:>>>print(c.uri)postgresql://anon:sec%27ret@1.2.3.4:5432/mydb?application_name=myapp>>>print(ConnectionString(c,host='2001:db8::1234').uri)postgresql://anon:sec%27ret@[2001:db8::1234]:5432/mydb?application_name=myapp