flit_pytest_circleci_template is a sample project to show how to use:
- flit to build a python package, configured in pyproject.toml
- pytest to test a python package, configured in pyproject.toml
- circleci for to build the python package, test it, and publish to pypi automatically.
If you prefer to use github actions, here is a sample using flit in a github action to build a package and publish to testpypi. A later version of that file will no doubt publish to pypi instead of testpypi.
Getting Ready
To proceed with your own package and publishing to pypi:
- copy the .circleci folder to your project and add to your git repo. Currently it has only one file config.yml that configures the build pipeline for a python project. Here is the .circleci/config.yml and pyproject.toml for this project.
- Create the pyproject.toml as normally required to build your package with flit. Include in test dependencies pytest and any other python packages that need to be installed for testing:
[project.optional-dependencies]
test = [
"pytest >=7.1.2",
]
- Add testpaths to [tool.pytest.ini_options] identifying where your tests are located. Specifying minversion and addopts is also recommended:
[tool.pytest.ini_options]
minversion = "7.1.2"
addopts = "--capture=tee-sys "
testpaths= [
"test",
]
When you are satisifed with your tests, review the config.yml and see if there are any obvious changes you require. You may not need any but you might elect to update to the latest python orb or specific python image you would like to use to build and test your python package.
The publish step will normally fail if there is already a package in pypi with the same version number. Which is desired behavior. When you are ready to publish, increase the version number (in pyproject.toml or init.py depending on how the project is set up.).
** You can elect to publish to testpypi by tweaking the twine command in config.yml **
Configure circleci
Create a circleci account if you don't have one and add your github repository as a project. Get the build at least running.
Using Project Settings, add Environment variables TWINE_USERNAME and TWINE_PASSWORD. These are the credentials you use to publish to pypi or testpypi. Until you set those variables, the publish stop obviously will fail, but the package build and test steps should work.
License
You can do whatever you want with the code in this repository and apply whatever license you want to copies or modifications in your own project. This project is mean to be a helpful starting point for people who want to get circleci to build and publish python packages.
Metadata
Release files for flit-pytest-circleci-template 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flit_pytest_circleci_template-0.2.tar.gz | 4.3 kB | Without provenance | Details for flit_pytest_circleci_template-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flit_pytest_circleci_template-0.2-py3-none-any.whl | Python 3 | none | any | Details for flit_pytest_circleci_template-0.2-py3-none-any.whl |
Total release size: 7.1 kB
Release files / flit_pytest_circleci_template-0.2.tar.gz
| Download URL | flit_pytest_circleci_template-0.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97618d6979053ba2b58bb3d37a661857527298910512981b6dd1ef191d03db61
|
|
BLAKE2b-256 checksum How to use checksums |
79f071fc46fa69cd599609451b9815d9ded3f0c40f5114d4dd93e60028b9aaad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.2
|
Release files / flit_pytest_circleci_template-0.2-py3-none-any.whl
| Download URL | flit_pytest_circleci_template-0.2-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7750e28cada84110f7d2e1c8571813879e680eb047b1d2b76feeb385c7f28a66
|
|
BLAKE2b-256 checksum How to use checksums |
64fbff34d8ffbb636b6eb7012322e975e9e7d8cce7615ff541cef270edb5957e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.2
|
Security for flit-pytest-circleci-template 0.2
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.