Autometa
Autometa is a simple & focused solution to reading metadata from a variety of file formats into a python class obj
---- Using Autometa Object ---- (Best if passing a file)
>>> from autometa import Autometa
>>> md = Autometa(absolute_file_path="/example/file/path") # optional to pass filepath-- without filepath will only support pip installs & uninstalls
>>> md.update_metadata() #toml_var only needs to be specified if you are reading a toml string from a .py file
>>> md.get_metadata()
{'project': {'dependencies': ['example1', 'example2', 'example3']}}
>>> md.parse_dependencies()
"Dependencies successfully parsed: ['example1', 'example2', 'example3']"
>>>md.pip_install_dependencies(dependencies=["additionalPkg1", "additionalPkg2"]) # installs related packages as well
'''Collecting additionalPkg1 -> install attempt... Collecting additionalPkg2 -> install attempt...
Collecting example1... -> install attempt, Collecting example2 -> install attempt... ,
Collecting example3 -> install attempt... '''
>>> md.pip_uninstall_dependencies(exclusions=["additionalPkg1","example1"])
# will remove newly installed related packages as well
'''Found existing installation: example2 -> Uninstalling example2...
Found existing installation: example3 -> Uninstalling example3...
'''
---- Using Autometa API ----
>>> import autometa
>>> md = autometa.fetch_metadata(absolute_file_path="/example/file/path")
{'project': {'dependencies': ['example1', 'example2', 'example3']}}
>>> dependencies = autometa.fetch_dependencies(absolute_file_path="/example/file/path", toml_table_key="project",
toml_table_value="dependencies")
"Dependencies successfully parsed: ['example1', 'example2', 'example3']"
>>>md = autometa.pip_install(absolute_file_path="/example/file/path",
manual_input_list=["additionalPkg1", "additionalPkg2"],
toml_table_key="project",toml_table_value="dependencies")
'''Collecting additionalPkg1 -> install attempt... Collecting additionalPkg2 -> install attempt...
Collecting example1... -> install attempt, Collecting example2 -> install attempt... ,
Collecting example3 -> install attempt... '''
>>> md.pip_uninstall(absolute_file_path="/example/file/path",
exclusions_list = ["example1","additionalPkg1","additionalPkg2"],
toml_table_key="project",toml_table_value="dependencies")
'''Found existing installation: example2 -> Uninstalling example2...
Found existing installation: example3 -> Uninstalling example3...
'''
autometa allows you to easily parse in data from .json, .yaml/.yml, .toml, and .py files into a dictionary object in a python class object with a helper function to parse in a list of dependencies listed in said files.
Installing autometa
autometa is available on PyPI:
$ python -m pip install autometa
Features & Best Practices
- Parse in a variety of formatted data into an object holding a dictionary of parsed data using a single function call
- Pip install / uninstall a list of user-input or file-fed dependencies
- By default, dependencies are searched for under a structure that looks like this:
-
for .json:
{
"project":
{
"dependencies": ['example1', 'example2', 'example3']
}
} -
for .yaml/.yml:
project:
dependencies: ['example1', 'example2', 'example3'] -
for .toml
[project]
dependencies = ["scrapy", "requests", "numpy"] -
for .py
'''
#META_TOML_START [project]
dependencies = ["requests", "fastapi", "pygame"]
#META_TOML_END '''
-
Cloning the repository
git clone https://github.com/mikl-o/autometa.git
Metadata
Release files for autometa 0.3.0
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 | |
|---|---|---|---|---|
| autometa-0.3.0.tar.gz | 11.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autometa-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / autometa-0.3.0.tar.gz
| Download URL | autometa-0.3.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
daaa5ab05fb591ab3c1b52e23729eef3a40e22ecbfa243a6cb0ade53583c9866
|
|
BLAKE2b-256 checksum How to use checksums |
e971afa0970dd80817b7712e599474de31dab78b2325fcd2a00a4eada023b478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / autometa-0.3.0-py3-none-any.whl
| Download URL | autometa-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c53634f0df2baec92aef7cc52b105779b9c45cd8f593fa4fdbf69dcd2bcecf2
|
|
BLAKE2b-256 checksum How to use checksums |
71c414bb96130562444b47047b424d74eb7041db18fb5d2efe1e5a210646d473
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for autometa 0.3.0
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.