Skip to main content

setuptools-pyecore

Build Status Coverage Status PyPI Version GitHub Version License

Overview

A setuptools command for generating Python code from Ecore models.

Installation

setuptools-pyecore can be installed in various ways. To run it the following prerequisites have to be fulfilled:

  • Python 3.4+

  • setuptools 29.0.0+

After installation, the used Python environment has a new setuptools command called pyecore.

From Source Code

> git clone https://github.com/pyecore/setuptools-pyecore.git
> cd setuptools-pyecore
> pip install .

From PyPI

> pip install setuptools-pyecore

From GitHub Releases

> pip install <setuptools-pyecore_wheel>

Usage

Integration

For a smooth user experience it’s recommended to pass setuptools-pyecore using the setup_requires argument of setup function. Additionally the generated Python code depends on the pyecore library which should be added to install_requires argument:

setup(
    ...
    setup_requires=['setuptools-pyecore'],
    install_requires=['pyecore']
    ...
)

Before generating Python code from a given Ecore model setuptools will automatically check the Python environment and download setuptools-pyecore from PyPI if it’s missing. During the installation of the project package pip will install pyecore into the Python environment.

Configuration

setuptools-pyecore provides two possibilities to configure the pyecore generator.

All options can be passed on the command line after the pyecore command:

> python setup.py pyecore --auto-register-package

It’s also possible to pass several options to pyecoregen or execute multiple commands at once:

> python setup.py pyecore --auto-register-package --output "default=gen" bdist_wheel

See python setup.py pyecore --help for available command line options:

> python setup.py pyecore --help
...
Options for 'PyEcoreCommand' command:
  --ecore-models (-e)      specify Ecore models to generate code for
  --output (-o)            specify directories where output is generated
  --user-modules           dotted names of modules with user-provided mixins
                           to import from generated classes
  --auto-register-package  Generate package auto-registration for the PyEcore
                           'global_registry'
...

The pyecoregen documentation explains all command line options in detail.

Apart from passing options on the command line it’s also possible to add a dedicated [pyecore] section to setup.cfg. The following example section contains all available options:

[pyecore]
# Specify Ecore models to generate code for; default: None
#ecore-models = <ecore-model> [<ecore-model> ...]
# Specify directories where output is generated; default: ./
output = default=gen
# Dotted names of modules with user-provided mixins to import from generated classes; default: None
#user-modules = [<model>=<user module>]
#               [<model>=<user module> ...]
# Generate package auto-registration for the PyEcore 'global_registry' (yes|no); default: no
auto-register-package = yes

A reference configuration is provided in the resources directory.

pyecoregen inherits the log level globally configured for setuptools. To set the verbosity to a certain log level pass the global options verbose or quiet straight before the pyecore command on the command line:

> python setup.py --verbose pyecore

Alternatively, you can add these options to the [global] section of your setup.cfg:

[global]
# Run verbosely (yes|no); default: yes
#verbose = yes
# Run quietly and turns verbosity off (yes|no); default: no
quiet = yes

Sample

Besides the setuptools-pyecore source code a sample project called library is provided in the samples directory. This sample consists of the Ecore model library and a setup script. During the execution of setuptools-pyecore a Python package will be generated into the library package directory representing the classes from the library Ecore model.

To generate code out of the Ecore model and build a library wheel package execute the following command:

> python setup.py pyecore bdist_wheel

Metadata

Release files for setuptools-pyecore 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for setuptools-pyecore 0.1.0
File Size Uploaded Provenance Actions
setuptools-pyecore-0.1.0.tar.gz 6.5 kB Without provenance Details for setuptools-pyecore-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-pyecore 0.1.0
File Interpreter ABI Platform Actions
setuptools_pyecore-0.1.0-py3-none-any.whl Python 3 none any Details for setuptools_pyecore-0.1.0-py3-none-any.whl

Total release size: 12.1 kB

Release files / setuptools-pyecore-0.1.0.tar.gz

Download URL setuptools-pyecore-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e3759770f30791ed74f9e893232038554e988eb9b605c40d046635bee842af55
BLAKE2b-256 checksum
How to use checksums
d3f4b92e562e07b6061a9ec2636678bcd27b05dbc6f0d6d8f147cc7a50c6f9e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

Release files / setuptools_pyecore-0.1.0-py3-none-any.whl

Download URL setuptools_pyecore-0.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f71fda9a2a0672ae1369795b56ff2bc8b1b038e9545691d5629e9d60340b50f
BLAKE2b-256 checksum
How to use checksums
8e53acd6f14c498a9545f0ea33d0d796a64e3dc32a05e0e1acba04ada90ff3b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

Security for setuptools-pyecore 0.1.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page