Introduction
World Energy Data Library to get data from public sources. The energy includes the following:
- Oil and Gas facilities
- Wind
- Other Source (TBA)
Summary
Usage
Using toml file, bumpver and twine
| Step | Description | Commands/Detailed Description | Reference |
|---|---|---|---|
| 1 | Create python project with directory structure | Follow pep8 guidelines | https://www.freecodecamp.org/news/build-your-first-python-package/ |
| 2 | Package compliance | Ensure all directories are package modules using init.py | https://www.freecodecamp.org/news/build-your-first-python-package/ |
| 3 | Add .toml file and setup.py to build wheels | pip install bumpver bumpver update --patch pip install build python -m build |
https://realpython.com/pypi-publish-python-package/ |
| 4 | Create account on pypi and upload using twine package | These commands will push the .whl and .tar.gz file into the pypi repository conda install twine twine upload dist/* |
https://realpython.com/pypi-publish-python-package/ |
To see instructions using setup.py & twine, without Version Bump, see using setup.py
CI
More CI/CD streamlining for python packages:
- use cookiecutter to generate a package template
- set up travis CI for auto deployment of package to pypi
#TODO
- Convert library to a cookiecutter template. Helps parametrize the library name.
https://github.com/audreyfeldroy/cookiecutter-pypackage https://cookiecutter-pypackage.readthedocs.io/en/latest/tutorial.html https://pypi.org/project/cookiecutter/
https://github.com/boromir674/cookiecutter-python-package https://github.com/boromir674/cookiecutter-python-package/tox.ini
https://youtu.be/ugGu8fHWFog (A data science project example folder)
Github
Helps cover testing, test coverage, etc. https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python https://hynek.me/articles/python-github-actions/
Travis CI, No Free Support?
https://github.com/ksator/continuous-integration-with-python
https://medium.com/swlh/automate-python-testing-with-github-actions-7926b5d8a865
Testing a Package Locally
Using .toml file (Working)
A package can be imported locally from another code and thoroughly tested as well if required. Editable install is the best way to achieve this. The steps to do so are:
- Change to the current working directory where the pyproject.toml file is located
- Execute the following command to install the package locally
- python -m pip install -e .
- This installation uses the files in the current working directory
Using conda-build (Did not work)
Building A Package Locally
- Add following package to the base environment -Install conda-buiild -Conda install conda-build
- Utilize the below to build the package in current path. A specific path can also be specified.
Writing Tests
- Write tests. Preferably utilize pytest.
- Example test and file structure
- https://github.com/jumptrading/luddite
- Utilized test_package.py for all tests
- pytest.ini file for pytest configurations
- Utilize github test workflows
- https://github.com/jumptrading/luddite/blob/master/.github/workflows/tests.yml
- https://tox.wiki/en/latest/
References
https://www.freecodecamp.org/news/build-your-first-python-package/
https://python-packaging-tutorial.readthedocs.io/en/latest/setup_py.html
Guidelines to contribute to libraries: https://pandas.pydata.org/docs/development/contributing.html#contributing
Metadata
Release files for worldenergydata 0.0.1
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 |
|---|---|---|---|---|
| worldenergydata-0.0.1.tar.gz | 72.5 kB | Without provenance | Details for worldenergydata-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| worldenergydata-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for worldenergydata-0.0.1-py3-none-any.whl |
Total release size: 167.3 kB
Release files / worldenergydata-0.0.1.tar.gz
| Download URL | worldenergydata-0.0.1.tar.gz |
|---|---|
| Size | 72.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee38913e050bd685c3d70150ce9ebf3ab739465d901c03f938d5ddcfc2357d0f
|
|
BLAKE2b-256 checksum How to use checksums |
940d5bfdfd7ddfb377db7b204a407e6e2301c7b75eb3dbee8e341992874d8667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / worldenergydata-0.0.1-py3-none-any.whl
| Download URL | worldenergydata-0.0.1-py3-none-any.whl |
|---|---|
| Size | 94.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de6f3ae86b0d9d161c233120faf9ceb176550cf85438c7eaa60b11a42449f861
|
|
BLAKE2b-256 checksum How to use checksums |
97f53d75cd58aeb2840465c62922e6a44f27de1d5b067e33bcbb45ec1c8cafb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for worldenergydata 0.0.1
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.