Skip to main content

PostgreSQL for novices

📄 Documentation

This README is meant for developers of the project, and not for end users. For end users, please see the documentation linked above.

Notes for developers

Poetry

This project uses Poetry for packaging. Although one should refer to Poetry docs for a thorough introduction, here's a short summary of the intended workflow with Poetry:

  • To install all dependencies and the application, type poetry install. After installation, if the Python scripts folder is in your PATH, you should be able to invoke main.main() with pg4n.
  • To make VS Code use Poetry's virtual environment, type poetry env info, copy virtual environment executable path, press F1 and type Python: Select Interpreter > Enter interpreter path... > paste path and press <ENTER>.
  • To add/remove a dependency, type poetry add <dep>/poetry remove <dep>.
  • To execute a command from within virtual environment shell, type poetry run <cmd>.
  • To enter a shell session within the Poetry virtual environment, type poetry shell.

Versioning

You can bump the version number automatically with poetry version patch, poetry version minor, etc. See poetry version -h.

See version history here.

Imports

During development, you must run the program as a module, e.g., poetry run python -m src.pg4n.main, so that the imports work.

Running tests

Having PostgreSQL running on port 5432, do poetry run pytest.

You may need to provide environment variables that match your config:

Variable Default value Description
PGHOST 127.0.0.1 Hostname of the PostgreSQL server.
PGPORT 5432 Port to an active PostgreSQL instance.
PGUSER postgres The user that will be used to manage the test database.
PGPASSWORD Password, in case password authentication is used.
PGDBNAME test_database Database name.

For example, if PostgreSQL is on port 5433, just do PGPORT=5433 poetry run pytest (Bash syntax).

Using docker

To get a similar PostgreSQL instance as with GitHub Actions workflow:
docker run --rm -P -p 127.0.0.1:5432:5432 --name pg -e POSTGRES_PASSWORD=postgres -d postgres:14.5-alpine

You'll need to tell pytest the password: PGPASSWORD=postgres poetry run pytest.

Building documents

  1. If docs/api is not up-to-date or doesn't exist, run:
    poetry run sphinx-apidoc -f -o docs/api src/pg4n '*/test*'
  2. To generate the documentation:
    poetry run sphinx-build -b html docs docs/build

Note that the GitHub Pages site is only updated on pushes to main branch.

Linters and formatters

For linting, the following tools are used:

  • black for formatting
  • pylint for linting
  • mypy for static type checking
  • isort for sorting imports

To get a grade that the CI/CD pipeline would give you, you can do poetry run scripts/ci-grade.sh to run all the checks. The output is possibly long, so pipe it to a file perusal filter such as less to scroll through it and search for things of concern, e.g., summary to see scores.

Githooks

This project uses poetry-githooks to run automatic formatting on each commit. To set this up, run:

poetry run githooks setup

This needs to be re-run each time the [tool.githooks] section is modified in the pyproject.toml file.

One can skip pre-commit hooks by running git commit with the --no-verify flag.

Metadata

Release files for pg4n 1.0.0.65

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pg4n 1.0.0.65
File Size Uploaded Provenance Actions
pg4n-1.0.0.65.tar.gz 107.4 kB Without provenance Details for pg4n-1.0.0.65.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pg4n 1.0.0.65
File Interpreter ABI Platform Actions
pg4n-1.0.0.65-py3-none-any.whl Python 3 none any Details for pg4n-1.0.0.65-py3-none-any.whl

Total release size: 223.5 kB

Release files / pg4n-1.0.0.65.tar.gz

Download URL pg4n-1.0.0.65.tar.gz
Size 107.4 kB
Tags Source
SHA-256 checksum
How to use checksums
50749b3221f774de2255d4671628500728fcd14bcb4c95e81a6eb936294eadb1
BLAKE2b-256 checksum
How to use checksums
41210c76906bdac0bd712f6810978c69530500d45d1e129860842b48f2386a2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1024-azure

Release files / pg4n-1.0.0.65-py3-none-any.whl

Download URL pg4n-1.0.0.65-py3-none-any.whl
Size 116.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ff0488e090ab54b67e0445f7f67e6fd60839a0d3c366e652ef4bc8e71fc9a8b
BLAKE2b-256 checksum
How to use checksums
edc485a90dd30415d25ed36f5a48ce481a036e6015b7979399eb67b6bff2c183
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1024-azure

Security for pg4n 1.0.0.65

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0.65 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page