Skip to main content

Say hello!

Project description

Python Package Example

This repository contains a basic python package example with the aim of showing how a good python package should look like.

Install:

pip install helloworld-mkmenta

Install locally:

git clone https://github.com/mkmenta/python-package-example.git
cd python-package-example
pip install -e .

Usage

You will find an usage example here.

Documentation

This project has a documentation in readthedocs.io generated using sphinx: documentation.

Find the tutorial on how it was created here.

Developing

To install the package along with the tools you need to develop it run the following (local installation with the "dev" extras:

git clone https://github.com/mkmenta/python-package-example.git
cd python-package-example
pip install -e ."[dev]"

If you are developing, you should run pip install -e . every time you change setup.py or the dependencies etc. to make sure that everything works.

A note about requirements

The requirements needed to run the package should go in the install_requires argument of setup() in the setup.py.

The requirements needed to develop the package should go in the extras_require argument dict (under the "dev" key) of setup() in the setup.py.

This is preferred to a requirements.txt file, because this is code and it can be understood directly during the installation of the package itself.

The requirements.txt should be used to recreate enviroments with specific versions (e.g.requests==2.22.0), not to share software.

Building and distribution

Build without installi i.e. build wheel:

python3 setup.py bdist_wheel

Source distribution:

python3 setup.py sdist

For the source distribution, remember to:

  • Check out the warnings of python3 setup.py sdist.
  • Check that every file from the repo is packed in the tar file (tar tzf dist/helloworld-X.X.X.tar.gz) as written in the MANIFEST.in. A useful tool is check-manifest.

Uploading to PyPI

python3 setup.py bdist_wheel sdist
twine upload dist/*

Code format checks and tests (GitHub Actions for continuous integration)

In order to check the code format and test it, this project runs a GitHub action defined in .github/workflows/main-action.yml.

You can check the execution of this action here.

This allows blocking any merge of a pull request if the code is not correcly formatted or tests are not passing. In order to do that you can go to Settings -> Branches -> Add rule

Other useful stuff

  • This repo is prepared for PyCharm and it has some run configurations (in .idea/runConfigurations).

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helloworld-mkmenta-0.0.4.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

helloworld_mkmenta-0.0.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file helloworld-mkmenta-0.0.4.tar.gz.

File metadata

  • Download URL: helloworld-mkmenta-0.0.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for helloworld-mkmenta-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4bd2cf26f9b0aaecc64c95d7baaf440f7bc9f03937a08cae237ad86d644ff682
MD5 adc2b67ddb3c7261a5cc8c0ec29879a9
BLAKE2b-256 09991fd443dad263b2cb7d9371da1671276e861577af6aeaed2776372450a25c

See more details on using hashes here.

File details

Details for the file helloworld_mkmenta-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: helloworld_mkmenta-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for helloworld_mkmenta-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 26beda06302e86cf74640a213c6f943551fd303fab95a50501c3d552da028686
MD5 6327489961514411ccf9d395760da667
BLAKE2b-256 99f529ca6ebbda900036830ab02e18bb9d7dbe00788334b32ee89dee04a41b82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page