Skip to main content

Python model for the Fortran package manifest

Project description

Latest release PyPI License CI status Codecov

This project provides a pydantic model of the fpm package manifest format used in the Fortran package manager.

Installation

Install this project with pip

pip install git+https://github.com/fortran-lang/fpm-metadata

Usage

You can read a package manifest with your TOML library of choice and construct a manifest object from it which allows to access all package entries directly in Python

>>> from fpm.metadata import Manifest
>>> from tomlkit import loads
>>> with open("fpm.toml") as fh:
...     package = Manifest(**loads(fh.read()))
...
>>> package.name
'fpm'
>>> package.version
'0.2.0'

Alternatively, you can use the load_manifest function to read a package manifest

>>> from pathlib import Path
>>> from fpm.metadata import load_manifest
>>> package = load_manifest(Path("fpm.toml"))
>>> package.name
'fpm'
>>> package.version
'0.2.0'

Finally, you can dump a package manifest to a TOML string using the dump_manifest function

>>> from pathlib import Path
>>> from fpm.metadata import dump_manifest, load_manifest
>>> package = load_manifest(Path("fpm.toml"))
>>> print(dump_manifest(package))
name = "fpm"
version = "0.2.0"
...

Development

This project is hosted on GitHub at fortran-lang/fpm-metadata. Obtain the source by cloning the repository with

git clone https://github.com/fortran-lang/fpm-metadata
cd fpm-metadata

We recommend using a conda environment to install the package. You can setup the environment manager using a mambaforge installer. Install the required dependencies from the conda-forge channel.

mamba env create -n devel -f environment.yml
mamba activate devel

Install this project with pip in the environment

pip install .

Add the option -e for installing in development mode.

The following dependencies are required

You can check your installation by running the test suite with

pytest tests/ --pyargs fpm.metadata --doctest-modules

For code formatting black is used:

black src/ tests/

Contributing

This is a volunteer open source projects and contributions are always welcome. Please, take a moment to read the contributing guidelines.

License

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “as is” basis, without warranties or conditions of any kind, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

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

fpm-metadata-0.2.2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

fpm_metadata-0.2.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file fpm-metadata-0.2.2.tar.gz.

File metadata

  • Download URL: fpm-metadata-0.2.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for fpm-metadata-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ec9a14cf6be6ae56ce906d69cd0bdaaa5775b25dc6e0b18a55c576a26c778967
MD5 b55391df859c857896915a814e1f9451
BLAKE2b-256 4c4337f2ad51c312a5548da200eb31b89e24e09c8aa9355526e456c3b0320357

See more details on using hashes here.

File details

Details for the file fpm_metadata-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: fpm_metadata-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for fpm_metadata-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e12b024f07bc4563b2f63f5fb8d4771591f0b8c8cf5021872a770b9750d97acc
MD5 6b53df4a59a91adaa5d9964ced63bab8
BLAKE2b-256 21bd12d65c792bfe277725de53d99e804540283c456c305df94645e312487485

See more details on using hashes here.

Supported by

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