Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package and deploy the extension #13

Merged
merged 9 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
__pycache__/
build/
env/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party/make-env"]
path = third_party/make-env
url = https://github.com/SymbiFlow/make-env/
16 changes: 16 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

formats:
- htmlzip

conda:
environment: environment.yml
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: minimal

before_install:
- make env
- source env/conda/bin/activate sphinx-verilog-domain

stages:
- name:
- Build
- Deploy

jobs:
- stage: Build
name: "Build"
script:
- make build

- stage: Deploy
name: "PyPI"
before_deploy:
- sudo ln -sf /usr/bin/python3 /usr/bin/python
deploy:
provider: pypi
username: __token__
distributions: sdist bdist_wheel
skip_existing: true
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (C) 2020 SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC

# The top directory where environment will be created.
TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

# A pip `requirements.txt` file.
# https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
REQUIREMENTS_FILE := requirements.txt

# A conda `environment.yml` file.
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
ENVIRONMENT_FILE := environment.yml

include third_party/make-env/conda.mk

# Build the package locally

build: $(CONDA_ENV_PYTHON)
$(IN_CONDA_ENV) python setup.py sdist bdist_wheel && twine check dist/*

build-clean:
rm -rf env/downloads/conda-pkgs
rm -rf build dist *.egg-info
find -name *.pyc -delete
find -name __pycache__ -delete

.PHONY: build build-clean

clean:: build-clean
18 changes: 12 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
Sphinx Verilog Domain
sphinx-verilog-domain
=====================

.. warning::
This extension is in development stage.

.. note::
This extension is not a part of sphinxcontrib yet.
This extension is in development stage.

Dependencies
------------
Expand All @@ -17,7 +15,7 @@ Enabling

Add extension in ``conf.py``::

extensions = [ 'sphinxcontrib.verilogdomain' ]
extensions = [ 'sphinx_verilog_domain' ]

Usage
-----
Expand Down Expand Up @@ -64,7 +62,6 @@ Nesting::

Reference to module ``Top1``'s port ``a``: :verilog:ref:`Top1.a`.


Namespaces
^^^^^^^^^^

Expand All @@ -89,3 +86,12 @@ Example::
.. verilog:port:: input inside_a_b_again;
.. verilog:namespace::
.. verilog:port:: input in_global_namespace;

Development
-----------

To create and open the development environment with all system
and python packages use::

make env
source env/conda/bin/activate sphinx-verilog-domain
10 changes: 5 additions & 5 deletions example/Makefile → docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS = -E -v
SPHINXBUILD = python -msphinx
SPHINXPROJ = verilogdomain-test
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

Expand All @@ -16,5 +16,5 @@ help:

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%:
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
git+https://github.com/SymbiFlow/sphinx_symbiflow_theme

sphinx
symbolator
sphinxcontrib-verilog-diagrams
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should reference the local package, otherwise it will be downloaded from PyPi?

Suggested change
sphinxcontrib-verilog-diagrams
-e ../

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is about sphinxcontrib-verilog-diagrams not about sphinx-verilog-domain.

Nevertheless, the relative dependencies are not handled properly by conda. If you add the -e ../ to the requirements file, the main environment (created by make-env) will not be created. Conda seems to handle relative dependencies in the requirements file, as a relative to the environment.yml not to the requirements file itself:

Pip subprocess error:
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /mnt/hdd1//verilog_domain_ws

The repository is placed in:

/mnt/hdd1/verilog_domain_ws/sphinx-verilog-domain

The sphinx-verilog-domain package is installed in the environment.yml directly.
Since the RTD build also uses conda and the documentation build should happen inside this environment, I think that the -e ../ can be omitted in the docs/requirements.txt

Copy link
Contributor Author

@rw1nkler rw1nkler Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mithro do you agree to left those files in that way? The problem with this convention will never occur unless somebody will decide to build the documentation without using make-env for this repository. This is exactly the same way as it is done for sphinxcontrib-verilog-diagrams.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rw1nkler - I was sure that I had solved this somewhere...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bunch of discussion at pypa/pip#328

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this problem is not resolved for the requirements.txt (It will be fixed by the pipfile):

As I said before, the problem with the current settings will happen only if somebody will build the docs outside the make-env environment, which is generally wrong. I think that we should leave the requirements file as they are now.

92 changes: 92 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'Sphinx Verilog Domain'
copyright = '2020, SymbiFlow Team'
author = 'SymbiFlow Team'

# The full version, including alpha/beta/rc tags
release = '0.1'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_verilog_domain',
'symbolator_sphinx',
'sphinxcontrib_verilog_diagrams'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_symbiflow_theme'

# Values used for configuring Sphinx SymbiFlow Theme

html_theme_options = {
'header_links' : [
('Home', 'index', False, 'home'),
],
# Customize css colors.
# For details see link.
# https://getmdl.io/customize/index.html
#
# Values: amber, blue, brown, cyan deep_orange, deep_purple, green, grey, indigo, light_blue,
# light_green, lime, orange, pink, purple, red, teal, yellow(Default: indigo)
'primary_color': 'red',
# Values: Same as primary_color. (Default: pink)
'accent_color': 'blue',

# Customize layout.
# For details see link.
# https://getmdl.io/components/index.html#layout-section
'fixed_drawer': True,
'fixed_header': True,
'header_waterfall': True,
'header_scroll': False,

# Render title in header.
# Values: True, False (Default: False)
'show_header_title': False,
# Render title in drawer.
# Values: True, False (Default: True)
'show_drawer_title': True,
# Render footer.
# Values: True, False (Default: True)
'show_footer': True
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Sphinx Verilog Domain
=====================

.. warning::

Documentation for this Sphinx extension is under development.
Below you can find basic tests for the extension.

.. toctree::
:maxdepth: 2
:caption: Tests

tests/index

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: sphinx-verilog-domain
channels:
- symbiflow
- conda-forge
- defaults
dependencies:
- python=3.7
- docutils
- sphinx
- pango
- pycairo
- pygobject
- yosys
- netlistsvg
- pip
- pip:
- -r file:requirements.txt
- -r file:docs/requirements.txt
- .
Loading