# The Hypermodern Python Project
[![Tests](https://github.com/GuyHoozdis/hypermodern-python/workflows/Tests/badge.svg)](https://github.com/GuyHoozdis/hypermodern-python/actions?workflow=Tests)
[![Codecov](https://codecov.io/gh/GuyHoozdis/hypermodern-python/branch/master/graph/badge.svg)](https://codecov.io/gh/GuyHoozdis/hypermodern-python)
[![PyPI](https://img.shields.io/pypi/v/hypermodern-guyhoozdis.svg)](https://pypi.org/project/hypermodern-guyhoozdis/)
[![Read the Docs](https://readthedocs.org/projects/hypermodern-guyhoozdis/badge/)](https://hypermodern-guyhoozdis.readthedocs.io/)
A template based on ["The Hypermodern Python Project"][hypermodern-python].
## Quick Start
_Note: Assumes you have poetry, nox, and the required python versions installed. See the [Development Environment Setup](#development-environment-setup) section below for instructions on setting up the
required environment._
Run the following commands from the root of the repo.
### Initialize the virtual environment
Construct poetry's virtual environment.
```bash
$ poetry install
```
If you have made changes to the dependencies, then you must update the lock file.
```bash
$ poetry lock
$ poetry install
```
### Run the full test suite
```bash
$ nox
#
# ... snip...
#
nox > Ran multiple sessions:
nox > * tests-3.12: success
nox > * tests-3.11: success
nox > * tests-3.10: success
nox > * tests-3.9: success
nox > * tests-3.8: success
```
Reuse existing virtual environments with the `-r/--reuse-existing-virtualenvs` switch to speed up re-running the test suite.
```bash
$ nox -r
```
### Run all tests for a single python version
List the available sessions with `-l/--list` and select one or more with the `-s/--session` switch.
```bash
$ nox -l
Sessions defined in /<path>/<to>/<repo>/hypermodern-python/noxfile.py:
* tests-3.12
* tests-3.11
* tests-3.10
* tests-3.9
* tests-3.8
$ nox -rs tests-3.11 tests-3.10
#
# ... snip...
#
nox > Ran multiple sessions:
nox > * tests-3.11: success
nox > * tests-3.10: success
```
### Run all tests in a single module
```bash
$ nox -rs tests-3.11 -- tests/test_console.py
#
# ... snip...
#
tests/test_console.py ....
#
# ... snip...
#
nox > Session tests-3.11 was successful.
```
### Run a specific tests from a specific module
```bash
$ nox -rs tests-3.11 -- tests/test_console.py::test_main_fails_on_request_error
#
# ... snip...
#
tests/test_console.py .
#
# ... snip...
#
nox > Session tests-3.11 was successful.
```
### Run the debugger when a breakpoint is hit
This example is a demonstration of passing arbitrary arguments to `pytest` which is being run by `nox`, not an assertion that this is the best way to run the debugger.
See [TODO: Get a reference to docs] for more information about setting breakpoints.
```bash
$ nox -rs tests-3.11 -- -s --pdbcls=IPython.terminal.debugger:TerminalPdb tests/test_console.py::test_main_fails_on_request_error
tests/test_console.py Python 3.11.9 (main, Jun 12 2024, 14:42:40) [Clang 14.0.0 (clang-1400.0.29.202)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help.
ipdb> ll
37 def test_main_fails_on_request_error(runner, mock_reqeusts_get):
38 mock_reqeusts_get.side_effect = Exception("Boom")
39 result = runner.invoke(console.main)
40 breakpoint()
---> 41 assert result.exit_code == 1
42 assert "Boom" == str(result.exception)
ipdb> c
#
# ... snip...
#
nox > Session tests-3.11 was successful.
```
### Run the end-to-end tests
The end-to-end tests are marked with `pytest.markers.e2e` and can be invoked by the command below. By default tests with the `e2e` marker will not be executed.
```bash
$ nox -rs tests-3.11 -- -m e2e
```
### Build Documentation
```bash
$ nox -rs docs
$ open docs/_build/index.html
```
## Development Environment Setup
TODO: Write steps to setup development environment.
1. Install `pyenv`
1. Install python versions
1. Install `poetry`
1. Install `nox`
1. Verify environment setup
## Publish Package
From the [Poetry docs][poetry-config-credentials]
```
$ poetry source add --priority explicit testpypi https://test.pypi.org/simple/
$ poetry config pypi-token.testpypi <your-test-pypi-token>
$ poetry config pypi-token.pypi <your-pypi-token>
```
Verify it is in the system keyring
```
$ keyring get poetry-repository-testpypi __token__
pypi-llsijlsdjlsjlsij...
$ keyring get poetry-repository-pypi __token__
pypi-llsijlsdjlsjlsij...
```
Build and publish
```
$ poetry build
$ poetry publish -r testpypi
$ poetry publish
```
!!!: Publishing to testpypi is not working for me yet. Publishing to regular PyPi does. I'm not sure why yet.
# Resources
1. [The Hypermodern Python Project articles][hypermodern-python]
1. [The Hypermodern Python Project GitHub Repo][hypermodern-python-github]
1. [Poetry: Configuring Credentials][poetry-config-credentials]
[hypermodern-python]: https://cjolowicz.github.io/posts/hypermodern-python-01-setup/
[hypermodern-python-github]: https://github.com/cjolowicz/hypermodern-python
[poetry-config-credentials]: https://python-poetry.org/docs/repositories/#configuring-credentials
Raw data
{
"_id": null,
"home_page": "https://github.com/guyhoozdis/hypermodern-python",
"name": "hypermodern-guyhoozdis",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.8.1",
"maintainer_email": null,
"keywords": "hypermodern, template, package, guyhoozdis",
"author": "Guy Hoozdis",
"author_email": "GuyHoozdis@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/03/d3/d7ff82943e14a413cf1a2a79408d4486f49b1942b281ae24f3da2aeafdfd/hypermodern_guyhoozdis-0.7.0.tar.gz",
"platform": null,
"description": "# The Hypermodern Python Project\n\n[![Tests](https://github.com/GuyHoozdis/hypermodern-python/workflows/Tests/badge.svg)](https://github.com/GuyHoozdis/hypermodern-python/actions?workflow=Tests)\n[![Codecov](https://codecov.io/gh/GuyHoozdis/hypermodern-python/branch/master/graph/badge.svg)](https://codecov.io/gh/GuyHoozdis/hypermodern-python)\n[![PyPI](https://img.shields.io/pypi/v/hypermodern-guyhoozdis.svg)](https://pypi.org/project/hypermodern-guyhoozdis/)\n[![Read the Docs](https://readthedocs.org/projects/hypermodern-guyhoozdis/badge/)](https://hypermodern-guyhoozdis.readthedocs.io/)\n\n\nA template based on [\"The Hypermodern Python Project\"][hypermodern-python].\n\n\n## Quick Start\n\n_Note: Assumes you have poetry, nox, and the required python versions installed. See the [Development Environment Setup](#development-environment-setup) section below for instructions on setting up the\nrequired environment._\n\nRun the following commands from the root of the repo.\n\n\n### Initialize the virtual environment\n\nConstruct poetry's virtual environment.\n\n```bash\n$ poetry install\n```\n\nIf you have made changes to the dependencies, then you must update the lock file.\n\n```bash\n$ poetry lock\n$ poetry install\n```\n\n\n### Run the full test suite\n\n```bash\n$ nox\n#\n# ... snip...\n#\nnox > Ran multiple sessions:\nnox > * tests-3.12: success\nnox > * tests-3.11: success\nnox > * tests-3.10: success\nnox > * tests-3.9: success\nnox > * tests-3.8: success\n```\n\nReuse existing virtual environments with the `-r/--reuse-existing-virtualenvs` switch to speed up re-running the test suite.\n\n```bash\n$ nox -r\n```\n\n\n### Run all tests for a single python version\n\nList the available sessions with `-l/--list` and select one or more with the `-s/--session` switch.\n\n```bash\n$ nox -l\nSessions defined in /<path>/<to>/<repo>/hypermodern-python/noxfile.py:\n\n* tests-3.12\n* tests-3.11\n* tests-3.10\n* tests-3.9\n* tests-3.8\n\n$ nox -rs tests-3.11 tests-3.10\n#\n# ... snip...\n#\nnox > Ran multiple sessions:\nnox > * tests-3.11: success\nnox > * tests-3.10: success\n```\n\n\n### Run all tests in a single module\n\n```bash\n$ nox -rs tests-3.11 -- tests/test_console.py\n#\n# ... snip...\n#\ntests/test_console.py ....\n#\n# ... snip...\n#\nnox > Session tests-3.11 was successful.\n```\n\n\n### Run a specific tests from a specific module\n\n```bash\n$ nox -rs tests-3.11 -- tests/test_console.py::test_main_fails_on_request_error\n#\n# ... snip...\n#\ntests/test_console.py .\n#\n# ... snip...\n#\nnox > Session tests-3.11 was successful.\n```\n\n\n### Run the debugger when a breakpoint is hit\n\nThis example is a demonstration of passing arbitrary arguments to `pytest` which is being run by `nox`, not an assertion that this is the best way to run the debugger.\n\nSee [TODO: Get a reference to docs] for more information about setting breakpoints.\n\n```bash\n$ nox -rs tests-3.11 -- -s --pdbcls=IPython.terminal.debugger:TerminalPdb tests/test_console.py::test_main_fails_on_request_error\n\ntests/test_console.py Python 3.11.9 (main, Jun 12 2024, 14:42:40) [Clang 14.0.0 (clang-1400.0.29.202)]\nType 'copyright', 'credits' or 'license' for more information\nIPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help.\nipdb> ll\n 37 def test_main_fails_on_request_error(runner, mock_reqeusts_get):\n 38 mock_reqeusts_get.side_effect = Exception(\"Boom\")\n 39 result = runner.invoke(console.main)\n 40 breakpoint()\n---> 41 assert result.exit_code == 1\n 42 assert \"Boom\" == str(result.exception)\n\nipdb> c\n\n#\n# ... snip...\n#\nnox > Session tests-3.11 was successful.\n```\n\n\n### Run the end-to-end tests\n\nThe end-to-end tests are marked with `pytest.markers.e2e` and can be invoked by the command below. By default tests with the `e2e` marker will not be executed.\n\n```bash\n$ nox -rs tests-3.11 -- -m e2e\n```\n\n\n### Build Documentation\n\n```bash\n$ nox -rs docs\n$ open docs/_build/index.html\n```\n\n\n## Development Environment Setup\n\nTODO: Write steps to setup development environment.\n\n1. Install `pyenv`\n1. Install python versions\n1. Install `poetry`\n1. Install `nox`\n1. Verify environment setup\n\n\n## Publish Package\n\nFrom the [Poetry docs][poetry-config-credentials]\n\n\n```\n$ poetry source add --priority explicit testpypi https://test.pypi.org/simple/\n$ poetry config pypi-token.testpypi <your-test-pypi-token>\n$ poetry config pypi-token.pypi <your-pypi-token>\n```\n\nVerify it is in the system keyring\n\n```\n$ keyring get poetry-repository-testpypi __token__\npypi-llsijlsdjlsjlsij...\n\n$ keyring get poetry-repository-pypi __token__\npypi-llsijlsdjlsjlsij...\n```\n\nBuild and publish\n\n```\n$ poetry build\n$ poetry publish -r testpypi\n$ poetry publish\n```\n\n!!!: Publishing to testpypi is not working for me yet. Publishing to regular PyPi does. I'm not sure why yet.\n\n\n# Resources\n\n1. [The Hypermodern Python Project articles][hypermodern-python]\n1. [The Hypermodern Python Project GitHub Repo][hypermodern-python-github]\n1. [Poetry: Configuring Credentials][poetry-config-credentials]\n\n\n[hypermodern-python]: https://cjolowicz.github.io/posts/hypermodern-python-01-setup/\n[hypermodern-python-github]: https://github.com/cjolowicz/hypermodern-python\n[poetry-config-credentials]: https://python-poetry.org/docs/repositories/#configuring-credentials\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A template package based on The Hypermodern Project",
"version": "0.7.0",
"project_urls": {
"Documentation": "https://hypermodern-guyhoozdis.readthedocs.io",
"Homepage": "https://github.com/guyhoozdis/hypermodern-python",
"Repository": "https://github.com/guyhoozdis/hypermodern-python"
},
"split_keywords": [
"hypermodern",
" template",
" package",
" guyhoozdis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bcfa70f29d262a9ca03009dbfc9556104a3c6bd5cc5508c1e1fb8e06e6cbce1f",
"md5": "98c48fe02b49af355def2e047bd82560",
"sha256": "9768a5a96fc461d3944c77949bb2bde7910a739127596fcf4258bb692123403c"
},
"downloads": -1,
"filename": "hypermodern_guyhoozdis-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "98c48fe02b49af355def2e047bd82560",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.8.1",
"size": 6909,
"upload_time": "2024-07-06T23:12:43",
"upload_time_iso_8601": "2024-07-06T23:12:43.329956Z",
"url": "https://files.pythonhosted.org/packages/bc/fa/70f29d262a9ca03009dbfc9556104a3c6bd5cc5508c1e1fb8e06e6cbce1f/hypermodern_guyhoozdis-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "03d3d7ff82943e14a413cf1a2a79408d4486f49b1942b281ae24f3da2aeafdfd",
"md5": "bfaa0d7a132702f819fc8c0731172518",
"sha256": "53f2e78c49336241d60768ebda781b0821a5b8fc2a4f45a7c26ca9c4e724f175"
},
"downloads": -1,
"filename": "hypermodern_guyhoozdis-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "bfaa0d7a132702f819fc8c0731172518",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8.1",
"size": 5740,
"upload_time": "2024-07-06T23:12:44",
"upload_time_iso_8601": "2024-07-06T23:12:44.632748Z",
"url": "https://files.pythonhosted.org/packages/03/d3/d7ff82943e14a413cf1a2a79408d4486f49b1942b281ae24f3da2aeafdfd/hypermodern_guyhoozdis-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-06 23:12:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "guyhoozdis",
"github_project": "hypermodern-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hypermodern-guyhoozdis"
}