enexis-friends-quiz


Nameenexis-friends-quiz JSON
Version 100.0.0 PyPI version JSON
download
home_pagehttps://github.com/mariushelf/enexis_friends_quiz
SummarySuper quiz!
upload_time2023-04-11 17:50:26
maintainer
docs_urlNone
authorMarius Helf
requires_python>=3.9,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Friends Quiz

[![Tests](https://github.com/mariushelf/friends_quiz/actions/workflows/cicd.yaml/badge.svg)](https://github.com/mariushelf/friends_quiz/actions/workflows/cicd.yaml)
[![codecov](https://codecov.io/gh/mariushelf/friends_quiz/branch/master/graph/badge.svg)](https://codecov.io/gh/mariushelf/friends_quiz)
[![PyPI version](https://badge.fury.io/py/friends_quiz.svg)](https://pypi.org/project/friends_quiz/)
[![Documentation Status](https://readthedocs.org/projects/friends_quiz/badge/?version=latest)](https://friends_quiz.readthedocs.io/en/latest/?badge=latest)


Super quiz!

This is a demo of dependency injection.


Documentation on [Gitlab pages](https://applications.enx.gitlab-sbp.page/401-datascience/use-cases/enexis_friends_quiz).

Original repository: [applications/401-datascience/use-cases/enexis_friends_quiz](https://enx.gitlab.schubergphilis.com/applications/401-datascience/use-cases/enexis_friends_quiz)

Artifactory: [enexis-friends-quiz](https://enexis.jfrog.io/ui/repos/tree/General/pypi-401-local/enexis-friends-quiz)

TODO: This is an auto-generated README file. Make sure to adjust it to your needs,
and remove sections that are not applicable for your software.


# Linting and Testing

## Locally on every commit

On every commit, some code formatting and checking tools are run by
[pre-commit](https://pre-commit.com/).

The test pipeline is configured in the
[.pre-commit-config.yaml](.pre-commit-config.yaml).

**Note:** you *must* run `poetry run pre-commit install` everytime you clone your
git repository. Else, the pre-commit hooks won't be run automatically.


## Running tests locally

On your local machine, you can run tests by running `make test`.

This uses [Tox](https://tox.wiki/en/latest/) to run tests for a variety
of Python versions.

As a prerequisite you need to install all those Python version, e.g., with
[pyenv](https://github.com/pyenv/pyenv).

To configure the Python versions under test, edit the [tox.ini](tox.ini).


## With Github actions

After every push to Github, the [cicd.yaml](.github/workflows/cicd.yaml)
workflow is run. It runs the tests in the [tests](tests) folder for a bunch
of Python versions.

It also uploads the code coverage report to [codecov](https://codecov.io).

**Note:** for private repositories you need to acquire a token from codecov
and configure in the `cicd.yaml` workflow file and in Github secrets.

To configure which Python versions are tested, edit the `python-version`
list in the `cicd.yaml` workflow file.


# How to release to PyPI

You can upload the package either from your local machine via twine, or
by using Github actions.

The following instructions guide you through the process of releasing to the actual,
official PyPI.

Further down, there are instructions to release to the PyPI test server, or to custom
Python Package indexes.


## Release with Github actions

To make a release via Github actions, you need to create a release in
Github. When the release is published, the build-n-publish job in the
[cicd](.github/workflows/cicd.yaml) workflow
is run.

To create a release in Github you need to create a tag.

For this project it is necessary that the tag matches the version number.
E.g., for version `1.2.3` the tag must be `1.2.3`.

### Prerequisites

1. Create an API token in the
   [PyPI account settings](https://pypi.org/manage/account/).
   If you don't have a PyPI account yet, create one. *Do not close the
   page right away, you will never see the token again!*

   **Note:** before you upload the package for the first time, you can
   only create a global api token with access to all your packages. It is
   *highly* recommended to replace it with a package-specific token after
   you have published your package for the first time.
2. In the [Github repository settings](https://github.com/mariushelf/friends_quiz/settings/environments),
   create a new environment named `production`. If you are the only
   contributor, you can leave all settings at the default.
3. Under [Secrets -> actions](https://github.com/mariushelf/friends_quiz/settings/secrets/actions),
   create a new secret named `PYPI_API_TOKEN` and copy the token from PyPI
   as value.


### Create a release and publish the package to PyPI

1. Make sure the `name` variable in your [pyproject.toml](pyproject.toml) is correct.
   **This will be the name of your package on PyPI!**
2. update the version number in the [pyproject.toml](pyproject.toml).
3. create a matching tag on your local machine and push it to the
   Github repository:
   ```bash
   git tag 1.2.3
   git push --tags
   ```
4. In [Github actions](https://github.com/mariushelf/friends_quiz/actions)
   make sure that the test workflow succeeds.
5. In the Github [release tab](https://github.com/mariushelf/friends_quiz/releases)
   click "Draft a new release". Fill in the form. When you click publish,
   the `publish-to-pypi` workflow is run.

   It checks that the tag matches the version number and then builds and
   publishes the package to
   [PyPI](https://pypi.org/project/friends_quiz/).

## Upload from the local machine (not recommended)

[twine](https://twine.readthedocs.io/en/stable/) allows to upload a package
from your local machine to PyPI.

### Prerequisites

You need a PyPI API token. See prerequisites for the Github actions above
(you don't need to perform any actions on Github when using twine, so you
only need to perform step 1).

### Configuration

The PyPI credentials must be configured either via a configuration file
or via environment variables.
See the [twine documentation](https://twine.readthedocs.io/en/stable/#configuration)
for details.

Since we are using an api token to authenticate with PyPI, the username
must be set to `__token__`, and the password is the actual token.

When using the PyPI test server, the repository url must be set to
`https://test.pypi.org/legacy/`.

### Usage

The `publish` target in the [Makefile](Makefile) calls twine to upload
a package to PyPI.

**Note:** the upload command is deactivated by default to prevent accidental
uploads. You need to manually uncomment it before the first release.

Here are the necessary steps:

1. update the version number in the [pyproject.toml](pyproject.toml)
2. run `make publish`.


# Using a custom package repository

While testing the release process of a public package, it is a good idea to first
release to the PyPI Test server.

Sometimes, especially in corporate settings, it is necessary to upload packages to
a custom, often private, package repository.

## Releasing

To release to a server other than the standard PyPI, you need to specify the respective
repository URL when uploading.


### Releasing to a custom repo with twine

With twine, you can specify the repository URL via the `--repository-url` parameter.

In the special case of the PyPI Test server, you can also specify
`--repository testpypi`.

```bash
# for Test PyPI
twine upload --repository testpypi dist/*

# for any custom repository
twine upload --repository-url <URL> dist/*
```

In the context of this project, you can modify the `publish` target in the
[Makefile](Makefile).

See also [Using TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/).


### Releasing to a custom repo with Github actions

To release to a custom repo with Github actions, you can follow the same process
as described above for the default PyPI. The only necessary change is adding a
`repository_url` entry to the `publish-to-pypi.yaml` file:

```yaml
- name: Publish package to TestPyPI
  uses: pypa/gh-action-pypi-publish@release/v1
  with:
    user: __token__password: ${{ secrets.TEST_PYPI_API_TOKEN }}repository_url: https://test.pypi.org/legacy/
```

For use with Test PyPI you need an account and an API token from [test.pypi.org](https://test.pypi.org). Note that in the example above, that token is assumed to
be stored in the `TEST_PYPI_API_TOKEN` secret in Github.

See also [Advanced release management](https://github.com/marketplace/actions/pypi-publish#advanced-release-management)
in the documentation of the `pypi-publish` Github action.


## Installing from a custom package repository

If you have uploaded your package to a custom repository, install tools such as
pip and poetry won't find it by default. You need to configure them to use the
custom repository.


### Installing from a custom package repository with pip

With pip, you need to specify it via the `--index-url` parameter. Often you want to
install custom packages from the private repo, but public dependencies from the regular
PyPI. In that case, specify the PyPI repo via `--extra-index-url`.

For example:

`pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ friends_quiz`

**Beware the
[security implications](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610)!**


### Installing from a custom package repository with poetry

To install packages from a custom repository, add this to your `pyproject.toml`:

```toml
[[tool.poetry.source]]
name = "foo"
url = "https://test.pypi.org/simple/"
secondary = true  # if True, poetry will also search the default PyPI repository
default = true  # if True, poetry will never search the default PyPI repository
```

For advanced configuration and authentication, take a look at the
[poetry documentation](https://python-poetry.org/docs/repositories/#install-dependencies-from-a-private-repository).

# Contact

Marius Helf
  ([marius.helf@enexis.nl](mailto:marius.helf@enexis.nl))

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mariushelf/enexis_friends_quiz",
    "name": "enexis-friends-quiz",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Marius Helf",
    "author_email": "marius.helf@enexis.nl",
    "download_url": "https://files.pythonhosted.org/packages/dd/b8/f0f4368c61af3d7c236265ad6d5fa18afe393d3ca0ca66f72213aefbf2fc/enexis_friends_quiz-100.0.0.tar.gz",
    "platform": null,
    "description": "# Friends Quiz\n\n[![Tests](https://github.com/mariushelf/friends_quiz/actions/workflows/cicd.yaml/badge.svg)](https://github.com/mariushelf/friends_quiz/actions/workflows/cicd.yaml)\n[![codecov](https://codecov.io/gh/mariushelf/friends_quiz/branch/master/graph/badge.svg)](https://codecov.io/gh/mariushelf/friends_quiz)\n[![PyPI version](https://badge.fury.io/py/friends_quiz.svg)](https://pypi.org/project/friends_quiz/)\n[![Documentation Status](https://readthedocs.org/projects/friends_quiz/badge/?version=latest)](https://friends_quiz.readthedocs.io/en/latest/?badge=latest)\n\n\nSuper quiz!\n\nThis is a demo of dependency injection.\n\n\nDocumentation on [Gitlab pages](https://applications.enx.gitlab-sbp.page/401-datascience/use-cases/enexis_friends_quiz).\n\nOriginal repository: [applications/401-datascience/use-cases/enexis_friends_quiz](https://enx.gitlab.schubergphilis.com/applications/401-datascience/use-cases/enexis_friends_quiz)\n\nArtifactory: [enexis-friends-quiz](https://enexis.jfrog.io/ui/repos/tree/General/pypi-401-local/enexis-friends-quiz)\n\nTODO: This is an auto-generated README file. Make sure to adjust it to your needs,\nand remove sections that are not applicable for your software.\n\n\n# Linting and Testing\n\n## Locally on every commit\n\nOn every commit, some code formatting and checking tools are run by\n[pre-commit](https://pre-commit.com/).\n\nThe test pipeline is configured in the\n[.pre-commit-config.yaml](.pre-commit-config.yaml).\n\n**Note:** you *must* run `poetry run pre-commit install` everytime you clone your\ngit repository. Else, the pre-commit hooks won't be run automatically.\n\n\n## Running tests locally\n\nOn your local machine, you can run tests by running `make test`.\n\nThis uses [Tox](https://tox.wiki/en/latest/) to run tests for a variety\nof Python versions.\n\nAs a prerequisite you need to install all those Python version, e.g., with\n[pyenv](https://github.com/pyenv/pyenv).\n\nTo configure the Python versions under test, edit the [tox.ini](tox.ini).\n\n\n## With Github actions\n\nAfter every push to Github, the [cicd.yaml](.github/workflows/cicd.yaml)\nworkflow is run. It runs the tests in the [tests](tests) folder for a bunch\nof Python versions.\n\nIt also uploads the code coverage report to [codecov](https://codecov.io).\n\n**Note:** for private repositories you need to acquire a token from codecov\nand configure in the `cicd.yaml` workflow file and in Github secrets.\n\nTo configure which Python versions are tested, edit the `python-version`\nlist in the `cicd.yaml` workflow file.\n\n\n# How to release to PyPI\n\nYou can upload the package either from your local machine via twine, or\nby using Github actions.\n\nThe following instructions guide you through the process of releasing to the actual,\nofficial PyPI.\n\nFurther down, there are instructions to release to the PyPI test server, or to custom\nPython Package indexes.\n\n\n## Release with Github actions\n\nTo make a release via Github actions, you need to create a release in\nGithub. When the release is published, the build-n-publish job in the\n[cicd](.github/workflows/cicd.yaml) workflow\nis run.\n\nTo create a release in Github you need to create a tag.\n\nFor this project it is necessary that the tag matches the version number.\nE.g., for version `1.2.3` the tag must be `1.2.3`.\n\n### Prerequisites\n\n1. Create an API token in the\n   [PyPI account settings](https://pypi.org/manage/account/).\n   If you don't have a PyPI account yet, create one. *Do not close the\n   page right away, you will never see the token again!*\n\n   **Note:** before you upload the package for the first time, you can\n   only create a global api token with access to all your packages. It is\n   *highly* recommended to replace it with a package-specific token after\n   you have published your package for the first time.\n2. In the [Github repository settings](https://github.com/mariushelf/friends_quiz/settings/environments),\n   create a new environment named `production`. If you are the only\n   contributor, you can leave all settings at the default.\n3. Under [Secrets -> actions](https://github.com/mariushelf/friends_quiz/settings/secrets/actions),\n   create a new secret named `PYPI_API_TOKEN` and copy the token from PyPI\n   as value.\n\n\n### Create a release and publish the package to PyPI\n\n1. Make sure the `name` variable in your [pyproject.toml](pyproject.toml) is correct.\n   **This will be the name of your package on PyPI!**\n2. update the version number in the [pyproject.toml](pyproject.toml).\n3. create a matching tag on your local machine and push it to the\n   Github repository:\n   ```bash\n   git tag 1.2.3\n   git push --tags\n   ```\n4. In [Github actions](https://github.com/mariushelf/friends_quiz/actions)\n   make sure that the test workflow succeeds.\n5. In the Github [release tab](https://github.com/mariushelf/friends_quiz/releases)\n   click \"Draft a new release\". Fill in the form. When you click publish,\n   the `publish-to-pypi` workflow is run.\n\n   It checks that the tag matches the version number and then builds and\n   publishes the package to\n   [PyPI](https://pypi.org/project/friends_quiz/).\n\n## Upload from the local machine (not recommended)\n\n[twine](https://twine.readthedocs.io/en/stable/) allows to upload a package\nfrom your local machine to PyPI.\n\n### Prerequisites\n\nYou need a PyPI API token. See prerequisites for the Github actions above\n(you don't need to perform any actions on Github when using twine, so you\nonly need to perform step 1).\n\n### Configuration\n\nThe PyPI credentials must be configured either via a configuration file\nor via environment variables.\nSee the [twine documentation](https://twine.readthedocs.io/en/stable/#configuration)\nfor details.\n\nSince we are using an api token to authenticate with PyPI, the username\nmust be set to `__token__`, and the password is the actual token.\n\nWhen using the PyPI test server, the repository url must be set to\n`https://test.pypi.org/legacy/`.\n\n### Usage\n\nThe `publish` target in the [Makefile](Makefile) calls twine to upload\na package to PyPI.\n\n**Note:** the upload command is deactivated by default to prevent accidental\nuploads. You need to manually uncomment it before the first release.\n\nHere are the necessary steps:\n\n1. update the version number in the [pyproject.toml](pyproject.toml)\n2. run `make publish`.\n\n\n# Using a custom package repository\n\nWhile testing the release process of a public package, it is a good idea to first\nrelease to the PyPI Test server.\n\nSometimes, especially in corporate settings, it is necessary to upload packages to\na custom, often private, package repository.\n\n## Releasing\n\nTo release to a server other than the standard PyPI, you need to specify the respective\nrepository URL when uploading.\n\n\n### Releasing to a custom repo with twine\n\nWith twine, you can specify the repository URL via the `--repository-url` parameter.\n\nIn the special case of the PyPI Test server, you can also specify\n`--repository testpypi`.\n\n```bash\n# for Test PyPI\ntwine upload --repository testpypi dist/*\n\n# for any custom repository\ntwine upload --repository-url <URL> dist/*\n```\n\nIn the context of this project, you can modify the `publish` target in the\n[Makefile](Makefile).\n\nSee also [Using TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/).\n\n\n### Releasing to a custom repo with Github actions\n\nTo release to a custom repo with Github actions, you can follow the same process\nas described above for the default PyPI. The only necessary change is adding a\n`repository_url` entry to the `publish-to-pypi.yaml` file:\n\n```yaml\n- name: Publish package to TestPyPI\n  uses: pypa/gh-action-pypi-publish@release/v1\n  with:\n    user: __token__password: ${{ secrets.TEST_PYPI_API_TOKEN }}repository_url: https://test.pypi.org/legacy/\n```\n\nFor use with Test PyPI you need an account and an API token from [test.pypi.org](https://test.pypi.org). Note that in the example above, that token is assumed to\nbe stored in the `TEST_PYPI_API_TOKEN` secret in Github.\n\nSee also [Advanced release management](https://github.com/marketplace/actions/pypi-publish#advanced-release-management)\nin the documentation of the `pypi-publish` Github action.\n\n\n## Installing from a custom package repository\n\nIf you have uploaded your package to a custom repository, install tools such as\npip and poetry won't find it by default. You need to configure them to use the\ncustom repository.\n\n\n### Installing from a custom package repository with pip\n\nWith pip, you need to specify it via the `--index-url` parameter. Often you want to\ninstall custom packages from the private repo, but public dependencies from the regular\nPyPI. In that case, specify the PyPI repo via `--extra-index-url`.\n\nFor example:\n\n`pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ friends_quiz`\n\n**Beware the\n[security implications](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610)!**\n\n\n### Installing from a custom package repository with poetry\n\nTo install packages from a custom repository, add this to your `pyproject.toml`:\n\n```toml\n[[tool.poetry.source]]\nname = \"foo\"\nurl = \"https://test.pypi.org/simple/\"\nsecondary = true  # if True, poetry will also search the default PyPI repository\ndefault = true  # if True, poetry will never search the default PyPI repository\n```\n\nFor advanced configuration and authentication, take a look at the\n[poetry documentation](https://python-poetry.org/docs/repositories/#install-dependencies-from-a-private-repository).\n\n# Contact\n\nMarius Helf\n  ([marius.helf@enexis.nl](mailto:marius.helf@enexis.nl))\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Super quiz!",
    "version": "100.0.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00f2b2998f97acd910a0d4785fa3aad880375c4453a58442aa4ae236fdd3aedb",
                "md5": "d18c8de843997cc8aa39b5b8f0cc94d3",
                "sha256": "07df9d686770f6f66cc83383dbce86c62f4164857568e1919f6feee35e917289"
            },
            "downloads": -1,
            "filename": "enexis_friends_quiz-100.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d18c8de843997cc8aa39b5b8f0cc94d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 7410,
            "upload_time": "2023-04-11T17:50:25",
            "upload_time_iso_8601": "2023-04-11T17:50:25.313568Z",
            "url": "https://files.pythonhosted.org/packages/00/f2/b2998f97acd910a0d4785fa3aad880375c4453a58442aa4ae236fdd3aedb/enexis_friends_quiz-100.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddb8f0f4368c61af3d7c236265ad6d5fa18afe393d3ca0ca66f72213aefbf2fc",
                "md5": "e4b83b6298017d7f731ffe1204930531",
                "sha256": "3ebc1b7f78216c2497f6103041804011b9cc2e43cadc5ab961f0cd8270c4e0c7"
            },
            "downloads": -1,
            "filename": "enexis_friends_quiz-100.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e4b83b6298017d7f731ffe1204930531",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 7072,
            "upload_time": "2023-04-11T17:50:26",
            "upload_time_iso_8601": "2023-04-11T17:50:26.815473Z",
            "url": "https://files.pythonhosted.org/packages/dd/b8/f0f4368c61af3d7c236265ad6d5fa18afe393d3ca0ca66f72213aefbf2fc/enexis_friends_quiz-100.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-11 17:50:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mariushelf",
    "github_project": "enexis_friends_quiz",
    "lcname": "enexis-friends-quiz"
}
        
Elapsed time: 0.09969s