This repository provides a Python project template optimized for development, testing, and CI/CD integration using Docker.
src/AGISwarm/python_template/
: Main package.__init__.py
: Package initialization.__main__.py
: Main module logic.py.typed
: Marker file for PEP 561 typing.
pyproject.toml
: Specifies build system requirements and project dependencies.tests/
: Unit and functional tests..github/workflows/
:build-analysis-test.yml
: CI for build and test.build-pypi-docker.yml
: CI for Docker and PyPI deployment.
dockerfile
: Docker setup for Python.
- Automated tests with examples.
- CI/CD via GitHub Actions.
- Docker integration for deployment.
-
Import the template repository to your GitHub account.
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd <repository-name>
-
Adapt the project to your needs:
- Modify the project name in
pyproject.toml
andsrc/AGISwarm/python_template/__init__.py
to match your project name. - Change namespace
AGISwarm
to your own namespace. - Add your code to
src/<namespace>/<project-name>/
folder. - Write your tests in
tests/
folder.- Unittests will be run automatically by GitHub Actions every time you push to the repository. Functional tests will be not.
- Modify the project name in
-
Install dependencies:
pip install .
For testing and deployment in a CI/CD setup, refer to our CICD project.
python -m <namespace>.<project-name>
-
Build python package:
python -m build
-
Create PIP_INDEX_EXTRA_URL environment variable to be able to install dependencies from a self-hosted PyPI server.
Given URL is self-hosted PyPI server from CICD setup. Replace with your own if needed. Or remove secret mounting in Dockerfile, if no need.
export PIP_INDEX_EXTRA_URL=http://pypi-server/
-
Build Docker image. Use this command for testing purposes only. If you use CICD setup, it will build and push the image for you after creating a tag in your repository:
docker build -t <your tag name> --secret id=PIP_INDEX_EXTRA_URL,env=PIP_INDEX_EXTRA_URL .
-
Run Docker container:
docker run <your tag name>
Distributed under the MIT License. See LICENSE.txt
for details.
Denis Diachkov - [email protected]