A project for practicing python packaging techniques.
Project description
Overview
A basic algorithm library for practicing Python packaging techniques.
Project Journal
I'm following the Python packaging flow documentation.
Installing Poetry
Poetry is a tool for dependency management and packaging in Python. The first step is to install and set up Poetry, following their installation guide.
I did the install by executing curl -sSL https://install.python-poetry.org | py -
In Windows, the poetry executable was placed inside %appdata%\Roaming\Python\Scripts, so I had to add this folder to path for more convenient execution.
Project setup
Because I've created the project from GitLab, I can't use poetry new project-name.
Instead I use poetry init to populate a preexisting folder.
Adding pytest
Pytest won't be required during runtime, so I add it to a test group using poetry add pytest --group test
This will help me with not adding pytest to the built package.
Folder Structure
The project needs to have a folder with the same name as the rot, but in snake case and a tests folder.
Pipeline
The .gitlab-ci.yaml file contains the pipeline configurations.
I added a basic test with a JUnit coverage report that integrates with gitlab.
Later, I can set up the package building, and maybe even publishing logic here.
Adding dev dependencies
I've added black, mypy and pylint with poetry add --dev black mypy pylint
This should exclude them from the build.
Updating Python version
As of writing this, I have Python 3.12.5, which has a memory issue that black can't work with. I'm on Windows, so I'm using the official installer for 3.12.8 I chose the upgrade option. Everything works fine after the upgrade, without changing anything in poetry.
Running dev tools
poetry run black .
poetry run mypy .
poetry run pylint python_practice_algorithm_pack
Disabling mandatory docstrings in pylint
IMO docstrings are useful if they provide extra context, either when the code is complicated or requires extra context. I think the small scope of this project exempts some of its parts from this requirement. I'd likely not remove it for a larger project.
To disable mandatory docstrings, add a .pylintrc file with the following lines:
[MAIN]
disable=C0114, C0115, C0116
Publishing the package
Following the poetry documentation.
Packaging
Before I publish the library, I have to package it using poetry build
This creates artifacts in the dist folder.
Publishing
I publish using poetry publish, but before I do that, I should register as a user to PyPI.
I should also configure my credentials.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_practice_algorithm_pack-0.1.0.tar.gz.
File metadata
- Download URL: python_practice_algorithm_pack-0.1.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af856d9c8bb47d22fd68cf0cfb1643ea67c2e64c372a52cdef7fb1d36c821d44
|
|
| MD5 |
fe2214087306e3dff579c7631ff4cf50
|
|
| BLAKE2b-256 |
54f7bd8ea4d774eaeca8cc6ce2749403c4f8e0dada7323bf76d9f3ed70e14677
|
File details
Details for the file python_practice_algorithm_pack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: python_practice_algorithm_pack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70575341957a67fd835c16b7087274c9e6d3a0951d788ae1458f3387a153f723
|
|
| MD5 |
8f1d54e3d236333e1b024fbdae589937
|
|
| BLAKE2b-256 |
4a27fff2575887db2689f6d004540f5f7e38edf9c12a35503e105d7c8727e188
|