Skip to content

Commit

Permalink
Deprecating import via 'peakrdl.ipxact' namespace package. #9
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Jun 8, 2022
1 parent 4bb0e65 commit dae351f
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Test
run: |
cd tests
pytest --cov=peakrdl
pytest --cov=peakrdl_ipxact
- name: Coveralls
if: ${{ matrix.python-version != 3.5 }} # coveralls no longer works well on 3.5
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Run Lint
run: |
pylint --rcfile tests/pylint.rc peakrdl
pylint --rcfile tests/pylint.rc peakrdl_ipxact
#-------------------------------------------------------------------------------
mypy:
Expand All @@ -117,7 +117,7 @@ jobs:
- name: Type Check
run: |
mypy --config-file tests/mypy.ini src/peakrdl
mypy --config-file tests/mypy.ini src/peakrdl_ipxact
#-------------------------------------------------------------------------------
build_sdist:
Expand Down
4 changes: 2 additions & 2 deletions docs/exporter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ into IP-XACT.
API
---

.. autoclass:: peakrdl.ipxact.IPXACTExporter
.. autoclass:: peakrdl_ipxact.IPXACTExporter
:special-members: __init__
:members: export

.. autoclass:: peakrdl.ipxact.Standard
.. autoclass:: peakrdl_ipxact.Standard
:members:
2 changes: 1 addition & 1 deletion docs/importer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ in order to show otherwise hidden <addressBlock> elements.
API
---

.. autoclass:: peakrdl.ipxact.IPXACTImporter
.. autoclass:: peakrdl_ipxact.IPXACTImporter
:special-members: __init__
:members: import_file
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ into IP-XACT.
import sys
from systemrdl import RDLCompiler, RDLCompileError
from peakrdl.ipxact import IPXACTExporter, Standard
from peakrdl_ipxact import IPXACTExporter, Standard
rdlc = RDLCompiler()
Expand Down Expand Up @@ -61,7 +61,7 @@ register model.
import sys
from systemrdl import RDLCompiler, RDLCompileError
from peakrdl.ipxact import IPXACTImporter
from peakrdl_ipxact import IPXACTImporter
rdlc = RDLCompiler()
ipxact = IPXACTImporter(rdlc)
Expand Down
4 changes: 2 additions & 2 deletions examples/convert_to_ipxact.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys
from systemrdl import RDLCompiler, RDLCompileError
from peakrdl.ipxact import IPXACTExporter
from peakrdl_ipxact import IPXACTExporter

# Collect input files from the command line arguments
input_files = sys.argv[1:]
Expand All @@ -14,7 +14,7 @@
# Compile all the files provided
for input_file in input_files:
rdlc.compile_file(input_file)

# Elaborate the design
root = rdlc.elaborate()
except RDLCompileError:
Expand Down
2 changes: 1 addition & 1 deletion examples/print_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from systemrdl import RDLCompiler, RDLListener, RDLWalker, RDLCompileError
from systemrdl.node import FieldNode
from peakrdl.ipxact import IPXACTImporter
from peakrdl_ipxact import IPXACTImporter

# Collect input files from the command line arguments
input_files = sys.argv[1:]
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
long_description = fh.read()


with open(os.path.join("src/peakrdl/ipxact", "__about__.py"), encoding='utf-8') as f:
with open(os.path.join("src/peakrdl_ipxact", "__about__.py"), encoding='utf-8') as f:
v_dict = {}
exec(f.read(), v_dict)
version = v_dict['__version__']
Expand All @@ -20,7 +20,10 @@
long_description_content_type="text/markdown",
url="https://github.com/SystemRDL/PeakRDL-ipxact",
package_dir={'': 'src'},
packages=setuptools.find_namespace_packages("src", include=['peakrdl.*']),
packages=[
"peakrdl_ipxact",
"peakrdl.ipxact", # backwards compatibility shim
],
include_package_data=True,
python_requires='>=3.5.2',
install_requires=[
Expand Down
1 change: 0 additions & 1 deletion src/peakrdl/ipxact/__about__.py

This file was deleted.

25 changes: 22 additions & 3 deletions src/peakrdl/ipxact/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
from .__about__ import __version__
# Load modules
import warnings

from .exporter import IPXACTExporter, Standard
from .importer import IPXACTImporter
from peakrdl_ipxact import __about__
from peakrdl_ipxact import exporter
from peakrdl_ipxact import importer
from peakrdl_ipxact import typemaps

# hoist internal objects
from peakrdl_ipxact.__about__ import __version__
from peakrdl_ipxact.exporter import IPXACTExporter, Standard
from peakrdl_ipxact.importer import IPXACTImporter


warnings.warn(
"""
================================================================================
Importing via namespace package 'peakrdl.ipxact' is deprecated and will be
removed in the next release.
Change your imports to load the package using 'peakrdl_ipxact' instead.
For more details, see: https://github.com/SystemRDL/PeakRDL/issues/4
================================================================================
""", DeprecationWarning, stacklevel=2)
1 change: 1 addition & 0 deletions src/peakrdl_ipxact/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "3.1.0"
4 changes: 4 additions & 0 deletions src/peakrdl_ipxact/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .__about__ import __version__

from .exporter import IPXACTExporter, Standard
from .importer import IPXACTImporter
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[paths]
source =
../src/peakrdl/
*/site-packages/*/peakrdl
*/site-packages/peakrdl
../src/peakrdl_ipxact/
*/site-packages/*/peakrdl_ipxact
*/site-packages/peakrdl_ipxact

[report]
exclude_lines =
Expand Down
6 changes: 3 additions & 3 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ $this_dir/schema/1685-2014/download_schema.sh
$this_dir/schema/1685-2009/download_schema.sh

# Run unit tests while collecting coverage
$pytest --cov=peakrdl
$pytest --cov=peakrdl_ipxact

# Generate coverage report
$coverage html -d $this_dir/htmlcov

# Run lint
$pylint --rcfile $this_dir/pylint.rc ../src/peakrdl | tee $this_dir/lint.rpt
$pylint --rcfile $this_dir/pylint.rc ../src/peakrdl_ipxact | tee $this_dir/lint.rpt

# Run static type checking
$mypy $this_dir/../src/peakrdl
$mypy $this_dir/../src/peakrdl_ipxact

rm -f tmp*.xml
2 changes: 1 addition & 1 deletion tests/test_import_export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from peakrdl.ipxact.exporter import Standard
from peakrdl_ipxact.exporter import Standard

from .unittest_utils import IPXACTTestCase

Expand Down
4 changes: 2 additions & 2 deletions tests/unittest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from systemrdl import RDLCompiler
from systemrdl.messages import MessagePrinter
from peakrdl.ipxact import IPXACTImporter, IPXACTExporter
from peakrdl.ipxact.exporter import Standard
from peakrdl_ipxact import IPXACTImporter, IPXACTExporter
from peakrdl_ipxact.exporter import Standard

#===============================================================================
class TestPrinter(MessagePrinter):
Expand Down

0 comments on commit dae351f

Please sign in to comment.