{"id":13567232,"url":"https://github.com/michelp/postgresql-wheel","last_synced_at":"2025-05-11T15:43:47.797Z","repository":{"id":40474533,"uuid":"399632805","full_name":"michelp/postgresql-wheel","owner":"michelp","description":"A Python wheel containing PostgreSQL","archived":false,"fork":false,"pushed_at":"2022-06-26T12:26:52.000Z","size":63,"stargazers_count":78,"open_issues_count":3,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-22T18:51:34.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michelp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-24T23:39:00.000Z","updated_at":"2025-03-05T12:18:13.000Z","dependencies_parsed_at":"2022-09-04T23:22:29.568Z","dependency_job_id":null,"html_url":"https://github.com/michelp/postgresql-wheel","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpostgresql-wheel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpostgresql-wheel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpostgresql-wheel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpostgresql-wheel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michelp","download_url":"https://codeload.github.com/michelp/postgresql-wheel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253439965,"owners_count":21909042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:26.399Z","updated_at":"2025-05-10T15:39:14.231Z","avatar_url":"https://github.com/michelp.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# postgresql-wheel\n\nA Python wheel for Linux containing a complete, self-contained,\nlocally installable PostgreSQL database server.\n\nAll servers run as the Python process user in a local path, so this\nwheel does not require root or sudo privledges.  Databases can be\ninitialized in any directory.\n\nServers can be setup and torn down in test fixtures with no additional\noutside dependencies.\n\nCurrently this wheel only works for most flavors of Linux.\n\nPostgres is compiled in the same \"manylinux\" environments provided by\nthe [cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/)\ntool using [Github\nActions](https://github.com/michelp/postgresql-wheel/blob/main/.github/workflows/wheels.yml)\nand directly archived into the wheel's \"package_data\".\n\nThe wheel can be installed with pip:\n\n```\n$ pip install postgresql-wheel\n```\n\nPostgres binaries in the package can be found in the directory pointed\nto by the `postgresql.pg_bin` global variable.  Function wrappers\naround all of the postgres binary programs, like `initdb` and `pg_ctl`\nfunctions are provided for convenience:\n\n```py3\n\u003e\u003e\u003e from postgresql import initdb, pg_ctl\n\u003e\u003e\u003e initdb('-D testdatabase')\n\u003e\u003e\u003e pg_ctl('-D testdatabase -o \"-p 5678\" -l testdatabase.log start')\n\n\u003e\u003e\u003e import psycopg2\n\u003e\u003e\u003e c = psycopg2.connect(\"postgres://localhost:5678/postgres\") # connect with local client\n\u003e\u003e\u003e with c.cursor() as q:\n\u003e\u003e\u003e     q.execute(\"select version()\")\n\u003e\u003e\u003e     print(q.fetchall())\n...\n[('PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3), 64-bit',)]\n\u003e\u003e\u003e pg_ctl('-D testdatabase stop')\n\n```\n\nFor the purposes of testing, convenience functions are provided for\nsetting up and tearing down databases:\n\n```py3\n\u003e\u003e\u003e pgdata, con_str = postgresql.setup()\n\u003e\u003e\u003e postgresql.psql(f'-h {con_str} -c \"select version()\"')\n\u003e\u003e\u003e postgresql.teardown(pgdata)\n```\n\nThere is also a pytest fixture called `tmp_postgres` that returns a\nnew connection string to a temporary database local domain socket, and\ncan be used in a pytest:\n\n```py3\n\u003e\u003e\u003e from postgresql import tmp_postgres\n\u003e\u003e\u003e def test_foo(tmp_postgres):\n...    postgresql.psql(f'-h {tmp_postgres} -c \"select version()\"')\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fpostgresql-wheel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichelp%2Fpostgresql-wheel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fpostgresql-wheel/lists"}