Skip to content

Giving a push#1

Open
alanpjohn wants to merge 1 commit intobeetlegeusee:mainfrom
alanpjohn:main
Open

Giving a push#1
alanpjohn wants to merge 1 commit intobeetlegeusee:mainfrom
alanpjohn:main

Conversation

@alanpjohn
Copy link
Copy Markdown

Its up to you after this

So I didnt implement any code of sort because you should do that
I just added some files to explain you where your project needs to go to progress.
Lemme just explain what all I have done. I'll also share links that you can refer to move ahead
I wasn't sure of what package pptx comes from so I have assumed its python-pptx

So I created the following files :

setup.py

So every python package requires a setup.py which basically is used to provide metadata for your package as well scripts for building , documentation and packaging
I added a very basic setup.py to your repo

import os
import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()


setuptools.setup(
    name="AutoPPT", 
    version="0.0.1",
    author="Beetleguese",
    description='''
        Make your PPTs
    ''',
    long_description=long_description,
    long_description_content_type="text/markdown",
    packages=setuptools.find_packages(),
    classifiers=[
        'Programming Language :: Python :: 3',
    ],
    python_requires='>=3.6',
    install_requires=[
        "beautifulsoup4",
        "requests",
        "python-pptx"
    ],
)

so as you can see name , version , author , description , long_description , classifiers are all metadata information about your package that pypi and pip would use. The others play a more important role

  1. python_requires informs pip of your projects python version requirements
  2. packages includes all the packages that you want to include in your project. In this case , you only have one package that is AutoPPT (we'll come to this later)
  3. install_requires is information regarding what all package dependencies do you need installed to run your package smoothly.

You can then run the following commands in the root directory of this repo to pip install the package you made in your environment

$ python setup.py install
$ python setup.py bdist
$ pip install .

There are a lot more config files and commands using setup.py that you can include to refine and empower your project. Refer the links in the end for more details.

requirements.txt

So this file consists of the packages that you would need to develop the project in its environment

setuptools
wheel
beatifulsoup4
python-pptx
requests

here setuptools and wheel are required for building tools while the rest are your package dependencies.

$ pip install -r requirements.txt

.gitignore

so a gitignore file reject useless files in your repo
when you build projects you get a lot of files important to running your project but those that you dont manage using git and don't require on github
I have added the that the default .gitignore for python projects

README.md

So you had a readme but it wasn't the best README.md so I tidied it a bit

AutoPPT/

So this is your package
what makes it a package is the presence of the __init__.py . Its generally a file without any sort of code that helps your system recognise a folder as python package. so remember

Any folder with a __init__.py is a python package

To make your python package executable you would need a__main__.py
when you run your module on command line instead of calling it with import , the __main__.py file gets called which should have your command line interface.

The presence of __main__.py makes your package executable

The other files in your package are your modules , you can name them whatever you want. In this case , we have presentation.py in which i added a generate_presentation function (equivalent to hello world).

so you can either open a python shell or notebook or script and import stuff out of your package

>>> import AutoPPT
>>> AutoPPT.generate_presentation('rocks')
Searching for rocks

or you can directly execute the package on the command line

alan@alan-PC:~$ python -m AutoPPT 
Searching for rocks

I have added comments in the files for your assistance

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant